Everything to check information about the hardware by commands your linux system, the following commands will get network inteface, which IP address configured to specific interface (like, eth0, eth1 and etc...).
ipconfig
This command used to configure network interface, if you run the command without arguments show the status of the currently active interfaces.
-a argument is given displays the status of all interfaces even shows down the interface.
# ifconfig
# ifconfig -a
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:A9:23:19:AA:AB
inet addr:192.168.0.210 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::219:21ff:fe29:abb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:28378 errors:0 dropped:0 overruns:0 frame:0
TX packets:23062 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:18844580 (17.9 MiB) TX bytes:2919482 (2.7 MiB)
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:65536 Metric:1
RX packets:2440 errors:0 dropped:0 overruns:0 frame:0
TX packets:2440 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:459932 (449.1 KiB) TX bytes:459932 (449.1 KiB)
ip command:
IP Command is used to show / manupulate routing, devices, policy routing and tunnels for networks, the following commands shows details.
# ip route show
192.168.0.0/24 dev eth0 proto kernel scope link src 172.17.42.1
169.254.0.0/16 dev eth0 scope link metric 1002
default via 192.168.0.1 dev eth0
To dispalys only active ethernet interface
# ip link show | grep 'state UP'
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
The below command help you find Device Name only,
# ip link show | grep 'state UP' | awk '{print $2}' | cut -d ':' -f1
eth0
netstat command:
Previously have been discussed about netstat command, below command show with kernel interface table format,
# netstat -i
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 336634 0 0 0 119985 0 0 0 BMRU
lo 65536 0 7536 0 0 0 7536 0 0 0 LRU
Enable / Disable Network Interface :
By default the network interface detected on your system if you are trying to configure manually enabled it ifup command and to disable ifdown command will help you. Assume that if you have configure eth1 enterface execute below command enable it.
# ifup eth1
Disable interface,
# ifdown eth1
Comments (0)