Courtesy: Nick McKeown, Stanford More on IP and Packet Forwarding Tahir Azim
Courtesy: Nick McKeown, Stanford Mapping Computer Names to IP addresses The Domain Naming System (DNS) Names are hierarchical and belong to a domain: –e.g. elaine17.stanford.edu –Common domain names:.com,.edu,.gov,.org,.net,.uk (or other country-specific domain). –Top-level names are assigned by the Internet Corporation for Assigned Names and Numbers (ICANN). –A unique name is assigned to each organization. DNS Client-Server Model –DNS maintains a hierarchical, distributed database of names. –Servers are arranged in a hierarchy. –Each domain has a “root” server. –An application needing an IP address is a DNS client.
Courtesy: Nick McKeown, Stanford Mapping Computer Names to IP addresses The Domain Naming System (DNS) A DNS Query 1.Client asks local server. 2.If local server does not have address, it asks a set of other designated servers. 3.If none of the designated servers have the address, the local server asks the root server of the requested domain. 4.Addresses are cached in case they are requested again. E.g. “What is the IP address of e.g. gethostbyname() Client application
Courtesy: Nick McKeown, Stanford An example of names and addresses Mapping the path between two hosts > host cms.niit.edu.pk cms.niit.edu.pk has address > tracert [traceroute or tracepath in Linux/Unix] Tracing route to arachne-lb.berkeley.edu [ ] over a maximum of 30 hops: 1 3 ms 1 ms 24 ms ms 49 ms 49 ms ms 39 ms 39 ms ms 39 ms 124 ms rwp44.pie.net.pk [ ] ms 57 ms 84 ms pos2-2.khi77gsrc1.pie.net.pk [ ] 6 60 ms 59 ms 59 ms g3-0.khi77gw1.pie.net.pk [ ] ms 204 ms 203 ms t2a6-p9-0.uk-lon2.eu.bt.net [ ] ms 229 ms 209 ms t2c1-ge7-0.uk-lon2.eu.bt.net [ ] ms 206 ms * t2c1-p3-0.uk-glo.eu.bt.net [ ] 10 * 205 ms 203 ms t2c1-p9-3.uk-eal.eu.bt.net [ ] ms 294 ms 294 ms t2c1-p5-0-0.us-ash.eu.bt.net [ ] ms 369 ms 367 ms eq-exch.bb-peer01.loudoun.va.ena.net [ ] ms 442 ms 367 ms ms 374 ms 394 ms ms * 417 ms te tr01-plalca01.transitrail.net [ ] ms * 359 ms calren-trcust.plalca01.transitrail.net [ ] ms 366 ms 357 ms ucb--svl-dc1-egm.cenic.net [ ] ms * 362 ms g3-17.inr-202-reccev.Berkeley.EDU [ ] ms 364 ms 362 ms t1-1.inr-211-srb.Berkeley.EDU [ ] ms 358 ms 374 ms arachne-lb.Berkeley.EDU [ ]
Courtesy: Nick McKeown, Stanford Example Mapping the path between two hosts cms.niit.edu.pk > host bbr2-rtr.stanford.edu | sort -n bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address bbr2-rtr.Stanford.EDU has address
Courtesy: Nick McKeown, Stanford An aside: Error Reporting (ICMP) and traceroute Internet Control Message Protocol: –Used by a router/end-host to report some types of error: –E.g. Destination Unreachable: packet can’t be forwarded to/towards its destination. –E.g. Time Exceeded: TTL reached zero, or fragment didn’t arrive in time. Traceroute uses this error to its advantage. –An ICMP message is an IP datagram, and is sent back to the source of the packet that caused the error.
Courtesy: Nick McKeown, Stanford How a Router Forwards Datagrams Every datagram contains a destination address. The router determines the prefix to which the address belongs, and routes it to the“Network ID” that uniquely identifies a physical network. All hosts and routers sharing a Network ID share same physical network.
Courtesy: Nick McKeown, Stanford How a Router Forwards Datagrams 128.9/ / / / / /19 65/8 PrefixPort Next-hop R1 R2 R3 R e.g => Port 2 Forwarding/routing table
Courtesy: Nick McKeown, Stanford Forwarding Datagrams Is the datagram for a host on a directly attached network? If no, consult forwarding table to find next-hop.
Courtesy: Nick McKeown, Stanford Inside a router Link 1, ingressLink 1, egress Link 2, ingressLink 2, egress Link 3, ingressLink 3, egress Link 4, ingressLink 4, egress Choose Egress Choose Egress Choose Egress Choose Egress
Courtesy: Nick McKeown, Stanford Inside a router Link 1, ingressLink 1, egress Link 2, ingressLink 2, egress Link 3, ingressLink 3, egress Link 4, ingressLink 4, egress Choose Egress Choose Egress Choose Egress Forwarding Decision Forwarding Table
Courtesy: Nick McKeown, Stanford Forwarding in an IP Router Lookup packet DA in forwarding table. –If known, forward to correct port. –If unknown, either (i)drop packet, or (ii)forward to some default port Decrement TTL, update header Checksum. Forward packet to outgoing interface. Transmit packet onto link. Question: How is the address looked up in a real router?
Courtesy: Nick McKeown, Stanford Making a Forwarding Decision Class-based addressing Class AClass BClass CD Class A Class B Class C Port 4 Exact Match Routing Table: IP Address Space
Courtesy: Nick McKeown, Stanford Associative Lookups “Contents addressable memory” (CAM) Network Address Port Number Associative Memory or CAM Search Data 32 Port Number Hit? Advantages: Simple Disadvantages Slow High Power Small Expensive Search data is compared with every entry in parallel All 2 32 addresses are not stored
Courtesy: Nick McKeown, Stanford Hashed Lookups Hashing Function Memory Address Data Search Data Port number Hit? { 16 32
Courtesy: Nick McKeown, Stanford Lookups Using Hashing An example Hashing Function 16 #1#2#3#4 #1#2 #1#2#3 Linked list of entries with same hash key. Memory Search Data Port number Hit? 32
Courtesy: Nick McKeown, Stanford Lookups Using Hashing Advantages: Simple Expected lookup time can be small Disadvantages Non-deterministic lookup time Inefficient use of memory
Courtesy: Nick McKeown, Stanford Trees and Tries Binary Search Tree: <> <><> log 2 N N entries Binary Search Trie: (“reTRIEval”) Requires 32 memory references, regardless of number of addresses.
Courtesy: Nick McKeown, Stanford Search Tries Multiway tries reduce the number of memory references 16-ary Search Trie 0000, ptr1111, ptr 0000, 01111, ptr , , ptr Question: Why not just keep increasing the degree of the trie?
Courtesy: Nick McKeown, Stanford Classless Addressing CIDR / / / / /24 Most specific route = “longest matching prefix” Question: How can we look up addresses if they are not an exact match?
Courtesy: Nick McKeown, Stanford Ternary CAMs ValueMask Priority Encoder Port Associative Memory Port Note: Most specific routes appear closest to top of table Ternary CAM allows a third matching state of "X" or "Don't Care" for one or more bits in the stored dataword For example, a ternary CAM might have a stored word of "10XX0" which will match any of the four search words "10000", "10010", "10100", or "10110".
Courtesy: Nick McKeown, Stanford Longest prefix matches using Binary Tries Example Prefixes: a) b) c) d) 001 e) 0101 f) 011 g) 10 h) 1010 i) 111 j) e f g h i j 01 a bc d k k)
Courtesy: Nick McKeown, Stanford Lookup Performance Required LineLine RatePktsize=40BPktsize=240B T11.5Mbps4.68Kpps0.78Kpps OC3155Mbps480Kpps80Kpps OC12622Mbps1.94Mpps323Kpps OC482.5Gbps7.81Mpps1.3Mpps OC19210Gbps31.25Mpps5.21Mpps
Courtesy: Nick McKeown, Stanford Discussion Why was the Internet Protocol designed this way? –Why connectionless, datagram, best-effort? –Why not automatic retransmissions? –Why fragmentation in the network? Must the Internet address be hierarchical? What address does a mobile host have? Are there other ways to design networks? Google: Clean Slate Internet Design