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

We just signed up with a new ISP and we got a static IP from them.

Our previous ISP just gave one IP and we were able to configure our web server using that. Now, we have got this new IP with a slash notation. This type is new to me. When I used the CIDR calculator, it gave me the following results:

    202.184.7.52/30
    IP: 202.184.7.52
    Netmask: 255.255.255.252
    Number of hosts: 2
    Network address: 202.184.7.52
    Broadcast address: 202.184.7.55

Can someone please help me by explaining what these are? I could not understand what the number of hosts means. Is that telling that I can use two different IP for DNS (A) records? Also, which one should I setup in my router? The network address or broadcast address?

Thank you very much for any answer you may provide.

share|improve this question

migrated from stackoverflow.com Oct 14 '09 at 12:05

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 12 down vote accepted

The /30 means all but two of the 32 bits are used to define the netmask. It also means you've got four IP addresses to play with. (But in reality, only two of which can be hosts)

Your last octet of the netmask is (in binary) 11111100, which leaves the last two bits for you to define your network. (hence the four addresses)

Just looking at the last two bits:

00 = 202.184.7.52 - I've forgotten why, but there's a reason you don't use 00.
                    My network theory is rusty.
01 = 202.184.7.53 - Host 1
10 = 202.184.7.54 - Host 2
11 = 202.184.7.55 - which is your broadcast address - sending to this should 
                    broadcast to all your hosts. Good for things like wakeOnLan 
                    packets.

Clear as mud I'm sure.. but hope that adds a little to your understanding

share|improve this answer
2  
As far as I remember there's nothing in the specs that stops your from using .52 (or the all-0 host address) as a host address. It's just problematic because that address is usually used to refer to the network as a whole and using it for a host as well would lead to confusion. But then again, my network theory is rusty as well. –  Joachim Sauer Oct 14 '09 at 11:50
    
Thank you! That clarified what I wanted to know. Appreciate your help. –  Nirmal Oct 14 '09 at 13:03
1  
I think it depends on how the "upstream" network is set up. In some cases you can use all 4 as IP addresses, but if set up as a "true" vlan, you can not use the network and broadcast IP addresses. (My network theory is a bit rusty as well!) –  Dave Drager Oct 14 '09 at 13:50
1  
That's right - you can actually use that subnet by assigning 4 IPs as /32s on your web server: 202.184.7.52/32, 202.184.7.53/32, 202.184.7.54/32, 202.184.7.55/32. –  MikeyB Oct 14 '09 at 16:08
1  
I actually had this question come up in a discussion a few years ago. Despite the people involved having over 60 years (combined) at an organization that has its own /16 (yes, that's a full Class B, 65,536 IPv4 addresses), nobody could come up with a better answer than "that's the convention. The first address is used as the network name". My own understanding is that it dates back to classful routing, when the network address actually determined the route to a given network. –  Jason Antman Oct 14 '09 at 17:34

/20 means use the first 20 bits as a netmask. It's usually expressed where the bits outside the netmask are 0 so 206.89/16 is roughly 64K addresses all starting with 203.89. The netmask is 0xFFFF0000.

So 202.184.7.52/30 means:

    Network: 202.184.7.52
    Netmask: 0xFF FF FF FC

The last 2 bits are used for hosts within that subnet. See IP Routing on Subnets.

share|improve this answer
    
Thank you for the answer! Learnt something new. –  Nirmal Oct 14 '09 at 13:03

From 202.184.7.52/30 the ip is:202.184.7.52

Let us find the Netmask. /30 means 30 "1" s, 8 in the first octet, 8 in the 2nd, 8 in the 3rd and only 6 in the 4th.

We use the last octet only because we know eight '1's =255

128 64 32 16 8 4 2 1
 1   1  1  1 1 1 0 0 means we have six '1's
We add them to give 128=64=32=16=8=4=252

so Netmask becomes: 255.255.255.252

The number of hosts= 2^N -2 =2^2 -2 =2 ( since No of Zeroes in last octet is 2, so N=2)

Finding the network address:

202. 184. 7. 52 AND
255. 255.255.252

128 64 32 16 8 4 2 1
0   0  1  1  0 1 0 0 =52
1   1  1  1  1 1 0 0 =252 ANding

0   0  1  1  0 1 0 0

Replace the last two zeroes by 1

0   0  1  1  0 1 1 1 =55 to give the broadcast address
202.184.7.55
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.