courtesy: nick mckeown, stanford more on ip and packet forwarding tahir azim

24
Courtesy: Nick McKeown, Stanford More on IP and Packet Forwarding Tahir Azim

Upload: juniper-fields

Post on 27-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

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 addressesThe 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. www.eecs.berkeley.edu

.stanford.edu

.berkeley.edu .eecs.berkeley.edu.edu

“What is the IP address of www.eecs.berkeley.edu?”

e.g. gethostbyname()

Clientapplication

Courtesy: Nick McKeown, Stanford

An example of names and addressesMapping the path between two hosts

> host cms.niit.edu.pkcms.niit.edu.pk has address 202.125.157.200

> tracert www.berkeley.edu [traceroute or tracepath in Linux/Unix]Tracing route to arachne-lb.berkeley.edu [169.229.131.92] over a maximum of 30 hops:

1 3 ms 1 ms 24 ms 192.168.1.1 2 38 ms 49 ms 49 ms 203.99.176.1 3 40 ms 39 ms 39 ms 203.99.170.26 4 103 ms 39 ms 124 ms rwp44.pie.net.pk [202.125.148.163] 5 109 ms 57 ms 84 ms pos2-2.khi77gsrc1.pie.net.pk [202.125.159.45] 6 60 ms 59 ms 59 ms g3-0.khi77gw1.pie.net.pk [202.125.128.162] 7 206 ms 204 ms 203 ms t2a6-p9-0.uk-lon2.eu.bt.net [166.49.160.129] 8 206 ms 229 ms 209 ms t2c1-ge7-0.uk-lon2.eu.bt.net [166.49.176.43] 9 207 ms 206 ms * t2c1-p3-0.uk-glo.eu.bt.net [166.49.208.98] 10 * 205 ms 203 ms t2c1-p9-3.uk-eal.eu.bt.net [166.49.195.206] 11 292 ms 294 ms 294 ms t2c1-p5-0-0.us-ash.eu.bt.net [166.49.164.65] 12 377 ms 369 ms 367 ms eq-exch.bb-peer01.loudoun.va.ena.net [206.223.115.45] 13 446 ms 442 ms 367 ms 137.164.129.11 14 375 ms 374 ms 394 ms 137.164.129.2 15 360 ms * 417 ms te4-1--160.tr01-plalca01.transitrail.net [137.164.129.34] 16 433 ms * 359 ms calren-trcust.plalca01.transitrail.net [137.164.131.254] 17 376 ms 366 ms 357 ms ucb--svl-dc1-egm.cenic.net [137.164.23.66] 18 365 ms * 362 ms g3-17.inr-202-reccev.Berkeley.EDU [128.32.0.35] 19 365 ms 364 ms 362 ms t1-1.inr-211-srb.Berkeley.EDU [128.32.255.43] 20 363 ms 358 ms 374 ms arachne-lb.Berkeley.EDU [169.229.131.92]

Courtesy: Nick McKeown, Stanford

ExampleMapping the path between two hosts

cms.niit.edu.pk > host bbr2-rtr.stanford.edu | sort -n

bbr2-rtr.Stanford.EDU has address 128.12.1.49bbr2-rtr.Stanford.EDU has address 171.64.0.126bbr2-rtr.Stanford.EDU has address 171.64.1.133bbr2-rtr.Stanford.EDU has address 171.64.1.152bbr2-rtr.Stanford.EDU has address 171.64.1.161bbr2-rtr.Stanford.EDU has address 171.64.1.242bbr2-rtr.Stanford.EDU has address 171.64.1.26bbr2-rtr.Stanford.EDU has address 171.64.1.9bbr2-rtr.Stanford.EDU has address 171.64.1.97bbr2-rtr.Stanford.EDU has address 171.64.3.242bbr2-rtr.Stanford.EDU has address 171.64.7.60bbr2-rtr.Stanford.EDU has address 171.66.1.249bbr2-rtr.Stanford.EDU has address 171.66.16.1bbr2-rtr.Stanford.EDU has address 171.67.1.193bbr2-rtr.Stanford.EDU has address 171.67.20.1bbr2-rtr.Stanford.EDU has address 171.67.254.242bbr2-rtr.Stanford.EDU has address 171.67.255.126bbr2-rtr.Stanford.EDU has address 172.24.1.9bbr2-rtr.Stanford.EDU has address 172.27.20.1bbr2-rtr.Stanford.EDU has address 192.168.2.129bbr2-rtr.Stanford.EDU has address 192.168.7.154

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/16128.9.16/20

128.9.176/20

128.9.19/24128.9.25/24

142.12/19

65/8

Prefix Port

3227213

128.17.14.1128.17.14.1

128.17.20.1

128.17.10.1128.17.14.1

128.17.16.1

128.17.16.1

Next-hop

R1

R2

R3

R4

12

3

128.17.20.1

128.17.16.1

e.g. 128.9.16.14 => 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, ingress Link 1, egress

Link 2, ingress Link 2, egress

Link 3, ingress Link 3, egress

Link 4, ingress Link 4, egress

ChooseEgress

ChooseEgress

ChooseEgress

ChooseEgress

Courtesy: Nick McKeown, Stanford

Inside a router

Link 1, ingress Link 1, egress

Link 2, ingress Link 2, egress

Link 3, ingress Link 3, egress

Link 4, ingress Link 4, egress

ChooseEgress

ChooseEgress

ChooseEgress

ForwardingDecision

ForwardingTable

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 DecisionClass-based addressing

Class A Class B Class C D

212.17.9.4

Class A

Class B

Class C212.17.9.0 Port 4

Exact Match

Routing Table:

IP Address Space

212.17.9.0

Courtesy: Nick McKeown, Stanford

Associative Lookups“Contents addressable memory” (CAM)

NetworkAddress

PortNumber

AssociativeMemory or CAM

Search Data

32

PortNumber

Hit?

Advantages:• Simple

Disadvantages• Slow• High Power• Small• Expensive

Search data is compared with every entry in parallelAll 232 addresses are not stored

Courtesy: Nick McKeown, Stanford

Hashed Lookups

HashingFunction

Memory

Addre

ss

Data

Search Data

Port number

Hit?{1632

Courtesy: Nick McKeown, Stanford

Lookups Using HashingAn example

Hashing Function16

#1 #2 #3 #4

#1 #2

#1 #2 #3Linked list of entrieswith 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 NN entries

Binary Search Trie: (“reTRIEval”)

0 1

0 1 0 1

111010

Requires 32 memory references, regardless of number of addresses.

Courtesy: Nick McKeown, Stanford

Search TriesMultiway tries reduce the number of memory references

16-ary Search Trie

0000, ptr 1111, ptr

0000, 0 1111, ptr

000011110000

0000, 0 1111, ptr

111111111111

Question: Why not just keep increasing the degree of the trie?

Courtesy: Nick McKeown, Stanford

Classless AddressingCIDR

0 232-1

128.9/16

128.9.16.14

128.9.16/20128.9.176/20

128.9.19/24

128.9.25/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

10.1.1.32 1

10.1.1.0 2

10.1.3.0 3

10.1.0.0 4

255.255.255.255

255.255.255.0

255.255.255.0

255.255.0.0

255.0.0.010.0.0.0 4

Value Mask

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) 00001b) 00010c) 00011d) 001e) 0101f) 011g) 10h) 1010i) 111j) 111100

e

f

g

h

i

j

0 1

a b c

d

kk) 11110001

Courtesy: Nick McKeown, Stanford

Lookup Performance Required

Line Line Rate Pkt size=40B Pkt size=240B

T1 1.5Mbps 4.68 Kpps 0.78 Kpps

OC3 155Mbps 480 Kpps 80 Kpps

OC12 622Mbps 1.94 Mpps 323 Kpps

OC48 2.5Gbps 7.81 Mpps 1.3 Mpps

OC192 10 Gbps 31.25 Mpps 5.21 Mpps

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