Difference between revisions of "Ifconfig"

From Noah.org
Jump to navigationJump to search
m
Line 2: Line 2:
 
[[Category: Networking]]
 
[[Category: Networking]]
 
== Set static IP ==
 
== Set static IP ==
<pre># ifconfig eth0 192.168.0.2 netmask 255.255.255.0</pre>
+
 
 +
These settings are lost on reboot. This is just for a temporary config.
 +
 +
<pre>
 +
# ip route add default via 192.168.0.1
 +
# ifconfig eth0 192.168.0.2 netmask 255.255.255.0
 +
</pre>
  
 
== Virtual Interfaces ==
 
== Virtual Interfaces ==

Revision as of 13:22, 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

This is trivial in Linux. Just add a number to a real interface

# ifconfig eth0:1 192.168.0.3 netmask 255.255.255.0

Delete an interface

Use the 'down' command:

# ifconfig eth0:1 down