1

The popular answer to the question " How does IPv4 Subnetting Work? " does a nice job in explaining subnets.

I remember learning about the network classes back in CCNA class but that answer mentions "Classless Inter-Domain Routing" (CIDR) in the following way:

Back in the "old days", subnet masks weren't specified, but rather 
were derived by looking at certain bits of the IP address. An IP address 
starting with 0 - 127, for example, had an implied subnet mask of
255.0.0.0 (called a "class A" IP address).

These implied subnet masks aren't used today and 
I don't recommend learning about them anymore.

So my question is if I have an ip address such as 71.75.232.132, (that is my public ip address assigned to my cable modem via my ISP), how do I figue out what the subnet mask is so that I can annotate the address in the proper format with something like 71.75.232.132/32

cwd
  • 2,793
  • 10
  • 35
  • 49

3 Answers3

9

Whoever assigned you that IP address should have also told you the subnet mask, default gateway, and whatever other information you need to configure your machine. If they're using DHCP, the DHCP server will tell your computer the subnet mask. Then you don't need to know it, but you can look it up with the appropriate command for your OS if you're curious.

4

I don't think there is a way except calling your ISP/network admin to find out about it.

But you can attempt following.

An ICMP type 17 message, is a mask request. An ICMP type 18 is an ICMP mask reply. So you can use icmpush tool to build custom icmp packet and can request mask of the host. But remember not all routers and systems allow all icmp responses.

But according to this document(page no. 11).

If the Router is following RFC 1812 closely, it should not forward on an Address Mask Request to another network.

ICMP Address Mask Request aimed at a LINUX machine would not trigger an ICMP Address Mask Reply, nor a request aimed at a Microsoft Windows box.

But sending an ICMP Address Mask request aimed at a router on will receive a reply.

1

You can't imagine netmask if only IP is given to you - mask can be of any size

In dirty form, as first iteration, you can get netmask from 2 known IP (your and GW) and knowing fact, that host and default GW must reside in the same network

HTH

Lazy Badger
  • 3,157