20/10/2023
๐งฌRouting in Ipv4 and and Ipv6:
1. How routing happens in Ipv4?
IPv4 routing tables contain a list of IP addresses and the corresponding next-hop router.
The next-hop router is the router that is directly connected to the destination network.
When a router receives an IPv4 packet, it looks up the destination IP address in its routing table.
If the router has a route for the destination IP address, it forwards the packet to the next-hop router.
If the router does not have a route for the destination IP address, it sends an ICMP Destination Unreachable message back to the sender.
2. How routing happens in Ipv6?
IPv6 routing is similar to IPv4 routing, but there are a few key differences.
First, IPv6 routing tables contain a list of prefixes and the corresponding next-hop router.
A prefix is a group of IPv6 addresses that share a common starting address.
Second, IPv6 routers use a variety of techniques to determine the best path to send packets.
One common technique is to use Path MTU Discovery (PMTUD).
PMTUD is a process that allows routers to determine the maximum packet size that can be transmitted over a link.
Third, IPv6 routers use a technique called next-header to process packets.
The next-header field in the IPv6 header specifies the type of header that follows the IPv6 header.
This allows routers to efficiently process packets with different types of options.
In the Image it shows a simple IPv4 network with two subnets, A and B.
Subnet A is connected to router R1, and subnet B is connected to router R2.
The two routers are connected to each other via a link.
3. IPv4 routing in this network would work as follows:
- A device on subnet A wants to send a packet to a device on subnet B.
- The device on subnet A sends the packet to its default gateway, which is router R1.
- Router R1 looks up the destination IP address in its routing table. The routing table tells router R1 that the best path to the destination is through router R2.
- Router R1 forwards the packet to router R2.
- Router R2 looks up the destination IP address in its routing table.
- The routing table tells router R2 that the destination IP address is on subnet B.
- Router R2 forwards the packet to the device on subnet B.
The routing table on each router is populated using a combination of static and dynamic routing protocols.
Static routes are manually configured by the network administrator.
Dynamic routes are learned from other routers on the network using routing protocols such as RIP, OSPF, and BGP.
In this specific example, the routing table on router R1 would have the following entry:
Destination IP address: 10.0.1.0/24
Next hop: Router R2
The routing table on router R2 would have the following entry:
Destination IP address: 10.0.0.0/24
Next hop: Router R1
These entries tell the routers that the best path to the 10.0.1.0/24 network is through the other router.
4. IPv6 routing in this network would work as follows:
The image shows a simple IPv6 routing scenario with two routers, R1 and R2, and two PCs, PC0 and PC1.
All devices are connected to the same LAN subnet, FC00:11:11:11::/64.
Sure. Here is an explanation of the IPv6 routing scenario in the image you sent, with the names of the PCs changed to PC0 and PC1:
IPv6 routing between PC0 and PC1:
- PC0 wants to send a packet to PC1.
It will first look up the IP address of PC1 in its ARP cache.
If the IP address is not found in the cache, PC0 will send an ARP request to the broadcast address of the LAN subnet.
- R2 and R1 will both receive the ARP request. However, only R2 will respond, since it is the gateway for the LAN subnet.
- PC0 will receive the ARP response from R2 and update its ARP cache with the MAC address of PC1.
- PC0 will then encapsulate the packet in an IPv6 datagram and send it to the MAC address of PC1.
- R2 will receive the IPv6 datagram and forward it to PC1, based on the destination IP address.
- PC1 will receive the IPv6 datagram and decapsulate it to extract the original packet.
- PC1 will then process the packet.
The same process will occur in reverse when PC1 wants to send a packet to PC0.
๐