Recipe 3.1 Listing Your Network Interfaces

3.1.1 Problem

You want a list of your network interfaces.

3.1.2 Solution

To list all interfaces, whether up or down, whose drivers are loaded:

$ ifconfig -a

To list all interfaces that are up:

$ ifconfig

To list a single interface, commonly eth0:

$ ifconfig eth0

3.1.3 Discussion

If you are not root, ifconfig might not be in your path: try /sbin/ifconfig.

When invoked with the -a option, ifconfig lists all network interfaces that are up or down, but it will miss physical interfaces whose drivers are not loaded. For example, suppose you have a box with two Ethernet cards installed (eth0 and eth1) from different manufacturers, with different drivers, but only one (eth0) is configured in Linux (i.e., there is an /etc/sysconfig/network-scripts/ifcfg-* file for it). The other interface you don't normally use. ifconfig -a will not show the second interface until you run ifconfig eth1 to load the driver.

3.1.4 See Also

ifconfig(8).



Linux Security Cookbook
Linux Security Cookbook
ISBN: 0596003919
EAN: 2147483647
Year: 2006
Pages: 247

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net