Ubuntu Linux view the status of my network Interfaces/card

by nixcraft · 0 comments

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:

  • eth0 - An Ethernet network interface is a communication channel with device connected to network switch or hub. You can transfer files or use internet with eth0.
  • lo - A Lookback interface is communication channel with only one endpoint i.e. it can not be used to communicate with rest of the computer or cannot transfer files.
  • ar0 - This is my wireless communication network interface. You may see other names for your network devices, such as wlan0/ath0 etc for wireless 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.

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 0 comments… add one now }

Leave a Comment

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

Previous post:

Next post: