• Save
Switching and Routing for Dummies - Part 2. IP Routing
Upcoming SlideShare
Loading in...5
×
 

Switching and Routing for Dummies - Part 2. IP Routing

on

  • 253 views

Click the link to download a PDF file http://www.netmanias.com/en/?m=view&id=blog&no=6332

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

Statistics

Views

Total Views
253
Views on SlideShare
211
Embed Views
42

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 42

http://www.netmanias.com 37
http://www.slideee.com 5

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Switching and Routing for Dummies - Part 2. IP Routing Switching and Routing for Dummies - Part 2. IP Routing Document Transcript

  • 1 NETMANIAS TECH-BLOG Please visit www.netmanias.com to view more posts Switching and Routing for Dummies - Part 2. IP Routing May 8, 2014 | By Chris Yoo (tech@netmanias.com) In the previous post, we learned about L2 (Ethernt) switching. This post is about L3 (IP) routing. This time, we will look into IP routing illustrated in the right figure below. Again, please take a close look at the network configuration above. In the figure, MAC/IP values are as follows: Server/Router Port Mac address IP address SVR1 SVR3 R1 Lan1 Lan2 ge1/1 ge2/1 M1 M3 a1 a2 1.1.1.10 2.1.1.30 1.1.1.1 2.1.1.1 IP: 1.1.1.1/24 MAC: a1 Router 1 (R1) Switch 2 (S2) Internet IP: 2.1.1.1/24 MAC: a2 ge1/1 ge2/1 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 IP: 1.1.1.20 MAC: m2 IP: 2.1.1.30 MAC: m3 IP: 2.1.1.40 MAC: m4 SVR1 SVR2 IP: 1.1.1.1/24 MAC: a1 Router 1 (R1) Internet IP: 2.1.1.1/24 MAC: a2 ge1/1 ge2/1 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 IP: 1.1.1.20 MAC: m2 IP: 2.1.1.30 MAC: m3 IP: 2.1.1.40 MAC: m4 SVR1 SVR2 Ethernet(L2) Switching IP(L3) Routing fe1 fe2 fe1 fe2 fe1 fe2 fe1 fe2 fe3 fe3 Switch 1 (S1) fe3 fe3 a1 m1 2.1.1.30 1.1.1.10 IPDestination IPSource MACSource MACDestination m3 a2 2.1.1.30 1.1.1.10 IPDestination IPSource MACSource MACDestination m2 m1 1.1.1.20 1.1.1.10 IPDestination IPSource MACSource MACDestination 1 2 4 3 1 2 1 2 1 2 3 4 Switch 2 (S2) Switch 1 (S1) Ethernet Header IP Header lan1 lan1 lan1 lan1 lan1 lan1 lan1 lan1
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 2 IP Routing SVR1 sends ARP Request R1 S1 S2 SVR1 SVR2 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 R1 S1 S2 SVR1 SVR2 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 R1 S1 S2 SVR1 SVR2 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 FF:FF:FF:FF:FF:FF m1 1 2 m1 1.1.1.10 - 1.1.1.1 MACDestination MACSource IPSender IPTarget MACSender MACTarget 2 1 2 4 5 6 Traffic Flow Packet Format (ARP Request) 3 4 Packet Format (ARP Reply) m1 a1 a1 1.1.1.1 m1 1.1.1.10 MACSource MACDestination IPSender IPTarget MACSender MACTarget 5 6 Packet Format (IP Packet) a1 m1 2.1.1.30 1.1.1.10 IPDestination IPSource MACSource MACDestination Traffic Flow Traffic Flow SVR1 sends ARP Request to S1 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 MAC Address SVR1: ARP Table MAC Address Port S1(Switch 1): MAC Table R1 sends ARP Reply to S1 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 MAC Address SVR1: ARP Table MAC Address m1 fe1 Port S1(Switch 1): MAC Table SVR1 sends IP Packet to S1 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 MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table R1 responds with ARP Reply11 12 SVR1 sends IP Packet to R113 1 3 5 3 IP: 2.1.1.30 MAC: m3 IP: 2.1.1.30 MAC: m3 IP: 2.1.1.30 MAC: m3 MAC Address Port S2(Switch 2): MAC Table MAC Address S1 fe1 Port S2(Switch 2): MAC Table MAC Address S1 A fe1 fe3 Port S2(Switch 2): MAC Table OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) ARP Table Lookup Routing Table LookupRouting Table Lookup IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table ARP Miss S1 R1 S1 S1 S2 S2 S2 R1 R1
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 3 1. SVR1 sends ARP Request  SVR1 with IP address of 1.1.1.10 is trying to send a packet to the destination, SVR3 with IP address of 2.1.1.30.  Through routing table lookup, SVR1 finds out the destination address 2.1.1.30 is mapped to a default route (0.0.0.0/0), and thus "in order for the packet to reach the destination, it has to go to the gateway 1.1.1.1 via OIF (outgoing Interface) lan1". In case of regular PCs, IP addresses are assigned (leased) through DHCP and gateway addresses are assigned through DHCP Option 3. In case of servers, gateway addresses are set by server administrators. Then, the assigned (or set) addresses are installed in the routing table.  A gateway (also known as default gateway) refers to the first router (no matter how many L2 switches there are in between) connected to a server, e.g. SVR1 here. This gateway is located in the same network that the server (SVR1) belongs to (In the figure, 1.1.1.1, the interface address of the first router (R1) connected to SVR1 (at 1.1.1.10) is the gateway of the server).  As the ARP table does not have a MAC address entry for the gateway whose IP address is 1.1.1.1 (i.e. ARP miss event), SVR1 sends an ARP Request packet with the following fields to lan1 port: Header Fields Ethernet Header * Destination MAC = FF:FF:FF:FF:FF:FF (broadcasting, so sending to all nods in the same LAN) * Source MAC = m1, the MAC address of Sender (SVR1) IP Header * Sender MAC = m1, the MAC address of the ARP Request packet sender (SVR1) * Sender IP = 1.1.1.10, the IP address of the ARP Request packet sender (SVR1) * Target MAC = 00:00:00:00:00:00 (the value that SVR1 wants to find out) * Target IP = 1.1.1.1, the IP address of the ARP Request packet target (R1) MAC Address Port S2(Switch 2): MAC Table MAC Address S1 fe1 Port S2(Switch 2): MAC Table MAC Address S1 A fe1 fe3 Port S2(Switch 2): MAC Table OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) S1 floods ARP Packet 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 MAC Address SVR1: ARP Table MAC Address m1 fe1 Port S1(Switch 1): MAC Table S1 sends ARP Reply to 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 MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table S1 sends IP Packet to R1 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 MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table 2 4 6 Destination MAC Lookup Destination MAC Lookup Source MAC Learning ARP Learning IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table S1 S1 S1 S2 S2Source MAC Learning S2 R1 R1 R1
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 4  Upon receiving the packet, S1 (Switch 1) performs source MAC learning and records the following in the MAC table: {MAC address m1 is connected to fe1 port}.  By referring the destination MAC address in the received packet, S1 determines an output port, e.g. a broadcast address (FF:FF:FF:FF:FF:FF) in this case. Accordingly, S1 performs flooding to all ports except for the receiving port. As a result, the packet is received by SVR2 and R1 (Router 1).  From the target IP address of the received ARP Request packet, SRV2 learns that the address does not match its own. So, it discards it. 2. R1 responds with ARP Reply  R1 (Router 1) also checks the target IP address of the received ARP Request packet, and notices that its MAC is requested. So, it enters the MAC address corresponding to 1.1.1.1 in the Sender MAC field of an ARP Reply packet, and sends the packet to ge1/1 port. At this time, the packet includes the following fields: Header Fields Ethernet Header * Destination MAC = m1, the MAC address of SVR1 to which ARP Reply is to be delivered * Source MAC = a1, the MAC address of Sender (R1) IP Header * Sender MAC = a1, the MAC address of the ARP Reply packet sender (R1) * Sender IP = 1.1.1.1, the IP address of the ARP Reply packet sender (R1) * Target MAC = m1, the MAC address of the ARP Reply packet target (SVR1) * Target IP = 1.1.1.10, the IP address of the ARP Reply packet target (SVR1)  S1, upon receiving the packet, learns the source MAC and records the following in the MAC table: {MAC address a1 is connected to fe3 port}.  Then, it sends (unicasts) the packet to fe1 port by referring to the MAC table where m1, the destination MAC address of the received packet, is mapped to fe1.  Next, SVR1 records the received value (a1, the MAC address assigned for 1.1.1.1) in its ARP Table. 3. SVR1 sends IP Packet to R1  SVR1, now ready to send an IP packet to SVR3, sends one with the following fields to lan1 port: Header Fields Ethernet Header * Destination MAC = a1, the MAC address of Receiver (R1) * Source MAC = m1, the MAC address of Sender (SVR1) IP Header * Destination IP = 2.1.1.30, the IP address of Receiver (SVR3) * Source IP = 1.1.1.10, the IP address of Sender (SVR1)  S1, having already learned the source MAC address, skips the source MAC learning and sends the packet to fe3 port, as mapped for the destination MAC address a1 in the MAC table.
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 5 IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table R1 sends ARP Request S1 S2 SVR1 SVR2 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 R1 R1 S1 S2 SVR1 SVR2 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 R1 S1 S2 SVR1 SVR2 SVR3 SVR4 IP: 1.1.1.10 MAC: m1 FF:FF:FF:FF:FF:FF a2 7 8 a2 2.1.1.1 - 2.1.1.30 MACDestination MACSource IPSender IPTarget MACSender MACTarget 7 Traffic Flow Packet Format (ARP Request) 9 Packet Format (ARP Reply) a2 m3 m3 2.1.1.30 a2 2.1.1.1 MACSource MACDestination IPSender IPTarget MACSender MACTarget Packet Format (IP Packet) m3 a2 2.1.1.30 1.1.1.10 IPDestination IPSource MACSource MACDestination Traffic Flow Traffic Flow R1 sends ARP Request to S2 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 MAC Address SVR1: ARP Table MAC Address Port S1(Switch 1): MAC Table SVR3 sends ARP Reply to S2 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 MAC Address SVR1: ARP Table MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table R1 sends IP Packet to S2 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 MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table SVR3 responds with ARP Reply14 15 R1 sends IP Packet to SVR316 7 9 98 8 IP: 2.1.1.30 MAC: m3 IP: 2.1.1.30 MAC: m3 IP: 2.1.1.30 MAC: m3 MAC Address Port S2(Switch 2): MAC Table MAC Address S1 fe1 Port S2(Switch 2): MAC Table MAC Address S1 A fe1 fe3 Port S2(Switch 2): MAC Table OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) 1.1.1.1 a1 m1 a1 fe1 fe3 Routing Table Lookup ARP Miss 1.1.1.1 a1 S1 R1 S2 S1 S1 S2 S2 R1 R1 a2 fe3 a2 m3 fe3 fe1 2.1.1.30 m3 ARP Table Lookup Routing Table Lookup 10 10 11 12 11 12 11 Destination MAC Lookup
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 6 4. R1 sends ARP Request • Upon receiving the received packet, R1 (router 1) knows that "the destination address 2.1.1.30 is the network immediately connected to itself (because there is no next hop), and the output port is ge2/1" by referring to its FIB (routing table). • Now, R1 checks the ARP table for the MAC address corresponding to 2.1.1.30, and finds no entry there (ARP Miss). So, it sends an ARP Request packet with the following fields to ge2/1 port. Header Fields Ethernet Header * Destination MAC = FF:FF:FF:FF:FF:FF (broadcasting: reaching all nodes in the same LAN) * Source MAC = a2, the MAC address of Sender (R1) IP Header * Sender MAC = a2, the MAC address of the ARP Request packet sender (R1) * Sender IP = 2.1.1.1, the IP address of the ARP Request packet sender (R1) * Target MAC = 00:00:00:00:00:00 (the value that R1 wants to find out) * Target IP = 2.1.1.30, the IP address of the ARP Request packet target (SVR3) • Now, this packet is received by S2 (Switch 2), and the source MAC address of the received packet is learned. Then, the following is recorded in the MAC table at S2: {MAC address a2 is connected to fe3 port}. • By referring to the destination MAC address of the received packet, S2 determines which output port to send to. In this case, as it is a broadcast-type address (FF:FF:FF:FF:FF:FF), it performs flooding to all the ports except for the receiving port. As a result, the ARP Request packet is received by SVR3 and SVR4. • From the target IP address of the received ARP Request packet, SVR4 notices that the address does not match its own, and hence discards it. MAC Address Port S2(Switch 2): MAC Table MAC Address S1 fe1 Port S2(Switch 2): MAC Table MAC Address S1 A fe1 fe3 Port S2(Switch 2): MAC Table OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) OIF ge1/1 ge2/1 Destination Network 1.1.1.0/24 2.1.1.0/24 - - Next Hop R1: FIB (Routing Table) S2 floods ARP Packet 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 MAC Address SVR1: ARP Table MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table S2 sends ARP Reply to R1 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 MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table S2 sends IP Packet to SVR3 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 MAC Address m1 a1 fe1 fe3 Port S1(Switch 1): MAC Table 8 1.1.1.1 a1 IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table IP Address MAC Address R1: ARP Table a2 fe3 Source MAC Learning 2.1.1.30 m3 ARP Learning a2 m3 fe3 fe1 Destination MAC Lookup S1 S1 S1 S2 S2 S2 R1 R1 Source MAC Learning R1 Destination MAC Lookup 10 12 a2 m3 fe3 fe1 2.1.1.30 m3
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 7 5. SVR3 responds with ARP Reply • SVR3 also checks the target IP address of the received ARP Request packet, and finds out the address matches its own address. So, it enters the MAC address corresponding to 2.1.1.30 in the Sender MAC field of an ARP Reply packet, and sends the packet to lan1 port. At this time, the packet includes the following fields: Header Fields Ethernet Header * Destination MAC = a2, the MAC address of R1 to which ARP Reply is to be delivered * Source MAC = m3, the MAC address of Sender (SVR3) IP Header * Sender MAC = m3, the MAC address of the ARP Reply packet sender (SVR3) * Sender IP = 2.1.1.30, the IP address of the ARP Reply packet sender (SVR3) * Target MAC = a2, the MAC address of the ARP Reply packet target (R1) * Target IP = 2.1.1.1, the IP address of the ARP Reply packet target (R1) • S2, upon receiving the packet, learns the source MAC and records the following in the MAC table: {MAC address m3 is connected to fe3 port}. • Then, it sends (unicasts) the packet to fe1 port by referring to the MAC table where a2, the destination MAC address of the received packet, is mapped to fe3. • Next, R1 records the received value (m3, the MAC address assigned for 2.1.1.30) in its ARP Table. 6. R1 sends IP Packet to SVR3 • Now, as SVR3 has learned the MAC address, R1 (Router 1) is ready to route IP packets from SVR1 to SVR2. So, it begins to route the IP packet sent by SVR1 to SVR3, with the following fields: Header Fields Ethernet Header * Destination MAC = m3, the MAC address of Receiver (SVR3) * Source MAC = a2, the MAC address of Sender (R1) IP Header * Destination IP = 2.1.1.30, the IP address of Receiver (SVR3) * Source IP = 1.1.1.10, the IP address of Sender (SVR1) • S2, having already learned the source MAC address, skips the source MAC learning and sends the packet to fe1 port, as mapped for the destination MAC address m3 in the MAC table, so that it can be delivered on to SVR3. Summary
  • Netmanias Tech-Blog: Switching and Routing for Dummies - Part 2. IP Routing 8 All devices/servers (to be referred to as servers below) are connected to other servers through switche(es) and router(s). When a server sends a packet, the server first makes a decision on whether to send the packet by Ethernet switching or IP routing. As discussed in the previous post, when a server sends a packet, it uses the MAC address of the destined device as the destination MAC address of the packet if the destination IP address (e.g. 1.1.1.20) is located within the same network that the server belongs to (e.g. 1.1.1.10). On the other hand, if the destination IP address (e.g. 2.1.1.30) is not located in the same network where the sender server (e.g. 1.1.1.10) is located as explained in this post, the sender server uses the MAC address of a gateway (e.g. 1.1.1.1), instead of the destined destination, as the destination MAC address of the packet. Here, the gateway refers to the first L3 hop that is connected to the server, i.e. router (R1). For that reason, the packet is destined to the MAC address of the router, and thus is sent to the router via Ethernet switching regardless of the switch(es) installed in between. Then, the router, after confirming the destination MAC address of the received packet matches its own, performs IP routing (also known as "forwarding") through FIB lookup. So, again the point here is: "The router performs IP routing if the destination MAC address of the received packet matches its own. If not, it simply discards it." Exceptionally, if the destination MAC address is FF:FF:FF:FF:FF:FF, then the packet is received by the control plane of the router, as the ARP Request packet is received and processed by R1 above.
  • 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. 9 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