As a Linux system administrator, being able to view the IP addresses assigned to network interfaces is an essential troubleshooting skill. IP addresses act as unique identifiers on a network, enabling communication between devices. Having visibility of the IP addresses in use allows you to understand how machines are configured and identify any potential issues.
In this comprehensive guide, we will explore the various methods available for listing IP address assignments on network interfaces in Linux. Whether you use Ubuntu, Debian, CentOS, Fedora or any other distribution, the techniques shown here will apply. We will look at commands for displaying IPv4 addresses, IPv6 addresses and even scanning your local network to discover all devices present.
Listing All Assigned IP Addresses on a Linux Server
The most straightforward way to view IP address assignments is by using the ip addr command. This will display information on all network interfaces present on your system.
Here is an example showing the output from ip addr:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:8a:5c:04 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
valid_lft 85634sec preferred_lft 85634sec
inet6 fe80::a00:27ff:fe8a:5c04/64 scope link
valid_lft forever preferred_lft forever
In this output, we can see that the loopback interface (lo) has an IPv4 address of 127.0.0.1 assigned, along with IPv6 address ::1.
The next block shows the eth0 interface, with an IPv4 address of 10.0.2.15 and IPv6 address fe80::a00:27ff:fe8a:5c04.
By running ip addr, you now have visibility of all IP addresses in use on the local server.
Listing Only Assigned IPv4 Addresses
If you‘d like to view just the IPv4 addresses present, use the -4 option:
ip -4 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
valid_lft 83284sec preferred_lft 83284sec
Now only the IPv4 addresses are shown – 127.0.0.1 on lo and 10.0.2.15 on eth0. This gives you a quick view of just the IPv4 addressing in place.
Listing Only Assigned IPv6 Addresses
Similarly, you can view only IPv6 addresses by using the -6 option:
ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000 state UP qlen 1000
inet6 fe80::a00:27ff:fe8a:5c04/64 scope link
valid_lft forever preferred_lft forever
Now only the IPv6 addresses assigned are displayed – ::1 on lo and fe80::a00:27ff:fe8a:5c04 on eth0.
Using -4 and -6 with ip addr allows you to separate out IPv4 and IPv6 assignments for clearer inspection.
Scanning the Local Network for All Devices
As well as viewing the IP addresses allocated by your server, you may also want to scan the local network to discover what other devices are present. This allows you to map everything on the same broadcast domain.
To perform an ARP scan on the connected subnet, you can use a utility like arp-scan. Install it on Debian/Ubuntu with:
sudo apt install arp-scan
Or on CentOS/Fedora using:
sudo dnf install arp-scan
Once installed, use it to scan your local network:
sudo arp-scan --interface=eth0 --localnet
This will perform an ARP scan on your eth0 interface, probing for all responsive hosts.
Here is some sample output:
Interface: eth0, type: EN10MB, MAC: 08:00:27:8a:5c:04, IPv4: 10.0.2.15
Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
10.0.2.1 08:00:27:02:e3:44 (Unknown)
10.0.2.2 08:00:27:9f:5d:f3 (Unknown: Local)
10.0.2.3 08:00:27:9f:5e:c4 PCS Systemtechnik GmbH
10.0.2.10 e8:94:f6:1b:97:5d (Unknown)
8 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9.7: 256 hosts scanned in 2.915 seconds (88.00 hosts/sec). 8 responded
This shows that there are 5 other devices on the same broadcast domain with IP addresses 10.0.2.1 through 10.0.2.3 and 10.0.2.10. You now know exactly what else is connected alongside your server which can help with network troubleshooting.
The arp-scan utility is a powerful tool for understanding your local network environment. Used alongside ip addr it provides both a device-centric and network-centric view of assigned IP addresses.
Temporarily Assigning an IP Address to an Interface
As well as viewing existing IP address assignments, you may sometimes need to temporarily configure an additional address on a network interface.
This can be useful when simulating connectivity issues for troubleshooting purposes. Or when you need to add an extra IP that overlaps with another device for testing reasons.
To add a temporary dummy IP address, use ip addr add:
sudo ip addr add 10.0.2.201/24 dev eth0
This will add 10.0.2.201 as an extra secondary IP address on the eth0 interface.
You can verify it is now assigned with ip addr:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:8a:5c:04 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
valid_lft 71827sec preferred_lft 71827sec
inet 10.0.2.201/24 brd 10.0.2.255 scope global secondary eth0
valid_lft forever preferred_lft forever
Take note that the 10.0.2.201 address does not have the dynamic flag, meaning it will not expire automatically.
Once you are finished with the temporary IP, remove it using:
sudo ip addr del 10.0.2.201/24 dev eth0
Now you know how to assign and remove temporary dummy IP addresses for testing purposes.
Summary
Listing the IP addresses in use on the network interfaces of a Linux machine is a vital skill for any administrator. In this guide, we covered multiple approaches, including:
- Using
ip addrto show all assigned IP addresses - Filtering with
-4and-6to separate IPv4 and IPv6 - Scanning your local network with arp-scan to discover all connected devices
- Temporarily adding a dummy IP address for troubleshooting reasons
Take time to practice these commands on your own Linux systems so you can quickly check interface IP assignments whenever needed. Understanding the IPs in use will help you diagnose issues and gain greater networking visibility.


