14.06.2014 Views

Unix Power Tools

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

46.3<br />

telnet<br />

23/udp<br />

smtp 25/tcp mail #Simple Mail Transfer<br />

smtp 25/udp mail #Simple Mail Transfer<br />

—DJPH<br />

46.3 Status and Troubleshooting<br />

ifconfig can be used to configure network devices (44.8), but it also can be used to<br />

see the current network device configuration. ifconfig–a is very useful for this.<br />

Here’s some sample output on a FreeBSD machine:<br />

% ifconfig -a<br />

rl0: flags=8843 mtu 1500<br />

inet 192.168.1.1 netmask 0xffffffc0 broadcast 192.168.1.255<br />

inet 192.168.1.5 netmask 0xffffffff broadcast 192.168.1.255<br />

inet 192.168.1.6 netmask 0xffffffff broadcast 192.168.1.255<br />

inet 192.168.1.7 netmask 0xffffffff broadcast 192.168.1.255<br />

ether 0a:5c:da:a3:53:11<br />

media: autoselect (100baseTX ) status: active<br />

supported media: autoselect 100baseTX 100baseTX 10baseT/UTP<br />

10baseT/UTP 100baseTX <br />

lo0: flags=8049 mtu 16384<br />

inet 127.0.0.1 netmask 0xff000000<br />

This shows two network devices: rl0, which is an Ethernet card, and lo0, which<br />

is the loopback device. rl0’s primary IP address is 192.168.1.1, and it has aliases<br />

(that is, it also answers to) 192.168.1.5 through 192.168.1.6. This also shows me<br />

that both network devices believe that they’re actively sending and receiving<br />

packets (UP) and shows various options set on each device.<br />

The output on Linux is slightly different, but similar enough to easily find the<br />

same information. Linux also adds a few statistics to its ifconfig output that otherwise<br />

require a netstat to see. Especially useful are packets received and<br />

transmitted:<br />

eth0<br />

Link encap:Ethernet HWaddr 0a:5c:da:a3:53:11<br />

inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0<br />

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1<br />

RX packets:18999386 errors:28965 dropped:0 overruns:0 frame:28965<br />

TX packets:33955631 errors:0 dropped:0 overruns:0 carrier:0<br />

collisions:29132 txqueuelen:100<br />

RX bytes:1496731954 (1.3 GiB) TX bytes:2477239809 (2.3 GiB)<br />

Interrupt:10 Base address:0xda00<br />

lo<br />

Link encap:Local Loopback<br />

inet addr:127.0.0.1 Mask:255.0.0.0<br />

UP LOOPBACK RUNNING MTU:3924 Metric:1<br />

RX packets:107211318 errors:0 dropped:0 overruns:0 frame:0<br />

TX packets:107211318 errors:0 dropped:0 overruns:0 carrier:0<br />

collisions:0 txqueuelen:0<br />

RX bytes:2880669120 (2.6 GiB) TX bytes:2880669120 (2.6 GiB)<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2009 O’Reilly & Associates, Inc. All rights reserved.<br />

Chapter 46: Connectivity 939

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!