How many times have you tried to configure a static IP address for a car on your network, only to realize you had no idea what addresses were already taken? If you happen to work with a desktop automobile, you could always install a tool similar Wireshark to notice out what addresses were in use. But what if you're on a GUI-less server? You certainly won't rely on a graphical-based tool for scanning IP addresses. Fortunately, at that place are some very simple-to-employ command line tools that can handle this task.

I'm going to show y'all how to scan your Local Area Network (LAN) for IP addresses in utilize with two different tools (1 of which volition exist installed on your server past default). I'll demonstrate on Ubuntu Server 18.04.

Let'south get started.

Encounter: Server deployment/migration checklist (Tech Pro Inquiry)

The arp command

The first tool we'll use for the job is the built-in arp command. Most It admins are familiar with arp, every bit it is used on almost every platform. If yous've never used arp (which stands for Address Resolution Protocol), the command is used to dispense (or display) the kernel's IPv4 network neighbor cache. If you issue arp with no mode specifier or options, it will impress out the electric current content of the ARP table. That's non what we're going to do. Instead, we'll issue the command like and so:

arp -a

The -a option uses and alternate BSD-style output and prints all known IP addresses plant on your LAN. The output of the command will display IP addresses as well as the associated ethernet device (Effigy A).

Figure A

You at present have a listing of each IP address in apply on your LAN. The only caveat, is that (unless yous know the MAC address of every device on your network), you won't accept a clue as to which machine the IP addresses are assigned. Even without knowing what machine is associated with what address you at least know what addresses are being used.

Nmap

Next, we use a control that offers more than options. Said control is nmap. You won't find nmap installed on your Linux automobile past default, and then nosotros must add it to the organization. Open up a terminal window (or log into your GUI-less server) and issue the command:

sudo apt-get install nmap -y

Once the installation completes, you are ready to scan your LAN with nmap. To observe out what addresses are in use, result the command:

nmap -sP 192.168.i.0/24

Note: You will need to alter the IP address scheme to friction match yours.

The output of the control (Effigy B), will show you each accost establish on your LAN.

Figure B

Permit's make nmap more useful. Considering information technology offers a bit more flexibility, nosotros can also observe what operating system is associated with an IP address. To do this, we'll use the options -sT (TCP connect browse) and -O (operating arrangement discovery). The command for this is:

sudo nmap -sT -O 192.168.1.0/24

Depending on the size of your network, this control can have some fourth dimension. And if your network is large, consider sending the output of the command to a file like so:

sudo nmap -sT -O 192.168.one.0/24 > nmap_output

You tin can then view the file with a text editor to discover out what operating system is fastened to an IP address (Effigy C).

Effigy C

With the assist of these two simple commands, you can locate IP addresses on your network that are in utilise. Now, when yous're assigning a static IP accost, you won't accidentally assign one already in use. Nosotros all know what kind of headaches that tin cause.