Use ifconfig command to list all currently configured interfaces on system
Listing Linux Configuration Interfaces
How do I use the ifconfig command to list all currently configured interfaces on the system?
Now that you have seen which network interfaces are available on your system, you can learn how to configure them.
To configure a TCP/IP network interface, you must program it with its IP address and netmask.
The command for working with network interfaces under UNIX is ifconfig. The ifconfig command has three purposes: listing configured interfaces, bringing interfaces up and down, and setting the IP address and netmask.
Listing configured Interfaces
If run with no arguments, ifconfig will list all currently configured interfaces on the system and basic status information about each interface.
Point to Point Protocol
The following mouse over below examines output from a Linux machine, which shows a configured PPP interface.
The link-layer protocol (Point-to-Point Protocol=PPP)
The IP address of the two ends of the PPP connection (128.248.9.157 and 128.248.9.13, respectively)
The netmask (255.255.0.0)
The interface status, plus other flags (UP, RUNNING, POINTTOPOINT)
The maximum transmission unit (MTU), which is the largest link-layer frame the protocol supports (1500 bytes)
The metric, an artificial number representing the distance between the two ends of the connection.
The metric is used by the routing protocols.
Statistics on packets received (RX)
Statistics on packets transmitted (TX)
The link-layer protocol (Point-to-Point Protocol=PPP)
Solaris Command
The Solaris version of this command is slightly less informative, and requires the option -a.
The following example contains the list config
listconfig consisting of lo0: and hme0:
In this example, we see two configured interfaces. The first, lo0, is the loopback address[1]. We can tell from its inet address of 127.0.0.1 and from the LOOPBACK flag shown.
The second, hme0, is an ethernet card with IP address 131.183.175.221, netmask ffffff00=255.255.255.0, and MTU 1500.
(Notice that in this example, Solaris ifconfig does not report the ethernet address of hme0. Some versions of Solaris ifconfig, however, will list ethernet addresses, so your listing may differ slightly.)
Bringing interfaces up and down
The ifconfig command may be used to activate and deactivate a network interface.
For example, to toggle the state of the eth0 device, use:
host# /sbin/ifconfig eth0 down
host# /sbin/ifconfig eth0 up
Note that root permissions are necessary to bring an interface up or down.
Configuring Interface - Quiz
Click the Quiz link below to take a short multiple-choice quiz on configuring an interface. Configuring Interface - Quiz
[1]Loopback address: 127.0.0.1. This address is used for diagnostics.