Computer Networking Routers Forwarding Vs. Routing Outline
Total Page:16
File Type:pdf, Size:1020Kb
Routers • How do routers process IP packets • How do you build a router 15-744: Computer Networking • Assigned reading • [P+98] A 50 Gb/s IP Router • [D+97] Small Forwarding Tables for Fast Routing Lookups L-4 Routers © Srinivasan Seshan, 2001 L -4; 1-24 -01 2 Forwarding vs. Routing Outline • Forwarding: the process of moving packets from • Alternative methods for packet forwarding input to output • The forwarding table • IP packet routing • Information in the packet • Routing: process by which the forwarding table is • Variable prefix match built and maintained • One or more routing protocols • Procedures (algorithms) to convert routing info to • IP router design forwarding table. • Routing protocols – distance vector © Srinivasan Seshan, 2001 L -4; 1-24 -01 3 © Srinivasan Seshan, 2001 L -4; 1-24 -01 4 Techniques for Forwarding Packets Source Routing • Source routing • List entire path in packet • Packet carries path • Driving directions (north 3 hops, east, etc..) • Table of virtual circuits • Router processing • Connection routed through network to setup • Examine first step in directions state • Strip first step from packet • Packets forwarded using connection state • Forward to step just stripped off • Table of global addresses (IP) • Routers keep next hop for destination • Packets carry destination address © Srinivasan Seshan, 2001 L -4; 1-24 -01 5 © Srinivasan Seshan, 2001 L -4; 1-24 -01 6 1 Source Routing Example Source Routing • Advantages • Switches can be very simple and fast • Disadvantages Packet 3,4,3 4,3 2 2 Sender R1 R1 • Variable (unbounded) header size 1 3 1 3 4 4 • Sources must know or discover topology (e.g., 3 failures) 2 1 R2 Receiver 3 • Typical use 4 • Ad-hoc networks (DSR) • Machine room networks (Myrinet) © Srinivasan Seshan, 2001 L -4; 1-24 -01 7 © Srinivasan Seshan, 2001 L -4; 1-24 -01 8 Virtual Circuits/Tag Switching Virtual Circuits Examples • Connection setup phase • Use other means to route setup request • Each router allocates flow ID on local link • Creates mapping of inbound flow ID/port to outbound Packet 5 7 flow ID/port 2 2 Sender R1 R1 1,7 à 4,2 1 3 1 3 • Each packet carries connection ID 4 4 st • Sent from source with 1 hop connection ID 1,5 à 3,7 2 • Router processing 2 1 R2 Receiver 3 • Lookup flow ID – simple table lookup 4 6 • Replace flow ID with outgoing flow ID 2,2 à 3,6 • Forward to output port © Srinivasan Seshan, 2001 L -4; 1-24 -01 9 © Srinivasan Seshan, 2001 L -4; 1-24 -01 10 Virtual Circuits IP Datagrams on Virtual Circuits • Advantages • Challenge – when to setup connections • More efficient lookup (simple table lookup) • At bootup time – permanent virtual circuits • More flexible (different path for each flow) (PVC) • Can reserve bandwidth at connection setup • Easier for hardware implementations • Large number of circuits • Disadvantages • For every packet transmission • Still need to route connection setup request • Connection setup is expensive • More complex failure recovery – must recreate • For every connection connection state • What is a connection? • Typical uses • How to route connectionless traffic? • ATM – combined with fix sized cells • MPLS – tag switching for IP networks © Srinivasan Seshan, 2001 L -4; 1-24 -01 11 © Srinivasan Seshan, 2001 L -4; 1-24 -01 12 2 IP Datagrams on Virtual Circuits Global Addresses (IP) • Traffic pattern • Each packet has destination address • Few long lived flows • Each switch has forwarding table of • Flow – set of data packets from source to destination à next hop destination • At v and x: destination à east • Large percentage of packet traffic • At w and y: destination à south • Improving forwarding performance by using • At z: destination à north virtual circuits for these flows • Distributed routing algorithm for calculating • Other traffic uses normal IP forwarding forwarding tables © Srinivasan Seshan, 2001 L -4; 1-24 -01 13 © Srinivasan Seshan, 2001 L -4; 1-24 -01 14 Global Address Example Router Table Size • One entry for every host on the Internet • 100M entries,doubling every year • One entry for every LAN Packet R R 2 2 Sender R1 R1 R à 4 • Every host on LAN shares prefix 1 3 1 3 4 4 • Still too many, doubling every year R à 3 R 2 • One entry for every organization 1 R2 Receiver 3 4 R • Every host in organization shares prefix R à 3 • Requires careful address allocation © Srinivasan Seshan, 2001 L -4; 1-24 -01 15 © Srinivasan Seshan, 2001 L -4; 1-24 -01 16 Outline Original IP Route Lookup • Alternative methods for packet forwarding • Address classes • A: 0 | 7 bit network | 24 bit host (16M each) • IP packet routing • B: 10 | 14 bit network | 16 bit host (64K) • C: 110 | 21 bit network | 8 bit host (255) • Variable prefix match • Address would specify prefix for forwarding table • IP router design • Simple lookup • Routing protocols – distance vector © Srinivasan Seshan, 2001 L -4; 1-24 -01 17 © Srinivasan Seshan, 2001 L -4; 1-24 -01 18 3 Original IP Route Lookup – Example CIDR Revisited • www.cmu.edu address 128.2.11.43 • Supernets • Class B address – class + network is 128.2 • Assign adjacent net addresses to same org • Lookup 128.2 in forwarding table • Classless routing (CIDR) • Prefix – part of address that really matters for routing • How does this help routing table? • Forwarding table contains • Combine routing table entries whenever all nodes with same prefix share same hop • List of class+network entries • A few fixed prefix lengths (8/16/24) • Large tables • 2 Million class C networks © Srinivasan Seshan, 2001 L -4; 1-24 -01 19 © Srinivasan Seshan, 2001 L -4; 1-24 -01 20 CIDR Example CIDR Illustration • Network provide is allocated 8 class C chunks, 201.10.0.0 to 201.10.7.255 Provider is given 201.10.0.0/21 • Allocation uses 3 bits of class C space • Remaining 21 bits are network number, written Provider as 201.10.0.0/21 • Replaces 8 class C routing entries with 1 combined entry 201.10.0.0/22 201.10.4.0/24 201.10.5.0/24 201.10.6.0/23 • Routing protocols carry prefix with destination network address • Longest prefix match for forwarding © Srinivasan Seshan, 2001 L -4; 1-24 -01 21 © Srinivasan Seshan, 2001 L -4; 1-24 -01 22 CIDR Shortcomings Routing to the Network • Multi-homing • Packet to 10.1.1.2 • Customer selecting a new provider 10.1.1.4 10.1.1.3 10.1.1.3 arrives H1 H2 • Path is R2 – R1 – 10.1.1/24 10.1.0.2 10.1.0.1 10.1.1.1 R1 H3 H1 – H2 10.1.2.2 201.10.0.0/21 10.1.0/24 Provider 1 Provider 2 10.1.2/23 10.1/16 10.1.8/24 Provider R2 10.1.8.1 10.1.2.1 10.1.16.1 H4 10.1.8.4 201.10.0.0/22 201.10.4.0/24 201.10.5.0/24 201.10.6.0/23 or Provider 2 address © Srinivasan Seshan, 2001 L -4; 1-24 -01 23 © Srinivasan Seshan, 2001 L -4; 1-24 -01 24 4 Routing Within the Subnet Routing Within the Subnet 10.1.1.2 10.1.1.2 • Packet to 10.1.1.3 10.1.1.4 10.1.1.3 • Packet to 10.1.1.3 10.1.1.4 10.1.1.3 • Matches 10.1.0.0/23 H1 H2 • Matches 10.1.1.1/31 H1 H2 10.1.1/24 10.1.1/24 10.1.0.2 10.1.0.2 Routing table at R2 10.1.0.1 • Longest prefix match 10.1.0.1 10.1.1.1 R1 H3 10.1.1.1 R1 H3 10.1.2.2 10.1.2.2 Destination Next Hop Interface Routing table at R1 10.1.0/24 10.1.0/24 127.0.0.1 127.0.0.1 lo0 Destination Next Hop Interface 10.1.2/23 127.0.0.1 127.0.0.1 lo0 10.1.2/23 Default or 0/0 provider 10.1.16.1 10.1/16 10.1.8/24 10.1/16 10.1.8/24 R2 R2 10.1.8.0/24 10.1.8.1 10.1.8.1 Default or 0/0 10.1.2.1 10.1.2.2 10.1.8.1 10.1.8.1 10.1.2.0/23 10.1.2.1 10.1.2.1 10.1.2.1 10.1.0.0/24 10.1.0.1 10.1.0.1 10.1.2.1 10.1.16.1 H4 10.1.16.1 H4 10.1.1.0/24 10.1.1.1 10.1.1.4 10.1.0.0/23 10.1.2.2 10.1.2.1 10.1.8.4 10.1.8.4 10.1.2.0/23 10.1.2.2 10.1.2.2 10.1.1.2/31 10.1.1.2 10.1.1.2 © Srinivasan Seshan, 2001 L -4; 1-24 -01 25 © Srinivasan Seshan, 2001 L -4; 1-24 -01 26 Routing Within the Subnet Global Addresses • Advantages 10.1.1.2 • Packet to 10.1.1.3 10.1.1.4 10.1.1.3 • Stateless – simple error recovery • Direct route H1 H2 10.1.1/24 • Disadvantages 10.1.0.2 • Longest prefix match 10.1.0.1 • Every switch knows about every destination 10.1.1.1 R1 H3 10.1.2.2 Routing table at H1 10.1.0/24 • Potentially large tables Destination Next Hop Interface 10.1.2/23 • All packets to destination take same route 127.0.0.1 127.0.0.1 lo0 10.1/16 10.1.8/24 R2 Default or 0/0 10.1.1.1 10.1.1.2 10.1.8.1 10.1.2.1 10.1.1.0/24 10.1.1.2 10.1.1.1 10.1.16.1 H4 10.1.1.3/31 10.1.1.2 10.1.1.2 10.1.8.4 © Srinivasan Seshan, 2001 L -4; 1-24 -01 27 © Srinivasan Seshan, 2001 L -4; 1-24 -01 28 Comparison How do we set up Routing Tables? • Graph theory to compute “shortest path” Source Routing Global Addresses Virtual Circuits • Switches = nodes Header Size Worst OK – Large address Best • Links = edges Number of hosts Router Table Size None Number of circuits • Delay, hops = cost (prefixes) Forward Overhead Best Prefix matching Pretty Good • Need to adapt to changes in topology Setup Overhead None None Connection Setup Tell all routers and Error Recovery Tell all hosts Tell all routers Tear down circuit and re-route © Srinivasan Seshan, 2001 L -4; 1-24 -01 29 © Srinivasan Seshan, 2001 L -4; 1-24 -01 30 5 Outline How To Do Variable Prefix Match • Alternative methods for packet forwarding • Traditional method – Patricia Tree • Arrange route entries into a series of bit tests • IP packet routing • Worst case = 32 bit tests • Problem: memory speed is a bottleneck • Variable prefix match 0 Bit to test – 0 = left child,1 = right child 10 • IP router design default 0/0 16 128.2/16 19 • Routing protocols – distance vector 128.32/16 128.32.130/240 128.32.150/24 © Srinivasan Seshan, 2001 L -4; 1-24 -01 31 © Srinivasan Seshan, 2001 L -4; 1-24 -01 32 Speeding up Prefix Match (P+98) Prefix