13.1. Network Configuration

ifconfig

This command is used to configure network interfaces, or to display their current configuration. In addition to activating and deactivating interfaces with the “up” and “down” settings, this command is necessary for setting an interface's address information if you don't have the ifcfg script.

Use ifconfig as either:

ifconfig

This will simply list all information on all network devices currently up.

ifconfig eth0 down

This will take eth0 (assuming the device exists) down, it won't be able to receive or send anything until you put the device back “up” again.

Clearly there are a lot more options for this tool, you will need to read the manual/info page to learn more about them.

ifup

Use ifup device-name to bring an interface up by following a script (which will contain your default networking settings). Simply type ifup and you will get help on using the script.

For example typing:

ifup eth0

Will bring eth0 up if it is currently down.

ifdown

Use ifdown device-name to bring an interface down using a script (which will contain your default network settings). Simply type ifdown and you will get help on using the script.

For example typing:

ifdown eth0

Will bring eth0 down if it is currently up.

ifcfg

Use ifcfg to configure a particular interface. Simply type ifcfg to get help on using this script.

For example, to change eth0 from 192.168.0.1 to 192.168.0.2 you could do:

ifcfg eth0 del 192.168.0.1
ifcfg eth0 add 192.168.0.2

The first command takes eth0 down and removes that stored IP address and the second one brings it back up with the new address.

route

The route command is the tool used to display or modify the routing table. To add a gateway as the default you would type:

route add default gw some_computer