Sunday, November 29, 2009

Networking with Linux : Understanding IP Addressing and need of IPv6 (Part II)

In my last post I talked about different IP classes. Now let us see a few point of netmask. Netmask decides the class actually and the number of nodes. Unless you are using CIDR (Classless Interdomain Routing) netmasks have a fixed value for each class. The default values are :-
  • Class A : 255.0.0.0
  • Class B : 255.255.0.0
  • Class C : 255.255.255.0
Netmask has a unique property, the bits of netmask has be a stream of continuous 1s followed by continuous 0s. Even CIDR follows this property.

Each network of nodes has a network address of its own which is decided by the netmask the IP has. Now let us see that how this netmask helps us in deciding or finding the network address. Well since we are not discussing CIDR, its pretty simple. You can just convert IP Address and Netmask in binary and do the AND operation bit by bit. What you get is Network Address. Following is an illustration for the same :-

Consider IP address of a node 192.168.154.7 and the netmask 255.255.255.0. This is a class C IP Address used for private networks. Now we are interested in knowing the network IP. For this we just have to convert the IPs and netmask to binary form.
    IP Address : 11000000.10101000.10011010.00000111
    Netmask : 11111111.11111111.11111111.00000000
Now we do binary AND of these bit by bit and we get :-
Network IP : 11000000.10101000.10011010.00000000
i.e 192.168.154.0 and this is the network IP indeed. Network IP is the first IP of the Network and in the similar sense Broadcast IP is the last IP of the network.

Now let us talk a bit about CIDR and its advantage. CIDR as the name suggest is classless. There is nothing like Class A, B or C. While this makes it a bit difficult to understand, it increases its efficiency many folds. You might have observed that class C cannot have more that 256 IPs which might be too less to large organizations. Another alternative is to switch to Class A or B IPs but then its possible that the organization has more than a network to maintain.
To cater this problem we use the concept of CIDR. In CIDR the netmask is not fixed to 255.255.255.0. We can have netmasks like 255.255.248.0. This allows us to create sub networksn or super networks. For example if my IP is 192.168.154.7 and the netmask is 255.255.248.0, my IP configuration will be able to have 2048 IPs in one network. Earlier it had only 256 IPs in one network. So this is what a CIDR can do.

My next post will be regarding Domain Names. Hold tight ! :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.