What number of occasions have you ever tried to configure a static IP tackle for a machine in your community, solely to understand you had no thought what addresses have been already taken? In the event you occur to work with a desktop machine, you could possibly all the time set up a community protocol analyzer to search out out what addresses have been in use. However what should you’re on a GUI-less server? You actually gained’t depend on a graphical-based software for scanning IP addresses. Thankfully, some very simple-to-use command line instruments can deal with this job.
I’m going to point out you the right way to scan your Native Space Community (LAN) for IP addresses in use with two completely different instruments (considered one of which shall be put in in your server by default). I’ll reveal on Ubuntu Server.
SEE: Prime Instructions Linux Admins Have to Know (TechRepublic Premium)
The arp command
The primary software we’ll use for the duty is the built-in arp command. Most IT admins are acquainted with arp, as it’s used on virtually each platform. In the event you’ve by no means used arp (which stands for Deal with Decision Protocol), the command is used to control (or show) the kernel’s IPv4 community neighbor cache. In the event you difficulty arp with no mode specifier or choices, it would print out the present content material of the ARP desk. That’s not what we’re going to do. As an alternative, we’ll difficulty the command like so:
arp -a
The -a choice makes use of an alternate BSD-style output and prints all identified IP addresses discovered in your LAN. The output of the command will show IP addresses in addition to the related ethernet machine.
You now have an inventory of every IP tackle in use in your LAN. The one caveat, is that (until you realize the MAC tackle of each machine in your community), you gained’t have a clue as to which machine the IP addresses are assigned. Even with out realizing what machine is related to what tackle, you at the very least know what addresses are getting used.
NB. The arp command solely works for IPv4. When you’ve got IPv6, you’ll want to make use of the command ndp (which stands for Neighbor Discovery Protocol):
ndp -a
It’s straightforward to inform should you’re utilizing IPv4 or IPv6 addresses. The previous use durations, the latter use colons. IBM gives an explainer on the topic if you need extra particulars.
SEE: Easy methods to Add an SSH Fingerprint to Your known_hosts File in Linux (TechRepublic)
Nmap
Subsequent, we use a command that provides extra choices. Mentioned command is nmap (which stands for Community Mapper). You gained’t discover nmap put in in your Linux machine by default, so we should add it to the system. Open a terminal window (or log into your GUI-less server) and difficulty the command:
sudo apt-get set up nmap -y
As soon as the set up is accomplished, you’re able to scan your LAN with nmap. To seek out out what addresses are in use, difficulty the command:
nmap -sP 192.168.1.0/24
Notice: You have to to change the IP tackle scheme to match yours.
The output of the command, will present you every tackle discovered in your LAN.

Let’s make nmap extra helpful. As a result of it gives a bit extra flexibility, we will additionally uncover what working system is related to an IP tackle. To do that, we’ll use the choices -sT (TCP join scan) and -O (working system discovery). The command for that is:
sudo nmap -sT -O 192.168.1.0/24
Relying on the dimensions of your community, this command can take a while. And in case your community is giant, take into account sending the output of the command to a file like this:
sudo nmap -sT -O 192.168.1.0/24 > nmap_output
You may then view the file with a textual content editor to search out out what working system is hooked up to an IP tackle.

With the assistance of those two easy instructions, you’ll be able to find IP addresses in your community which can be in use. Now, while you’re assigning a static IP tackle, you gained’t by accident assign one already in use. Everyone knows what sort of complications that may trigger.