Difference between revisions of "Ifconfig"

From Noah.org
Jump to navigationJump to search
Line 11: Line 11:
  
 
== Virtual Interfaces ==
 
== Virtual Interfaces ==
This is trivial in Linux. Just add a number to a real interface
+
 
<pre># ifconfig eth0:1 192.168.0.3 netmask 255.255.255.0</pre>
+
Add virtual interfaces is trivial in Linux. Just add a number to a real interface (in this example, eth0).
 +
So here we configure eth0:1:
 +
 
 +
<pre>
 +
# ifconfig eth0:1 192.168.0.3 netmask 255.255.255.0
 +
</pre>
  
 
== Delete an interface ==
 
== Delete an interface ==
 
Use the 'down' command:
 
Use the 'down' command:
 
<pre># ifconfig eth0:1 down</pre>
 
<pre># ifconfig eth0:1 down</pre>

Revision as of 13:23, 27 July 2007

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

Add virtual interfaces is trivial in Linux. Just add a number to a real interface (in this example, eth0). So here we configure eth0:1:

# ifconfig eth0:1 192.168.0.3 netmask 255.255.255.0

Delete an interface

Use the 'down' command:

# ifconfig eth0:1 down