nixCraft Poll

Topics

Ubuntu Linux view the status of my network Interfaces/card

Posted by Vivek Gite [Last updated: August 8, 2006]

Ubuntu Logo

Q. How do I view the status of my network Interface card under Ubuntu Linux ? How do I make sure connectivity exists?

A. You can verify connectivity or status of your network Interfaces/card using standard Linux command. Open your terminal and use following commands:

Ifconfig command use to view status of network Interfaces card or use to configure a network interface itself.

Task: View network interface card

$ sudo ifconfig

OR

$ sudo /sbin/ifconfig

Output:

eth0      Link encap:Ethernet  HWaddr 00:0F:EA:91:04:07
      inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
      UP 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)
      Interrupt:18 Base address:0xc000

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:14680 errors:0 dropped:0 overruns:0 frame:0
      TX packets:14680 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:7816123 (7.4 MiB)  TX bytes:7816123 (7.4 MiB)

ra0       Link encap:Ethernet  HWaddr 00:17:9A:0A:F6:44
      inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
      inet6 addr: fe80::217:9aff:fe0a:f644/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:41108 errors:0 dropped:0 overruns:0 frame:0
      TX packets:11462 errors:1 dropped:1 overruns:0 carrier:0
      collisions:285 txqueuelen:1000
      RX bytes:9787416 (9.3 MiB)  TX bytes:2871485 (2.7 MiB)
      Interrupt:17

I have total three network interface cards:

Line that starts with ‘inet addr:’ displays actual IP address of network interface.

Task: Verify connectivity

To verify the connectivity use the ping command. It send ICMP ECHO_REQUEST to network hosts:

$ ping www.yahoo.com
$ ping www.google.com
$ ping myrouter
$ ping cyberciti.biz

Output:

PING cyberciti.biz (68.142.234.44) 56(84) bytes of data.
64 bytes from p5w1.geo.re2.yahoo.com (68.142.234.44): icmp_seq=0 ttl=51 time=66.5 ms
64 bytes from p5w1.geo.re2.yahoo.com (68.142.234.44): icmp_seq=1 ttl=51 time=66.8 ms
64 bytes from p5w1.geo.re2.yahoo.com (68.142.234.44): icmp_seq=2 ttl=51 time=67.3 ms
64 bytes from p5w1.geo.re2.yahoo.com (68.142.234.44): icmp_seq=3 ttl=51 time=66.5 ms
64 bytes from p5w1.geo.re2.yahoo.com (68.142.234.44): icmp_seq=4 ttl=51 time=66.7 ms

--- cyberciti.biz ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 66.535/66.810/67.349/0.299 ms, pipe 2

If you want stop after sending 3 ECHO_REQUEST packets use -c option (useful to write a simple monitoring shell script):

$ ping -c 3 www.yahoo.com

Task: Verify that network interface device is up and running

Following command displays the list of device is up and running

$ sudo ifconfig -s

Output:

Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0   1500 0         0      0      0      0        0      0      0      0 BMU
lo    16436 0     16383      0      0      0    16383      0      0      0 LRU
ra0    1500 0     75498      0      0      0    13594      1      1      0 BMRU

If interface is down or not working it will not display much of above information.

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.