The person needed to determine the following given an IP/Mask of 146.141.219.47/18
- Subnet Mask
- Network Address
- First usable host address
- Last usable host address
/18 means there is an 18 bit subnet mask on that IP address. This is neither a Class C (24 bit subnet mask) or Class B (16 bits). Although, "Classes" are kind of obsolete these days. It's just an 18 bit subnet mask. Straightforward.
In binary, it looks like this (decimal underneath):
11111111 11111111 11000000 00000000
255 255 192 0
To get the network address, you take the IP Address in binary, and do a boolean AND against the subnet mask. A boolean AND will only return a 1 where both numbers have a 1, and return a 0 everywhere else.
11111111 11111111 11000000 00000000 <-- subnet mask 255.255.192.0
10010010 10001101 11011011 00101111 <-- IP Address 146.141.219.47
======== ======== ======== ========
10010010 10001101 11000000 00000000 <-- Network Address 146.141.192.0
The first usable host IP address is always the first IP after the network address, in this case, 146.141.192.1.
To get the broadcast address, you simply change all of the non-masked bits from the network address (in this case, the last 14 bits) to 1.
10010010 10001101 11111111 11111111 <-- Broadcast 146.141.255.255
You need to know the broadcast address to come up with the last usable host IP address, which is always one IP below the broadcast address. The last usable IP in the network for this example is 146.141.255.254.
hehe, reminds me of this: http://www.flickr.com/photos/bastard_admin/2290730667/
ReplyDeletegreat guide though!
Yeah, doing too many subnet calculations gave me a headache.
ReplyDeleteThere are obviously shortcut tips without using a calculator. If you have a mask >= /16 or /24 you can fudge your way through the first 2 or 3 octets without doing any math, for example.
I really don't miss my IT classes. And I'm really glad I went into Info-Sec instead of network design.