How many instances have you ever tried to arrange a static IP tackle for a machine in your community, solely to appreciate that you simply had no concept which addresses had been already occupied? If you’re employed with a desktop pc, you’ll be able to all the time set up a community protocol analyzer to search out out which addresses had been in use. But what in the event you’re on a server with no GUI? You definitely will not be counting on a graphical software to scan IP addresses. Fortunately, some quite simple to make use of command line instruments can deal with this job.
I’ll present you learn how to scan your native space community (LAN) for IP addresses in use with two completely different instruments (one among which will probably be put in in your server by default). I’ll display this on Ubuntu Server.
SEE: Top instructions Linux directors must know (TechRepublic Premium)
The arp command
The first software we are going to use for this exercise is the built-in harp command. Most IT directors are acquainted with harpas it’s used on virtually all platforms. If you’ve got by no means used it harp (which stands for Address Resolution Protocol), the command is used to govern (or view) the kernel’s IPv4 community neighbor cache. If you emit harp with out mode specifier or choices, it can print the present contents of the ARP desk. That’s not what we’ll do. Instead, we are going to subject the command like this:
arp -a
The -a choice makes use of different BSD-style output and prints all recognized IP addresses discovered in your LAN. The output of the command will show the IP addresses and related Ethernet gadget.
You now have a listing of every IP tackle in use in your LAN. The solely caveat is that (until you recognize the MAC tackle of each gadget in your community), you will not have any concept which machine the IP addresses are assigned to. Even with out realizing which machine is related to which tackle, a minimum of you recognize which addresses are getting used.
NB. THE harp the command works just for IPv4. If you’ve got IPv6, you have to to make use of the command ndp (which stands for Neighbor Discovery Protocol):
ndp -a
It’s straightforward to inform in the event you’re utilizing IPv4 or IPv6 addresses. The former use intervals, the latter use colons. IBM presents a explainer on the subject if you’d like extra particulars.
SEE: How so as to add an SSH fingerprint to your aware_hosts file in Linux (TechRepublic)
Nmap
Next, we use a command that gives extra choices. Said command is nmap (which stands for Network Mapper). You won’t discover nmap put in in your Linux machine by default, so we have to add it to the system. Open a terminal window (or log in to your server with no GUI) and subject the command:
sudo apt-get set up nmap -y
Once the set up is full, you might be able to scan your LAN nmap. To discover out which addresses are in use, run the command:
nmap -sP 192.168.1.0/24
Note: You might want to change the IP tackle scheme to match yours.
The output of the command will present you each tackle discovered in your LAN.

We do nmap extra helpful. Since it presents a bit extra flexibility, we will additionally discover out which working system is related to an IP tackle. To do that, we are going to use the -sT (TCP connection scan) and -O (OS detection) choices. The command for that is:
sudo nmap -sT -O 192.168.1.0/24
Depending on the scale of your community, this command could take a while. And in case your community is massive, think about sending the command output to a file like this:
sudo nmap -sT -O 192.168.1.0/24 > nmap_output
You can then view the file with a textual content editor to search out out which working system is linked to which IP tackle.

With the assistance of those two easy instructions, you’ll be able to find the IP addresses in use in your community. Now, once you assign a static IP tackle, you will not unintentionally assign one which’s already in use. We all know what sort of complications it could trigger.