1
NETMANIAS TECH-BLOG Please visit www.netmanias.com to view more posts
Switching and Routing - Part 2. Packet Forwarding
...
Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router
2
1. Installing Routing Entries in RIB...
Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router
3
2. R1 MAC Address Learning by Device...
Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router
4
3. Sending a Packet from Device/Serv...
Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router
5
① SVR1, now with a1, the MAC address...
Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router
6
4. Sending a Packet from Device/Serv...
Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router
7
① Now, SVR1 sends a packet destined ...
About NMC Consulting Group (www.netmanias.com)
NMC Consulting Group is an advanced and professional network consulting com...
Upcoming SlideShare
Loading in …5
×

Switching and Routing - Part 2. Packet Forwarding by IP Router

656 views

Published on

Download a PDF file: http://www.netmanias.com/en/?m=view&id=blog&no=6344
You can also find and download more materials from http://www.netmanias.com

Published in: Technology
  • Be the first to comment

Switching and Routing - Part 2. Packet Forwarding by IP Router

  1. 1. 1 NETMANIAS TECH-BLOG Please visit www.netmanias.com to view more posts Switching and Routing - Part 2. Packet Forwarding by IP Router June 18, 2014 | By Netmanias (tech@netmanias.com) As noted in the previous post, we will explain the logic of IP packet delivery among routers. Network Topology Seen in the left figure below is the network topology to help you understand the packet delivery process among routers. In the middle of the figure lies a router (R1), and in the bottom, four servers are connected to the router through the ports ge1/1 ~ ge1/4, respectively. On the top of the router lie two ports (ge2/1 and ge2/2), and two routers (R2 and R3) are connected to R1 through these two ports, respectively. R2 is connected to 100.1.1.0/24 network, and R3 is connected to 200.1.1.0/24 network. Now, we will see how packets are delivered from SVR1, via R1 or R2, to 100.1.1.0/24 network. The MAC and IP addresses of the routers and servers are as follows: 100.1.1/24 200.1.1/24 ge1/4 IP: 4.1.1.40 MAC: m4 ge1/3 IP: 3.1.1.30 MAC: m3 ge1/2 IP: 2.1.1.20 MAC: m2 ge2/2 ge2/1 .2.2 .1.1 30.1.1.0/3020.1.1.0/30 ge1/1 IP: 1.1.1.10 MAC: m1 MAC: b2 MAC: b3 R2 R3 .1 .1 .1 .1 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 SVR1 MAC: a5 MAC: a6 R1 MAC: a1 MAC: a2 MAC: a3 MAC: a4 Switching Fabric Switch Module ge1/4 ge1/3 ge1/2 ge1/1 FIB Table ARP Table Packet Processor (Ingress Lookup/Egress Scheduling) Ingress Packet Buffer Egress Packet Buffer Line Card #1 ge2/4 ge2/3 ge2/2 ge2/1 FIB Table ARP Table Egress Packet Buffer Line Card #2 Ingress Packet Buffer Packet Processor (Ingress Lookup/Egress Scheduling) ARP Table R1: Control Module RIB Table OSPF Process LSDB (Link-State Data Base) R2 SVR1 FIB Table ARP Table Egress Packet Buffer Line Card #1 Ingress Packet Buffer Packet Processor (Ingress Lookup/Egress Scheduling)
  2. 2. Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router 2 1. Installing Routing Entries in RIB/FIB Using OSPF Protocol R1 installs routing entries in the RIB/FIB by performing the following steps: ① R1 exchanges OSPF LSA (routing information) with its OSPF neighbors, R2 and R3. ② It saves all the routing information in the Link State Data Base (LSDB). ③ For OSPF, the best forwarding strategy is "to use the least-cost path". So, it calculates the shortest (least- cost) path to each destination through Shortest Path First (SPF) calculation. ④ It installs the results (the shortest path routing entries) in the RIB. ⑤ Then, the installed routing entries are copied to the FIB on each line card. In case of the example in the figure above, the following routing information is installed in the RIB/FIB as a result of the foregoing steps: "(1) the destination network 1.1.1.0/24 is directly connected to R1, and the outgoing interface (OIF) is ge1/1, and (2) the destination network 100.1.1.0/24 is not connected to R1, and so the next hop is R2 (20.1.1.1) and and the OIF is ge2/1". Please note that the routing entries for 100.1.1.0/24 and 200.1.1.0/24 are installed in the RIB/FIB according to the steps explained above, whereas the rest routing entries are installed when the system operator configures an IP address for each interface (port) through CLI (e.g. when configuring an IP address (i.e. 1.1.1.1/24) for interface ge1/1). Switching Fabric Switch Module ge1/4 ge1/3 ge1/2 ge1/1 FIB Table ARP Table Packet Processor (Ingress Lookup/Egress Scheduling) Ingress Packet Buffer Egress Packet Buffer Line Card #1 ge2/4 ge2/3 ge2/2 ge2/1 FIB Table ARP Table Egress Packet Buffer Line Card #2 Ingress Packet Buffer Packet Processor (Ingress Lookup/Egress Scheduling) ARP Table R1: Control Module (CM) RIB Table OSPF Process LSDB (Link-State Data Base) R2 R3 OIFDestination Network Next Hop Control Module (CM): RIB IP Address MAC Address Line Card #1: ARP Table IP Address MAC Address Line Card #2: ARP Table IP Address MAC Address CM: ARP Table ge1/1 ge1/2 ge1/3 ge1/4 ge2/1 ge2/2 ge2/1 ge2/2 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 20.1.1.0/30 30.1.1.0/30 100.1.1.0/24 200.1.1.0/24 - - - - - - 20.1.1.1 30.1.1.1 OIFDestination Network Next Hop Line Card #1 & #2: FIB ge1/1 ge1/2 ge1/3 ge1/4 ge2/1 ge2/2 ge2/1 ge2/2 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 20.1.1.0/30 30.1.1.0/30 100.1.1.0/24 200.1.1.0/24 - - - - - - 20.1.1.1 30.1.1.1 4 5 Installed by Interface Configuration Installed by OSPF (SPF Calculation) Installed by Interface Configuration Installed by OSPF (SPF Calculation) Exchange OSPF LSA1 Shortest Path (SPF) Calculation3 Copy RIB to FIB on all Line Cards5 Save LSA Info in LSDB2 Install Shortest Path Route Entries into RIB4
  3. 3. Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router 3 2. R1 MAC Address Learning by Device/Server (Filling in ARP Table) ① Now, SVR1 wants to send an IP packet destined to 100.1.1.1 (Destination IP address = 100.1.1.1). ② SVR1 refers to the routing table, and finds out that the destination is matched to the default route (0.0.0.0/0), and thus 1.1.1.1 (R1) is the gateway to use, and lan1 is the OIF. Note: In case of usual user devices (like regular PCs), the gateway IP address for the default route is also obtained when IP address is obtained through DHCP. In case of a server, however, the IP address and the gateway IP address of the default route are manually set by the administrator of each server. ③ SVR1 refers to its ARP table before sending a packet to the destined OIF (lan1) because it should know the MAC address of gateway 1.1.1.1 in order to send the packet (In Ethernet L2 (Link Layer), the MAC addresses of a sender (SVR1) and receiver (R1) should be respectively entered in the Source MAC address and Destination MAC address fields of the Ethernet header). Then, it finds no corresponding entry in the ARP table (ARP miss). ④ So, SVR1 sends an ARP Request packet to lan1 port to get the MAC address of gateway 1.1.1.1. ⑤ R1, upon receiving the ARP Request through ge1/1 port, responds to the request by sending an ARP Reply packet (informing of a1, the MAC address of gateway 1.1.1.1) back to SVR1. ⑥ SVR1 fills in its ARP table with the received information (saving a1 as the MAC address). 100.1.1/24 200.1.1/24 ge1/4 IP: 4.1.1.40 MAC: m4 ge1/3 IP: 3.1.1.30 MAC: m3 ge1/2 IP: 2.1.1.20 MAC: m2 ge2/2 ge2/1 .2.2 .1.1 30.1.1.0/3020.1.1.0/30 IP: 1.1.1.10 MAC: m1 MAC: b2 MAC: b3 R2 R3 .1 .1 .1 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 MAC: a5 MAC: a6 R1 MAC: a1 MAC: a2 MAC: a3 MAC: a4 SVR1 OIF lan1 lan1 Destination Network 1.1.1.0/24 0.0.0.0/0 - 1.1.1.1 Gateway SVR1: Routing Table IP Address 1.1.1.1 a1 MAC Address SVR1: ARP Table IP Address MAC Address SVR1: ARP Table ge1/1 1.1.1.0/24 .1 Application in SVR1 sends IP Packet destined to 100.1.1.1 1 ARP Lookup to find MAC address of Gateway 1.1.1.1 à No entry for 1.1.1.1 3 Receive ARP Reply 5Send ARP Request 4 Destination IP 100.1.1.1 is matched to default route (0.0.0.0/0) 2 Insert ARP Entry6
  4. 4. Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router 4 3. Sending a Packet from Device/Server to Router R1 for the First Time 100.1.1/24 200.1.1/24 ge1/4 IP: 4.1.1.40 MAC: m4 ge1/3 IP: 3.1.1.30 MAC: m3 ge1/2 IP: 2.1.1.20 MAC: m2 ge2/2 .2.2 .1.1 30.1.1.0/30 IP: 1.1.1.10 MAC: m1 MAC: b3 R2 R3 .1 .1 .1 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 SVR1 Switching Fabric Switch Module ge1/4 ge1/3 ge1/2 ge1/1 FIB Table ARP Table Packet Processor (Ingress Lookup/Egress Scheduling) Ingress Packet Buffer Egress Packet Buffer Line Card #1 ge2/4 ge2/3 ge2/2 FIB Table ARP Table Egress Packet Buffer Line Card #2 Ingress Packet Buffer Packet Processor (Ingress Lookup/Egress Scheduling) ARP Table R1: Control Module (CM) RIB Table OSPF Process LSDB (Link-State Data Base) IP Address MAC Address Line Card #1: ARP Table IP Address MAC Address Line Card #2: ARP Table SVR1 R2 IP Address MAC Address CM: ARP Table MAC: a5 MAC: a6 R1 MAC: a1 MAC: a2 MAC: a3 MAC: a4 20.1.1.1 b2 IP Address 20.1.1.1 b2 MAC Address CM: ARP Table IP Address MAC Address Line Card #2: ARP Table 1 OIFDestination Network Next Hop Control Module (CM): RIB ge1/1 ge1/2 ge1/3 ge1/4 ge2/1 ge2/2 ge2/1 ge2/2 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 20.1.1.0/30 30.1.1.0/30 100.1.1.0/24 200.1.1.0/24 - - - - - - 20.1.1.1 30.1.1.1 OIFDestination Network Next Hop Line Card #1 & #2: FIB ge1/1 ge1/2 ge1/3 ge1/4 ge2/1 ge2/2 ge2/1 ge2/2 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 20.1.1.0/30 30.1.1.0/30 100.1.1.0/24 200.1.1.0/24 - - - - - - 20.1.1.1 30.1.1.1 a1 m1 100.1.1.1 1.1.1.10 b2 a5 100.1.1.1 1.1.1.10 20.1.1.0/30 ge2/1 1.1.1.0/24 ge1/1.1 MAC: b2 ge2/1 ARP Request & Reply 8 Send IP Packet (Destination IP=100.1.1.1) 1 Send IP Packet (Destination IP=100.1.1.1) 11 FIB Lookup3 Store IP Packet in Ingress Buffer 2 Send Packet to Switching Fabric (Add Internal Header: NH=20.1.1.1, OIF=ge2/1) 4 ARP Miss Event (20.1.1.1)7 Insert ARP Entry9 ARP Lookup6 Store Packet in Egress Buffer5 Send ARP Request to 20.1.1.1 and get ARP Reply 8 Enter ARP entry into ARP Table in Line Card #2 10 Send IP Packet to ge2/1 11 FIB Lookup Result: NH=20.1.1.1, OIF=ge2/1 3 ARP Lookup Result: No MAC for 20.1.1.1 6 Insert ARP Entry10 Insert ARP Entry9
  5. 5. Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router 5 ① SVR1, now with a1, the MAC address of gateway 1.1.1.1, sends a packet destined to 100.1.1.1 through lan1 port. At this time the packet contains the following information: [Ethernet Header] Destination MAC address = a1 (R1's MAC address), Source MAC address = m1 (SVR1's MAC address) [IP Header] Destination IP address = 100.1.1.1, Source IP address = 1.1.1.10 (SVR1's IP address) ② This packet is received by R1 through ge1/1 port of the line card #1, and held in the ingress packet buffer momentarily (during FIB lookup). ③ Next, the packet processor, through FIB lookup (LPM: Longest Prefix Match) for the received packet, finds out the next hop and OIF are 20.1.1.1 and ge2/1, respectively. ④ The packet processor attaches an internal header to the front of the packet, and forwards it to the switch module. This internal header may contain various information depending on each vendor's implementation. However, for easier understanding, here we assume there are only two types of information contained: (1) information about the line card/OIF where the packet is forwarded (i.e. ge2/1 here), and (2) address information of the next hop (router) where the packet is forwarded (i.e. 20.1.1.1). ⑤ Now, the packet is passed through the switch module, and kept in the egress packet buffer of the line card #2. ⑥ The packet processor at the line card #2 checks the ARP table for the MAC address of the next hop 20.1.1.1. ⑦ No corresponding entry in the ARP table. So, the packet processor informs the control module of the ARP Miss event (reporting that there is no MAC address for 20.1.1.1). ⑧ In response to the report, the control module sends an ARP Request packet to ge2/1 port, and receives an ARP Reply packet from R2. ⑨ The control module saves the received MAC address of 20.1.1.1 (i.e. b2) in its ARP table. ⑩ Next, it forwards the saved information to the line card #2 that has informed of the ARP Miss event, having the same copied to the ARP table of the card (but, not to other line cards). ⑪ The packet processor at the line card #2 now has the MAC address of the next hop 20.1.1.1 (i.e. b2). So, it can simply forward the packet it previously kept in the egress packet butter to ge2/1. When forwarding the packet, the egress packet processor may either send the packet immediately according to the pre-set QoS policy (scheduling algorithm), or hold it in the egress packet buffer for a while to handle other packet(s) with a higher priority first. The packet forwarded by R1 to R2 consists of the following information. [Ethernet Header] Destination MAC address = b2 (R2's MAC address), Source MAC address = a5 (R1's MAC address) [IP Header] Destination IP address = 100.1.1.1, Source IP address = 1.1.1.10 (SVR1's IP address) Two things to note: First, the main concern of the line cards is to forward packets at wire-speed. So, other exceptional events like ARP miss are taken care of by the control module. Second, an ingress packet buffer is where packets are kept momentarily (instantaneously) while FIB lookup is performed, and hence is pretty small-sized (about hundreds of Kbytes). On the other hand, an egress packet buffer is where packets are kept according to the QoS policy when congestion occurs, and hence is pretty large-sized (several Mbytes).
  6. 6. Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router 6 4. Sending a Packet from Device/Server to Router R1 for the Second Time 100.1.1/24 200.1.1/24 ge1/4 IP: 4.1.1.40 MAC: m4 ge1/3 IP: 3.1.1.30 MAC: m3 ge1/2 IP: 2.1.1.20 MAC: m2 ge2/2 .2.2 .1.1 30.1.1.0/3020.1.1.0/30 IP: 1.1.1.10 MAC: m1 MAC: b2 MAC: b3 R2 R3 .1 .1 .1 .1 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 SVR1 Switching Fabric Switch Module ge1/4 ge1/3 ge1/2 ge1/1 FIB Table ARP Table Packet Processor (Ingress Lookup/Egress Scheduling) Ingress Packet Buffer Egress Packet Buffer Line Card #1 ge2/4 ge2/3 ge2/2 FIB Table ARP Table Egress Packet Buffer Line Card #2 Ingress Packet Buffer Packet Processor (Ingress Lookup/Egress Scheduling) ARP Table R1: Control Module (CM) RIB Table OSPF Process LSDB (Link-State Data Base) IP Address MAC Address Line Card #1: ARP Table IP Address MAC Address Line Card #2: ARP Table SVR1 R2 MAC: a5 MAC: a6 R1 MAC: a1 MAC: a2 MAC: a3 MAC: a4 20.1.1.1 b2 IP Address 20.1.1.1 b2 MAC Address CM: ARP Table 1 Send IP Packet (Destination IP=100.1.1.1) 7 OIFDestination Network Next Hop Control Module (CM): RIB ge1/1 ge1/2 ge1/3 ge1/4 ge2/1 ge2/2 ge2/1 ge2/2 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 20.1.1.0/30 30.1.1.0/30 100.1.1.0/24 200.1.1.0/24 - - - - - - 20.1.1.1 30.1.1.1 OIFDestination Network Next Hop Line Card #1 & #2: FIB ge1/1 ge1/2 ge1/3 ge1/4 ge2/1 ge2/2 ge2/1 ge2/2 1.1.1.0/24 2.1.1.0/24 3.1.1.0/24 4.1.1.0/24 20.1.1.0/30 30.1.1.0/30 100.1.1.0/24 200.1.1.0/24 - - - - - - 20.1.1.1 30.1.1.1 a1 m1 100.1.1.1 1.1.1.10 b2 a5 100.1.1.1 1.1.1.10 ge2/1 Send IP Packet (Destination IP=100.1.1.1) 1 1.1.1.0/24 ge1/1 ge2/1 FIB Lookup3 Send Packet to Switching Fabric (Add Internal Header: NH=20.1.1.1, OIF=ge2/1) 4 ARP Lookup6 Send IP Packet to ge2/1 7 FIB Lookup Result: NH=20.1.1.1, OIF=ge2/1 3 ARP Lookup Result: 20.1.1.1's MAC=R2 6 Store IP Packet in Ingress Buffer 2 Store Packet in Egress Buffer5
  7. 7. Netmanias Tech-Blog: Switching and Routing - Part 2. Packet Forwarding by IP Router 7 ① Now, SVR1 sends a packet destined to 100.1.1 network for the second time. ②③④ and ⑤ are the same as explained above, and so will not be discussed here again. ⑥ The packet processor at the line card #2 refers to the ARP table, and finds out the MAC address of the next hop 20.1.1.1 is b2. ⑦ So, according to the QoS policy (scheduling algorithm), it takes the packet out of the egress packet buffer, and forwards to ge2/1 port. The packet forwarded by R1 to R2 consists of the following information. [Ethernet Header] Destination MAC address = b2 (R2's MAC address ), Source MAC address = a5 (R1's MAC address) [IP Header] Destination IP address = 100.1.1.1, Source IP address = 1.1.1.10 (SVR1's IP address)
  8. 8. About NMC Consulting Group (www.netmanias.com) NMC Consulting Group is an advanced and professional network consulting company, specializing in IP network areas (e.g., FTTH, Metro Ethernet and IP/MPLS), service areas (e.g., IPTV, IMS and CDN), and wireless network areas (e.g., Mobile WiMAX, LTE and Wi-Fi) since 2002. Copyright © 2002-2014 NMC Consulting Group. All rights reserved. 8 Carrier WiFi Data Center Migration Wireline Network LTE Mobile Network Mobile WiMAX Carrier Ethernet FTTH Data Center Policy Control/PCRF IPTV/TPS Metro Ethernet MPLS IP Routing 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 eMBMS/Mobile IPTV Services CDN/Mobile CDN Transparent Caching BSS/OSS Cable TPS Voice/Video Quality IMS LTE Backaul Netmanias Research and Consulting Scope Visit http://www.netmanias.com to view and download more technical documents. Future LTE IP/MPLS CarrierEthernet Networks Consulting POC Training Wi-Fi Infrastructure Services CDN Transparent Caching IMS Concept Design DRM eMBMS protocols Analyze trends, technologies and market Analysis Report Technical documents Blog One-Shot gallery We design the future We design the future We design the future

×