We discussed about switches in a previous post and this post will explain you about routers.
Consider the following two networks.
Suppose you want to connect the computers in the first network together, you could use a switch for that purpose. Same thing could be done with the second network. However, if you want to communicate from one of the computers in the first network with that of a second network, can you just use switches? The answer is no. This is where routers come in to play.
Use of routers for such connections serves many purposes. But most importantly, routers enable you to connect to all sorts of networks like local area networks (LANs), metropolitan area networks (MANs) or even wide area networks (WANs, such as the Internet).
For example, assume the first network in some part of Asia and the second network in US. Then you have to connect each other with a wide variety of networks before reaching the destination either way. Routers enable you to make such connections through various technologies available in them. So, you can connect your computers easily in geographically separated locations as follows :
In this article :
1. Routers vs Switches
2. Use of routing tables
3. How data packets are transferred by a router
1. Routers vs Switches
2. Use of routing tables
3. How data packets are transferred by a router
Routers vs Switches
Consider the following two networks.
Fig 1 : Network at the start |
Suppose you want to connect the computers in the first network together, you could use a switch for that purpose. Same thing could be done with the second network. However, if you want to communicate from one of the computers in the first network with that of a second network, can you just use switches? The answer is no. This is where routers come in to play.
Use of routers for such connections serves many purposes. But most importantly, routers enable you to connect to all sorts of networks like local area networks (LANs), metropolitan area networks (MANs) or even wide area networks (WANs, such as the Internet).
For example, assume the first network in some part of Asia and the second network in US. Then you have to connect each other with a wide variety of networks before reaching the destination either way. Routers enable you to make such connections through various technologies available in them. So, you can connect your computers easily in geographically separated locations as follows :
Fig 2 : Use of routers |
Routers maintain routing tables and are much more intelligent devices than switches. Routers work in the layer 3 or the network layer of the OSI model while switches work in the layer 2 data link layer.
Use of routing tables
The routing table lists the routes to particular destinations, by storing a list of IP addresses. Through these IP addresses, a router recognizes its nearest routers and the network topologies (discussed in another blog post) surrounding it.
The size of the routing table depends upon the network to which it is connected. For example, since home network routers often connect to another router using an ISP connection, their routing tables are small compared to that of large networks where the details about many neighboring routers may need to be stored.
Some routing tables could be updated by network administrators. Such techniques are known as static routing while some routing tables are automatically assigned when you connect to a network. The latter process is called dynamic routing.
How data packets are transferred by a router
Consider the following network.
Fig 3 : How data packets are transferred by a router |
Now when a packet is sent by the computer to the router, the router should first examine whether the packet should be delivered to a computer within its LAN or MAN or should be sent out for another network.
For this purpose, routers use what is known as a subnet mask(a 32 bit number that divides the IP address into network address and host address). The subnet mask divides the available computers in the network and those outside by utilizing part of the IP address (the network part) and then finding the targeted computer in the network by using the host part.
Comments
Post a Comment