Today we will see how to find different properties of LAN or Network or NIC card in Linux. As a Linux user we should know about some network properties like network card name, speed's, driver details etc. We already covered some stuff related to hardware finding tools in our ongoing "Know your hardware in Linux" series.

Get BIOS, Firmware, Hardware And Drivers Details in Linux/Unix

What is dmesg command and how to use it in Linux/Unix?

Find hardware info with lshw, hardinfo, sysinfo Linux/Unix commands

Find PCI hardware details using lspci command in Linux

Find USB device details in Linux/Unix using lsusb command

Find RAM details(size, make, speed, sa lots etc) in Linux/Unix

 

Find Optical devices(CD/DVD ROM’s) details in Linux/Unix

Find Sound card details in Linux/Unix

We are going to show you how to get different network card properties like

	Name of network cards
Network card link status
Network card speeds
Network card MAC address
Network card IP address
Network card driver details
Network card manufacture details
Network card duplex/half duplex details
Network card auto-negotiation details
Complete network card capabilities details
Complete network card hardware details

Let us start to find these details with examples so that it will be easy to understand. Note that most of the below commands should be run as root to get proper output.

Example 1: Find all your network cards(Ethernet, Gigabit Ethernet, Wireless) names attached to a given system.

	ifconfig | cut -c1-8 | sort -u

output:

	eth0
lo
virbr0
wlan0

Example 2 : find how many network connections(network cables are connected to your machine) are active i.e. link is up.

	ip link show

Output:

	
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000
link/ether 10:1f:74:58:e1:04 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT qlen 1000
link/ether d0:df:9a:e6:1d:a6 brd ff:ff:ff:ff:ff:ff
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
link/ether 52:54:00:be:79:50 brd ff:ff:ff:ff:ff:ff
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT qlen 500
link/ether 52:54:00:be:79:50 brd ff:ff:ff:ff:ff:ff

or

As a root user

	mii-tool

Output:

	eth0: no link

or for wireless network card

ethtool interfacename

Example

	root@linuxnix.com:/home/surendra# ethtool wlan0
Settings for wlan0:
Link detected: yes

Example 3: How can we find out network card speeds so that we can see throughput of the devices attached to a machine.

	ethtool eth0 | grep speed

output:

	ethtool eth0 | grep Speed
Speed: 10Mb/s

Example 4: How can we get MAC address of a given NIC card?

	ethtool -P devicename

Example:

	ethtool -P eth0

Output:

	Permanent address: 10:1f:74:58:e1:04

Example 5: Find IP address assigned to an interface and all interfaces in Linux.

	ifconfig interfacename

Example

	ifconfig wlan0

Output:

	wlan0 Link encap:Ethernet HWaddr d0:df:9a:e6:1d:a6
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::d2df:9aff:fee6:1da6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:314270 errors:0 dropped:0 overruns:0 frame:0
TX packets:382181 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:99368108 (99.3 MB) TX bytes:177093425 (177.0 MB)

For all the interfaces in a given machine

	ifconfig

Output:

	eth0 Link encap:Ethernet HWaddr 10:1f:74:58:e1:04
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)
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:7595 errors:0 dropped:0 overruns:0 frame:0
TX packets:7595 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:688876 (688.8 KB) TX bytes:688876 (688.8 KB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:be:79:50
inet addr:192.168.100.1 Bcast:192.168.100.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:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:654 (654.0 B)
wlan0 Link encap:Ethernet HWaddr d0:df:9a:e6:1d:a6
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::d2df:9aff:fee6:1da6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:314270 errors:0 dropped:0 overruns:0 frame:0
TX packets:382181 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:99368108 (99.3 MB) TX bytes:177093425 (177.0 MB)

Example 6: How can we find network cared driver details in Linux?

	ethtool -i wlan0

Output:

	root@linuxnix.com:/# ethtool -i wlan0
driver: ath9k
version: 3.5.0-25-generic
firmware-version: N/A
bus-info: 0000:02:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
root@linuxnix.com:/# ethtool -i eth0
driver: r8169
version: 2.3LK-NAPI
firmware-version: rtl_nic/rtl8168e-2.fw
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no

Example 7: How can we find network card manufacture details for both Ethernet card and wireless cards

lspci -v | grep -iE 'Wire|Ether'

Output:

01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)
02:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)

Example 8: How can we get NIC card mode details like full/half duplex

	ethtool eth0 | grep Duplex

Output:

	Duplex: Half

Example 9: How about finding my network card is auto negotiation enabled or not in Linux?

	ethtool eth0 | grep Auto

Output:

	Auto-negotiation: on

Example 10: Find complete network card software details like speed, modes, negotiations, link status etc.

	root@linuxnix.com:/home/surendra# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Speed: 10Mb/s
Duplex: Half
Port: MII
PHYAD: 0
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000033 (51)
drv probe ifdown ifup
Link detected: no

 

Example 11: Find complete network card hardware details.

	lshw -class network

Output:

	
*-network
description: Ethernet interface
product: RTL8111/8168 PCI Express Gigabit Ethernet controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:01:00.0
logical name: eth0
version: 06
serial: 10:1f:74:58:e1:04
size: 10Mbit/s
capacity: 1Gbit/s
width: 64 bit's
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl_nic/rtl8168e-2.fw latency=0 link=no multicast=yes port=MII speed=10Mbit/s
resources: irq:41 ioport:3000(size=256) memory:c0404000-c0404fff memory:c0400000-c0403fff
*-network
description: Wireless interface
product: AR9285 Wireless Network Adapter (PCI-Express)
vendor: Atheros Communications Inc.
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlan0
version: 01
serial: d0:df:9a:e6:1d:a6
width: 64 bit's
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ath9k driverversion=3.5.0-25-generic firmware=N/A ip=192.168.1.2 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
resources: irq:18 memory:c2500000-c250ffff
*-network DISABLED
description: Ethernet interface
physical id: 1
logical name: virbr0-nic
serial: 52:54:00:be:79:50
size: 10Mbit/s
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=tun driverversion=1.6 duplex=full link=no multicast=yes port=twisted pair speed=10Mbit/s

In our next post we will see how to get different details about hard-disks in Linux.

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.