通过独立广告联盟赚钱

吖十的道理™:: The 10 Network ::

2008年4月13日星期日

IP Addressing/Subnetting : Chapter 2

Further to the previous post ( IP Address/Subnetting : Chapter 1 ), before I go into the topic, let's me get some FAQs.

Q: What is Network ID?

A: Network ID is an "identifier" of a network when you are trying to tell others what network/subnet are you ( sounds profesionally?! ) rather than telling the whole story, IP address, subnet....blahhhh...

Q: What is broadcast IP ?

A: Broadcast IP is normally the "last" IP of a subnet addresses. For example, 192.168.1.255 is the broadcast IP for default Class C ( 255.255.255.0 ) 192.168.1.x network. If a packet is addressed to the broadcast IP, then it will be targeted to EVERY stations in this particular network. That's why it's called broadcast IP.

Q: Why should I know IP addressing/subnetting ?

A: It is very important someday when you need to design and implement a network, you may need to know how to consider the appropiate subnet mask to be used and numbers of hosts you may have when a subnet mask is used. In addition, it is also very important and useful when you do the network routing and NAT-ing as well as firewall ruling.

Q: How many hosts in a Default Class C ( 255.255.255.0 ) network ?

A: A Class C network have 254 hosts. It can be simply calculated using a formula by considering the subnet mask and number of binary bits.

Default Class C would have binary of

1111 1111. 1111 1111. 1111 1111. 0000 0000 = 255.255.255.0

We can just consider the number of 0s in the subnet mask ( It is known as UNMASKED BITS or SUBNET BITS ) and convert it to 1s which are 0000 0000 = 1111 1111, by refering to the chart below :

IP03

The SUM of unmasked bits

( 1111 1111 )

= 128 + 64 + 32 + 16 + 8 + 4 + 2 +1

= 255

Because of the first number of an octet is started from 0 instead 1, therefore the total available IP address would be :

= ( SUM of Unmasked bits ) + 1

= 255 + 1 = 256 IP Addresses

By using the formula Total Available IPs minus 2, the result will be the total number of hosts in default Class C network :

= 256 - 2 = 254 hosts.

EXAMPLE 1

Network ID : 10.10.10.0 / Subnet Mask : 255.255.255.192

1111 1111. 1111 1111. 1111 1111. 1100 0000 = 255.255.255.192

Total Available IPs = ( 32 + 16 + 8 + 4 + 2 + 1 ) + 1 = 64

Thus, the total number of hosts = 64 -2 = 62 hosts

For Network ID : 10.10.10.0 ,

Thus, the broadcast IP = x.x.x.0 + 64 IPs = x.x.x.64 = 10.10.10.63

EXAMPLE 2

Network : 10.133.80.32 / Subnet Mask : 255.255.255.224

1111 1111. 1111 1111. 1111 1111. 1110 0000 = 255.255.255.224

Total Available IPs = ( 16 + 8 + 4 + 2 + 1 ) + 1 = 32

Thus, the total number of hosts = 32 -2 = 30 hosts

For Network ID : 10.133.80.32 ,

Thus, the broadcast IP = x.x.x.32 + 32 IPs = x.x.x.64 = 10.133.80.63

Anyway, besides using the standard formula above ( which you may need to know but not neccessary to remember it :p ) There is another CHEAT FORMULA as below :

Referring to Example 1 again :

Network ID : 10.10.10.0 / Subnet Mask : 255.255.255.192

Then use the formula :

Total IP available = 256 - last subnet mask portion

= 256 - 192 = 64

Then continue to the other formulas to get the Network ID, number of hosts and the broadcast IP as above.

ALTERNATIVELY:

You can use to calculate the number of hosts is = 2 power of ( unmasked bit )-2, in this case :

Total number of hosts = (2 ^ 5 )-2 = 62 hosts

As reminder again, please always remember that :

  1. The FIRST IP in a subnet = Network ID
  2. The LAST IP in a subnet = Broadcast IP
  3. Remaining IPs between item (1) and (2) are the available IPs can be used in the network devices e.g. PC, router etc.

As reference, the graphical charts below shows the number of hosts for 10.0.x.x network with different subnet mask & unmasked bits.

IP04

Let me discuss on another example, this time we are given an IP address and subnet mask instead of Network ID is given :

EXAMPLE 3 :

IP : 10.20.237.15 / Subnet Mask : 255.255.248.0

In the case to get the Network ID, 0s in the subnet mask will convert whichever number from IP address into 0.

0000 1010. 0001 0100. 1110 1101. 0000 1111 = 10.20.237.15

1111 1111. 1111 1111. 1111 1000. 0000 0000 = 255.255.248.0

---------------------------------------------------------------------------------------------

0000 1010. 0001 0100. 1110 1000. 0000 0000 = 10.20.232.0

Network ID = 10.20.232.0

The FIRST IP : 10.20.232.1

The LAST IP

= 10.20.[232 + (8 unmasked bits in subnet mask portion 3) - 1].255

= 10.20.232.255

IP06

Number of hosts = (2 ^ unmasked bits) - 2 = (2 ^ 11) -2 = 2048 hosts

( which equivalent to 4x default Class C network )

Try it out yourself....and I think I should stop here, as I am damm sleepy now. Will continue tomorrow in the next post.

1 条评论:

Er HC 说...

Very useful networking knowledge. 10s.

ShareThis