• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

Find the subnet of the IP address

Hello guys,
I have a list of IP addresses of some internet machines and I need to find their subnets i.e. xxx.xxx.xxx.xxx/19. Most of the times, i don't have authorization to run anything on these web-servers. Any way I can do that (either remotely or locally) programmaticaly?

1 Solution
> Any way I can do that (.. remotely ..)
no (except you have access via telnet, rsh, ssh)

> ..locally
ifconfig -a
The subnet mask is NOT carried along with the packet. There is absolutely no way to know, and no reason to know, what the subnet mask is for the network from which the packet came, if that packet came from anywhere that is not local to you.
You can do this remotely by using traceroute, but it's not a pleasant thing to do.

If you run traceroute to the machines IP addresses, and then traceroute to the IP addresses around that of the machine (i.e. for a.b.c.d run traceroute to a.b.c.0 to a.b.c.254) and look for a change in route.

Different subnets USUALLY have seperate routers, therefore that last couple of hops should be different if you traceroute to a machine on a different subnet.

Once you know the IP addresses with the same route as the machines IP address, and the IP addresses with different routes, you can deduce the netmask because you know the IPs on the same network.
odyspapaAuthor Commented:
Very original! A bit expensive, but it works (usually). Thanks alsutton

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now