Common Manual Network Interface Tasks

Network interfaces are established in the kernel at boot time by probing Ethernet hardware. As a result, these interfaces always exist unless the hardware or kernel module is removed. The interfaces are transient and exist only when they are in use.

To list interface parameters, use ifconfig with the interface name:

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:A0:24:D3:C7:21
          inet addr:  Bcast:  Mask:
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:1857128 errors:46 dropped:0 overruns:0 frame:46
          TX packets:871709 errors:0 dropped:0 overruns:0 carrier:0
          collisions:2557 txqueuelen:100
          Interrupt:10 Base address:0xef00

If you run ifconfig without any parameters, it displays all active interfaces, including the loopback interface lo and perhaps a PPP interface if a modem is dialed into a service provider or a wireless interface such as ath0 if you have an active wireless card.

To shut down a network interface that is currently running, simply use ifconfig with the down keyword:

# ifconfig eth0 down

When the interface goes down, any routes associated with it are removed from the routing table. For a typical system with a single Ethernet interface, this means that the routes to both the interface and the default gateway will be lost. Therefore, to start a previously configured network interface, ifconfig is used with up, followed by the necessary route commands. For example:

# ifconfig eth0 up
# route add -host ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.