Routing is done on Layer 3(Network Layer) in OSI Model. Two most important task done in this layer are- Routing and Routed.
Routed means carrying network data packet from source to destination. Protocol responsible for this job is called Routed Protocol. Each Networking Stack has individual routed protocol- such as IP is the routed protocol of TCP/IP model and IPX is the Routed Protocol of Novel.
IP Routed Process Example
Step By Step IP routed process between two hosts of different Network is given below:
- Host (10.10.10.2) sends a packet to another host 172.16.241.4
- Step 1: Host 10.10.10.2 assign source and destination IP in packets at network layer.
- Step 2: At data link layer host will assign destination host MAC address(if same Network) or Default gateway MAC address in the frame. In this case, host 10.10.10.2 will assign router R1’s e0 interface MAC address.
- Step 3: Transmit the frame through media as bits.
- Step 4: Router R1 will get the packet and check the destination MAC of this Frame. If this MAC is e0 interface’s MAC then R1 will process the frame and send it to Network Layer.
- Step 5: At network Layer router will find that this packet should be sent to 192.168.241.2 to reach the 172.16.241.4
- Step 6: R1 will change the source MAC of this frame and replace it with own e1 interface MAC. Then destination MAC will be replaced with R2 e1’s MAC.
- Step 7: Then this packet will reach to R2. R2 will validate the destination MAC and send it to its network layer. In this layer Router will be determined to send this packet through its own interface.
- Step 8: R2 will replace source and destination MAC with its own e0 interface MAC and 172.16.241.4 host’s MAC.
- Step 9: Finally host 172.16.241.4 will get the frame. After validation of the frame, it will be sent to Network layer and finally user interface will get this user data.
For more details: Please follow the Further Reading section
Routing is the process to provide Path information to reach a destination so that Routed protocol can carry the data packet to destination. Device which fulfills this requirement is known as Router. Usually Router has multiple interface and able to interconnect all of the interface connected in the Network. Actually Router maintain a routing table and by default all router has capability to keep their directly connected network information in their Routing Table.
Build Routing Table
To go unknown destination or which is not directly connected to Router, this destination should be in the routing table. To inject new or not directly connected Route information in routing table we have two ways.
Administrator statically assign route- in- route via router input interface. We need the following information to configure static Route in most of the router
- Destination Network like 10.10.10.0
- Destination Subnet Mask 255.255.255.0
- Exit interface or through which interface packet will go to Destination.
- Next hop or Gateway to reach Destination
Router will automatically get routing information from Neighbor Router through Protocol Level Negotiation. There are few protocol via which router can Exchange Route information. These are:
The following information is needed in most of the router to configure Dynamic route
Network Address- Router directly connects network which want to Advertise to Outside via this Protocol.
All most every routing protocol select best path if one more route exist for a destination.