Enhancing Skills

ifconfig: Display network interfaces configurations

Command: ifconfig

Used to display or configure network interface parameters. It provides details about network interfaces, including IP addresses, MAC addresses, and network statistics.


Sample Command and Output:

$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe0a:8c0a  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:0a:8c:0a  txqueuelen 1000  (Ethernet)
        RX packets 1234  bytes 567890 (567.8 KB)
        TX packets 567  bytes 123456 (123.5 KB)
        interrupt 20

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 123  bytes 4567 (4.5 KB)
        TX packets 123  bytes 4567 (4.5 KB)

Description:

  • ifconfig: Displays information about all active network interfaces. The output includes:
  • Interface Name: (e.g., eth0, lo)
  • Flags: Indicates the status and capabilities of the interface (e.g., UP, BROADCAST).
  • IP Address: The assigned IP address (e.g., 192.168.1.10).
  • Netmask: Subnet mask (e.g., 255.255.255.0).
  • MAC Address: Physical address (e.g., 08:00:27:0a:8c:0a).
  • RX/TX Packets: Number of received and transmitted packets.
  • Interrupt: IRQ number used by the interface.

Additional Usage Examples:

  • ifconfig eth0: Display information only for the eth0 interface. Sample Command and Output:
  $ ifconfig eth0
  eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
          inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
          inet6 fe80::a00:27ff:fe0a:8c0a  prefixlen 64  scopeid 0x20<link>
          ether 08:00:27:0a:8c:0a  txqueuelen 1000  (Ethernet)
          RX packets 1234  bytes 567890 (567.8 KB)
          TX packets 567  bytes 123456 (123.5 KB)
          interrupt 20
  • ifconfig -a: Display information about all interfaces, including inactive ones. Sample Command and Output:
  $ ifconfig -a
  eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
          inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
          ...
  lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
          inet 127.0.0.1  netmask 255.0.0.0
          ...

Note: ifconfig is deprecated on some Linux distributions in favor of ip command. Use ip addr for similar functionality:

Command: ip addr

Sample Command and Output:

$ ip addr

Description:

  • ip addr: Provides detailed information about network interfaces, including IP addresses and additional details.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.