How to get IP of all hosts in LAN?

Viewed 65779

I need to list IP addresses of all connected hosts in my LAN. What is the simplest way to do this?

8 Answers

Nazim was correct. And krowe2's reply is factually incorrect. Switches absolutely forward broadcast traffic. You can send a ping to the subnet's broadcast address under the following conditions.

1.a) You are on the same subnet.

1.b) the gateway allows for IP direct broadcast

2.a) The subnet is not part of a fabric network.

2.b) If the subnet is part of a fabric, broadcast traffic is allowed on the subnet.

In about 80% of networks (and about 99.99% of networks using 192.168.1.1 as a gateway) this will work. I'm a network engineer and I do this all the time. You CAN NOT rely on ICMP (ping) responses to validate the existence of a device on a network. The problem is that no device is required to listen to any traffic. Not ping, not SNMP, not NetBios. The only real way to be sure is to look at the ARP table.

You have to send out any kind of traffic to every IP in the subnet and look at your own ARP table. Because no device can get any traffic until resolve the MAC address of the IP on the local subnet. So before a device decides if it's going to listen to traffic or not, it has to respond to an ARP request. Your device then caches this in it's ARP table and can send frames with the right destination MAC to the other device. On a Windows PC, the command line command is 'arp -a'. Linux is 'arp -n' if I recall correctly.

Ping to the global broadcast ip address (192.168.1.255)

Normally we will get the reply from all the host connected to the LAN.. Or if you have any particular network for the lan, ping to that networks broadcast id (i.e the last ip address in that range ).

Then you can know all the ip address connected to the host in lan.

Related