IP addressing continued.....PART II
Let's assume we own a fictional game programming company and we have 2 departments currently: the programming and graphics designing departments. One has 3 nodes (A, B, C) and the other 2 nodes (E, F) as shown in the figure (assume that node D- router D is not present). Since we have only 5 computers, we might as well have put everything in one network (i.e. we could have used a single bus). But we believe that our growth rate is going to be very high and we predict that in a couple of months our team size might increase to 100 (perhaps a bit too optimistic!). Keeping the future in mind we decide to segregate the departments by maintaining each department on a separate network. When there are too many nodes within the same network, the traffic is bound to increase. To reduce traffic we divide our network into smaller groups. In our company we club A, B and C on one network.
So, if computer A wants to send something to C then it's not a problem since both are on the same network (connected by the same bus). But if A wants to talk (send data) to F, how is it possible? It is quite clear that we need someone in the middle to pass on messages from one network to the other. And this intermediate person is the router D. And now we come to that all important question: "what is a router?". A device which forms the link between 2 or more networks can be termed a router. Why do I say "a device"? The device can be a computer (configured and programmed to perform the job) or it could be a specialized hardware device dedicated solely for routing (examples are Cisco routers). That brings us to another question: "If a computer can act as a router, what's the difference between node A and D?"
The answer lies in the picture: Node A (or B,C,E or F) have just one link branching out from them (i.e. there is only one path of communication with them). But router D has 2 paths of connection (one link is with the programmer's dept. and one with the graphics dept). Rather than use the term links/paths we generally use the term 'interface'. A router has multiple interfaces (what's an interface? The electrical plug point is an interface. It provides us with an interface to tap electrical power). Any system that has multiple interfaces is said to be "multihomed". Routers are multihomed devices.
Routers contain routing tables which they refer to frequently for determining where they should route packets. Routers are not intelligent enough to know who is connected where. The routing table is similar to our address book.
So when A wants to talk to F, it will transmit a packet on its segment. The router will examine the packet for the destination address. It checks the routing table and realizes that this address is not a node in the programming department but it's an address of the graphics department. So the router forwards the packet to the graphics department network segment. All nodes here receive the packet, check up the address on the packet and either discard (E will discard it) or accept it (F will accept the packet).
Now we know how communication occurs in a network. Now let's get back to our IP manager (remember he gave us the addresses: 100.10.20.0, 20.100.1.2, 2.2.2.2 etc). Now each of our nodes A to F have some weird combo of numbers as their IP address.
Well, obviously one router isn't going to be sufficient to handle all the networks in the world; every organization would need a router and even we might need an extra router for our use also. Perhaps we open another branch; a new office and we don't want that network to mix up with the existing one. We would then want the new networks to be handled by another router. Which means that our Router D should have another interface to the other router (an internet is formed by interconnecting networks and we can't expect to connect directly to every PC in the other office who wants to access our network. Why have 2 routers? Again if the router is going to connect lots of segments it can lead to increase in traffic and degradation in performance). Or perhaps if we are interconnecting with another company, then we would need to interconnect the 2 routers.
To keep the scenario simple, let's say that we have another router (belonging to another organization) connected to Router D as shown in the figure below:
Obviously the routing table of Router D will need to know about nodes A and B (i.e. it should know the addresses of A and B). If some foreign node, sends data to A via router X, then what do you think Router X should know to direct the packet correctly? It would need to have the following entry in its routing table:
Destination IP address | The router to forward packet to |
100.10.20.0 | 2.2.2.2 |
20.100.1.2 | 2.2.2.2 |
Now if X receives a packet destined to node A, it knows it should forward the packet to 2.2.2.2 (which is the IP address of Router D).
Now imagine if our company expands, and we have 100 nodes instead of 5. The routing table of router X will need to contain all these 100 addresses! 100 is also fine, what about 1000! And here we are considering just our organization alone. If there were 10 companies we wanted to interconnect with, then our router X would need to know all the nodes present in the 10 companies. The problem is not only confined to router X; router D will also need to know about every other node and IP address. You can imagine how messy the routing tables would be! So, what could have been done to avoid this? Wouldn't it be great if our company as a whole had a single IP address and then within our organization we could allot addresses ourselves? The above mess was created by our IP manager. The manager could have told us: "I'm giving you the IP addresses from 2.2.2.0 upto 2.2.2.255. You can allocate the 0 to 255 in any way you want but the 2.2.2 is your identity".
Wow! That's a smart IP manager. Now our nodes can be addressed as 2.2.2.1, 2.2.2.2, 2.2.2.3 and so on (while 2.2.2.0 represents our network).
Let's say node A has the address 2.2.2.1 and B has the address 2.2.2.5 the routing table of X will now be:
Destination IP address |
The router to forward packet to |
2.2.2.1 |
2.2.2.2 |
2.2.2.5 |
2.2.2.2 |
And now you say, "Hey! What's the big deal of this. The routing table still needs to have every single IP address of our company listed. Isn't it smart enough to know that anything starting with 2.2.2 belongs to our dream organization?"
Well, you're right. But computers and routers are fairly dumb (we make them appear intelligent). But how are they supposed to know that 2.2.2.1 and 2.2.2.5 are within the same network? How will they know that if they receive a packet with IP starting in 2.2.2. they should forward it to router D?
To do this we need to tell them how to compare addresses and this is where the concept of masks comes in. More on that in the next edition.
Copyright © 2004 Sethu Subramanian All rights reserved. Sign my guestbook.