Difference between revisions of "Ifconfig"
From Noah.org
Jump to navigationJump to searchLine 12: | Line 12: | ||
== Virtual Interfaces == | == Virtual Interfaces == | ||
− | + | Adding virtual interfaces is easy in Linux. Just add a number to a real interface name. In this example, I assume 'eth0' is the real interface name, so I will configure 'eth0:1' (you can pick any free number after the 'eth0:'). The netmask defaults to 255.255.255.0. | |
− | |||
<pre> | <pre> | ||
− | + | ifconfig eth0:1 192.168.0.3 | |
+ | </pre> | ||
+ | |||
+ | If you need to specify the netmask, this is easy: | ||
+ | |||
+ | <pre> | ||
+ | ifconfig eth0:1 192.168.0.3 netmask 255.255.255.128 | ||
</pre> | </pre> | ||
Latest revision as of 19:52, 3 September 2008
Set static IP
These settings are lost on reboot. This is just for a temporary config.
# ip route add default via 192.168.0.1 # ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Virtual Interfaces
Adding virtual interfaces is easy in Linux. Just add a number to a real interface name. In this example, I assume 'eth0' is the real interface name, so I will configure 'eth0:1' (you can pick any free number after the 'eth0:'). The netmask defaults to 255.255.255.0.
ifconfig eth0:1 192.168.0.3
If you need to specify the netmask, this is easy:
ifconfig eth0:1 192.168.0.3 netmask 255.255.255.128
Delete an interface
Use the 'down' command:
# ifconfig eth0:1 down