Back to course

70. Checking Network Status: `ip a` and `ip route`

Linux Basics: From Zero to CLI Hero

Identifying Interfaces and Addresses

In modern Linux systems, the ip command has replaced the older ifconfig for networking configuration and status checking.

Viewing IP Addresses (ip a)

ip a (short for ip address show) displays the addresses assigned to all network interfaces.

bash $ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ... inet 127.0.0.1/8 scope host lo 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ... inet 192.168.1.50/24 brd 192.168.1.255 scope global dynamic eth0

  • lo: The loopback interface (localhost).
  • eth0 (or enp0s3): The primary ethernet connection (interface).
  • 192.168.1.50: The IP address of your machine.
  • /24: The subnet mask.

Viewing Routing Table (ip route)

Shows how traffic leaves your system (which gateway to use).

bash $ ip route default via 192.168.1.1 dev eth0 proto dhcp 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.50

  • default via 192.168.1.1: This indicates your router's IP address (the default gateway).