Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

The popular answer to the question " How does 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

share|improve this question
    
If you downvote please explain why –  cwd Nov 23 '11 at 12:53

3 Answers 3

up vote 9 down vote accepted

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.

share|improve this answer
    
This is true, but in a hosting environment it could be that you're only given the ip address and told "just route out anything on your ethernet interface". This works, but it's better to have a default route anyway, since otherwise the arp table could fill up - your hosts thinks everybody is on this ethernet segment. –  AndreasM Nov 23 '11 at 6:31
2  
I have never had that happen (since CIDR), and I've been in the networking business on almost every possible end since CIDR took over. I have always given, or been given, a complete IP configuration sheet. Everyone who has been in this business for more than a month knows you just give them all the information they could possibly need and then they don't have to go back and forth with you. –  David Schwartz Nov 23 '11 at 6:43
    
I had it happen to me, with one of the largest hosters in Germany. –  AndreasM Nov 23 '11 at 7:14
1  
In that case, you go back and tell them you need the rest of the information. You're the customer, after all. –  RobM Nov 23 '11 at 9:41
1  
For shared hosting only IP of server play game, but it's from different area, unrelated to topic –  Lazy Badger Nov 23 '11 at 11:30

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.

share|improve this answer
    
Thx for idea of ICMP-magic –  Lazy Badger Nov 23 '11 at 10:15

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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