Thursday, October 18, 2007

Note that it doesn't matter where the packet came from or what the source IP address of the packet is. Each packet is routed based only on the destination address.

So let's look inside the router 207.8.130.1. There are four routes in the IP routing table:

("Network Number") ("Specificity") Specificity
0.0.0.0 0.0.0.0 (/0) 207.106.127.46 Serial0
207.106.127.44 255.255.255.252 (/30) 207.106.127.45 Serial0
207.8.130.0 255.255.255.0 (/24) 207.8.130.1 Ethernet0
207.8.130.128 255.255.255.192 (/27) 207.8.130.7 Ethernet0

Let's say the router gets a packet destined for the web server, 207.8.130.3. It looks at its routing table and finds 207.8.130.0/24 and 0.0.0.0/0 which match 207.8.130.3. 207.8.130.0/24 is the most specific route, so it sends the packet out the Ethernet0 interface.

Why did it get this packet? Probably, someone on the Internet is sending a request to the web server and the packet came in via the serial port. Note that it doesn't matter where the packet came from or what the source IP address of the packet is. Each packet is routed based only on the destination address.

Now let's say that the router gets a packet destined for one of the dial-up users, 207.8.130.134. It looks at its routing table and finds 207.8.130.128/27, 207.8.130.0/24, and 0.0.0.0/0 as matching routes. 207.8.130.128/27 is the most specific route, so it looks at the next-hop of that route, which is 207.8.130.7. Then it looks and finds that the best route for 207.8.130.7 is 207.8.130.0/24, which has a next-hop of Ethernet0, so it sends the packet out Ethernet0 to 207.8.130.7.


Read more here.

No comments: