Routing is one of the most important matters in computer networking. Usually in case of switching and routing both cases we need to apply the routing rules and protocols. But usually routing is handled by routers. Now a day layer 3 switches are also used as router. On this article we will talk about routing with details.
First of all let’s know what routing means. Routing is the process by which we establish communication between two different networks. Using this process we usually introduce two networks with each other. There are two kind of routing mechanisms we can find, static and dynamic routing. Also we can have combination of those together in single router.
Usually routing devices are called gateway device or router. Usually a gateway device consists of basic two networks one is local network and another is internet or WAN. Routers does not only introduce local network to public network, it also have other things to do like finding the best route for a packet and introducing one network to another. The static or manual routing is the fastest way to communicate on the other hand dynamic routing requires some calculations before forwarding the packets.
Now let’s talk about how routers work. Routing table is a simple database which contains all the possible neighbors a router usually have. The routing table contains static and dynamic routes and also it have the administrative distance with it. When a packet is placed for forwarding then the router reads the routing table and forward using the optimal path. Here routing protocol is another important issue. Routing protocols usually have different administrative distances and the best path or the optimal path is calculated depending on that.
Finally let’s discuss how the packets are being flowed from one end to another end. First of all the data will be transferred to the data link layer. On data link layer the data usually checks if there is any error in the frames. Here the frame usually contains a header where the source and destination addresses are provided. A virtual link is created using those two addresses. On data link layer it also creates a sequence for transmitting the data. The data starts sending and receiving after getting an acknowledgment signal from both the sides. Once both side get the acknowledgement signal then the virtual connection is created. On this stage the task is transferred to the network layer.
On this layer the router gets the header and finds out the destination address. Once the destination is determined the routers starts looking for the destination. If the destination is within the local network then it uses the default route, otherwise it will look the routing table for finding the destination address. Once the destination address is determined from the routing table it will start finding the optimal path. If the route is a static route then that will be used otherwise it will use the routing protocols to determine the optimal path. When the optimal path is determined a virtual connection will be created between source and destination. After the acknowledgement signal the data will start transferring between source and destination.