Find the IP Addresses of the Available Network Interfaces of your Linux System

Shahriar Shovon

Supported OS

  • All

Categories

Share this post with your friends

To find the ip addresses of the available network interfaces on Linux, use the following command, sudo ip addr show 1: lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:45:4e:87 brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3 valid_lft 86403sec preferred_lft 86403sec inet6 fe80::a00:27ff:fe45:4e87/64 scope link valid_lft forever preferred_lft forever 3: virbr0: mtu 1500 qdisc noqueue state DOWN link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 valid_lft forever preferred_lft forever 4: virbr0-nic: mtu 1500 qdisc pfifo_fast state DOWN qlen 500 link/ether 52:54:00:bb:2e:64 brd ff:ff:ff:ff:ff:ff You can see that, the result shows the network interfaces with numbers 1, 2, 3, 4 and so on. I have 4 network interfaces on my Linux system. You can see lines that start with inet and inet6. These lines represent ipv4 and ipv6 addresses respectively. The first network interface which is a loopback interface has an ipv4 address of 127.0.0.1 and ipv6 address of ::1 The second network interface has an ipv4 address of 10.0.2.15 and ipv6 address of fe80::a00:27ff:fe45:4e87 The third network interface 192.168.122.1. It doesn't have an ipv6 address set. The fourth network interface virbr0-nic doesn't have any ip address set at the moment.