Everything in this chapter depends on your network connection. At the end of this chapter, in "Troubleshooting Network Problems," you're going to learn ways to fix problems with your network connection. Here at the beginning, let's find out what network connections you have in place and their status.
To get a quick look at all of your network devices, whether they're running or not, use ifconfig (which stands for interface configuration) with the -a (for all) option. Here's what you might see on a laptop (note that some distributions require you to log on as root to use ifconfig):
$ ifconfig -a ath0 Link encap:Ethernet HWaddr 00:14:6C:06:6B:FD inet addr:192.168.0.101 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::214:6cff:fe06:6bfd/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1257 errors:7557 dropped:0 overruns:0 frame:7557 TX packets:549 errors:2 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:200 RX bytes:195869 (191.2 KiB) TX bytes:95727 (93.4 KiB) Interrupt:11 Memory:f8da0000-f8db0000 eth0 Link encap:Ethernet HWaddr 00:02:8A:36:48:8A BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:11092 errors:0 dropped:0 overruns:0 frame:0 TX packets:11092 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:982629 (959.5 KiB) TX bytes:982629 (959.5 KiB)
Three interfaces are listed here: ath0 (a wireless card), eth0 (an Ethernet card), and lo (the loopback interfacemore on that in a moment). For each of those, you're told the type of connection, the Media Access Control (MAC) or hardware address, the IP address, the broadcast and subnet mask addresses, and information about received and transmitted packets, among other data. If a connection is disconnected, much of that information is missing. In fact, that's one way you can see that ath0 and lo are up, and eth0 is down: eth0 is missing an IP address, among other important details. Of course, an easier way to tell is that the fourth line of the ath0 and lo interfaces begins with UP, while eth0 does not.
Let's take the three interfaces in reverse order. lo is the loopback address, which enables a machine to refer to itself. The loopback address is always represented by the IP address of 127.0.0.1. Basically, your system needs it to work correctly. If you have it, don't worry about it; if you don't have it, you'll know it because you will find yourself in a world of hurt.
For more on the loopback interface and address, see Wikipedia's "Loopback" at http://en.wikipedia.org/wiki/Loopback.
eth0 is an Ethernet card, into which you actually plug cables. No cables are plugged into the Ethernet card's port currently, so it's not activated, hence the lack of any addresses: IP, broadcast, and subnet mask. It's possible to have both a wired and wireless interface running at the same time, although it's usually not necessary.
Finally there is ath0, a wireless PCMCIA card. You might also see a wireless card with a name like eth0 if it's the primary network interface, or eth1 if it's secondary. When the wireless card was inserted, K/Ubuntu automatically recognized it and configured the system to work with it, giving it the ath0 identifier. Because wireless interfaces are just Ethernet interfaces with some extra wireless goodies, the information you get with ifconfig is similar to what you'd see for eth0 if it was up.
You may see other names for your network devices, such as wlan0 for wireless cards.
ifconfig -a shows all interfaces, even those that are down; ifconfig by itself shows just those connections that are up. It's a quick way to check the status of your network interfaces, especially if you need to find your IP address quickly.
You can also configure your network interfaces using ifconfig, a process described later in "Configure a Network Interface."