1

If I have a client who wishes to send a UDP packet to another client, how would I scan for his IP address if Client 2 is located in another subnet?

If I'm trying to discover clients on my own subnet I can use ARP. However, gateways don't broadcast ARP requests outside the subnet. Could this be done with broadcast or multicast?

1
  • Would you want just anyone to do device discovery on your network?
    – Ron Maupin
    Jun 2, 2022 at 17:50

3 Answers 3

1

Presumably, if you want to send data to another device, you know something about that device: its name or address. If you only know the name, performing a DNS lookup will give you the address.

1

If I have a client who wishes to send a UDP packet to another client, how would I scan for his IP address if Client 2 is located in another subnet?

There's no defined way to discover nodes on other subnets. You could just poke around, relying on the end-hop router's Destination host unreachable ICMP messages for absent hosts.

However, gateways don't broadcast ARP requests outside the subnet. Could this be done with broadcast or multicast?

No. Neither broadcasts nor multicasts cross routers (by default - specific types might be forwarded, depending on router configurations, those wouldn't help you though).

The MAC address of a remote host (if it even exists) is irrelevant for you in any case. It's only used by the last-hop router, if required.

A common way to solve that problem is to use (dynamic) DNS host names and let those point to the required host IP addresses.

0

In networks using standard IPv4 addressing it is possible. You would have to know the network address of the other subnet. Once you have that, ping every possible host IP address on that network. Existing hosts will reply. You should be able to script something like this in Python or MS Powershell for example.

4
  • 2
    Doesn’t work so well on IPv6
    – Ron Trunk
    Jun 3, 2022 at 10:00
  • Even at 1,000,000 addresses per second, trying to scan the 18,446,744,073,709,551,616 addresses in a standard /64 IPv6 network will take over 584,542 years!
    – Ron Maupin
    Jun 8, 2022 at 16:49
  • Existing hosts will reply. - While pinging each possible host address might have worked 20 years ago, ICMP echo is often filtered by default today.
    – Zac67
    Jun 8, 2022 at 18:54
  • @Zac67 One way to spot INEXPERIENCED secure network design is to look for networks that completely block Internet Control Message Protocol (ICMP) traffic. As any operator of all but the smallest networks will tell you, troubleshooting a network without ping is very frustrating, bordering on impossible. -Cisco Press Jun 9, 2022 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.