The Usage and Analysis of Ifconfig

What is ifconfig?

ifconfig is a system management tool to configure, control and query tcp/ip network interface in command-line interface of unix-like system.

The Analysis of Ifconfig Output

In the terminal of my ubuntu system, after inputting the Ifconfig command, I got the below information. Now I am going to analyse them.

ens33 Link encap:Ethernet HWaddr 00:0c:29:e8:60:d4
inet addr:192.168.156.129 Bcast:192.168.156.255 Mask:255.255.255.0
inet6 addr: fe80::975d:c475:7276:38c4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:70 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2262 (2.2 KB) TX bytes:8089 (8.0 KB)
Interrupt:19 Base address:0x2000

  1. Link encap. This is the type of network.
  2. HWaddr. This is the mac address.
  3. Inet addr. This is the IP address.
  4. Bcast: This is the broadcast address.
  5. Mask: This is the mask address.
  6. Inet6 addr: This is IPV6 address.
  7. Scope: There are four valid options.
    1. global. Valid everywhere.
    2. site. Valid only within this site (IPv6).
    3. link. Valid only on this device.
    4. host. Valid only inside this host (machine).
  8. UP: NIC is enabled.
  9. BROADCAST: Broadcast is supported.
  10. RUNNING: The network cable is connected.
  11. MULTICAST: Multicast is supported.
  12. MTU: Maximum Transmission Unit.
  13. Metric: Metric value in its routing table to decide the priority.
  14. RX: Receive packets situation. Packets, errors, dropped are easy to understand. they are literally mean. Overruns is a number of received packets that that experienced fifo overruns,  caused by rate at which a buffer gets full and kernel isn’t able to empty it. frame is a number of misaligned frames, i.e. frames with length not divisible by 8.
  15. TX: Tx is total number of packets transmitted. carrier is a number of packets that experienced loss of carriers. This usually happens when link is flapping.
  16. collisions: collisions is a number of transmitted packets that experienced Ethernet collisions.
  17. txqueuelen: txqueuelen is length of transmission queue.
  18. RX bytes/ TX bytes: literally mean, easy to understand.
  19. Interrupt: The data shows which device cause the interrupt. You can use this “cat /proc/interrupts” command to review the means of this number.

The Usage of Ifconfig

The options of ifconfig

No1. -a: Display information for all network interfaces, even if they are down.

No2. -s: Display a short list in a format identical to the command “netstat-i”. Please refer to figure 1.

Figure 1

No3. -v: Verbose mode; display additional information for certain error conditions.

No4. interface: In my system, “ens33” is a interface. we can use “ifconfig ens33” to view the information.

No5. up: Using “ifconfig eth0 up” to activate the network interface eth0.

No6. down: Using “ifconfig eth0 down” to deactivate the network interface eth0.

No7. []arp: Using “ifconfig eth0 arp” to enable the arp protocol of eth0. Using “ifconfig eth0 -arp” to disable the arp protocol of eth0.

No8. []promisc. Using “sudo ifconfig eth0 promisc” to be Promiscuous mode. Promiscuous mode is a network card setting that does not filter incoming  packets by MAC, but rather receives and accepts all incoming network data. Using ” sudo ifconfig eth0 -promisc” to disable Promiscuous mode.

No9. []allmulti. Enable or disable all-multicast mode. If multicast mode is enabled, all multicast packets on the network will be received by the interface. Usage: “ifconfig eth0 allmulti“, “ifconfig eth0 -allmulti“.

No10. metric N. This parameter sets the interface metric, which is used by the interface to make routing decisions. The smaller the number, the higher the priority. Usage: “ifconfig eth0 metric N“.

No11. mtu N. Usage “ifconfig eth0 mtu N“.

No12. address. set static IP. Usage “ifconfig eth0 192.168.1.25

No13. netmask address. set netmask. Usage ”ifconfig eth0 netmask 255.255.255.0

No14. []broadcast [address]. Usage “ifconfig eth0 broadcast “192.168.1.255“.

No15. add address/prefixlen. Add an IPv6 address to an interface. Usage: “ifconfig eth0 add 12ffe:3240:800:1005::2/64

No16. del address/prefixlen. Remove an IPv6 address from an interface. Usage: ” ifconfig eth0 del 12ffe:3240:800:1005::2/64

No17. tunnelaa.bb.cc.dd. Create a new SIT (IPv6-in-IPv4) device, tunnelling to the given destination.

No18. irqaddress. Set the interrupt line used by this device. Not all devices can dynamically change their IRQ setting.

No19. io_addraddress. Set the start address in I/O space for this device.

No20. mem_startaddress. Set the start address for shared memory used by this device. Only a few devices need this.

No21. mediatype. Set the physical port or medium type to be used by the device. 

No22. []pointopoint [address].

No23. hw classaddress. Set the hardware address of this interface, if the device driver supports this operation. The keyword must be followed by the name of the hardware class and the printable ASCII equivalent of the hardware address. Hardware classes currently supported include ether(Ethernet), ax25 (AMPR AX.25), ARCnet and netrom (AMPR NET/ROM). Usage: “ifconfig eth0 hw ether 00:0c:19:a8:30:d5” to change the mac address.

No24. multicast. Set the multicast flag on the interface. This should not normally be needed as the drivers set the flag correctly themselves.

No25. txqueuelenlength. Usage “ifconfig eth0 txqueuelen N“.

Have fun and Thank you!

Reference:

  1. http://www.aboutlinux.info/2006/11/ifconfig-dissected-and-demystified.html
  2. https://goinbigdata.com/demystifying-ifconfig-and-network-interfaces-in-linux/
  3. codebar.io

Share this article to your social media
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments