cps-356- computer networks class 8: ip forwarding+ routing theophilus benson based partly on lecture...
TRANSCRIPT
![Page 1: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/1.jpg)
CPS-356- Computer NetworksClass 8: IP Forwarding+ Routing
Theophilus Benson
Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis, John Jannotti
![Page 2: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/2.jpg)
Admini-strivia
• Midterm 1:– Day after UNC game: New proposed dates:• 02/24/2015
• HW #1: Going Up Tomorrow on Website (due in a week 02/12/2015)
![Page 3: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/3.jpg)
Today’s Lecture
• Forwarding– IP-Address/IP-Packet Format– Fragmentation– Debugging the network: ICMP– Getting IP-Address: ARP + DHCP
• Routing– Intra-Domain Routing– Distance Vector Protocol• Loop Detection + Avoidance
![Page 4: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/4.jpg)
Format of IP Addresses
Classed Addresses• Pros
– Very simple to use and implement– Allows for hierarchical routing– Use first 3 bits to determine
addresses class (A, B, C)– Based on class you know what
bits to ignore
• Cons– Wasteful allocation– Statically specify network and
host portion of address
CIDR Addresses• Pros
– Efficient allocation of resources
– dynamically specify network and host portion of address
• Cons– More complex to implement
in hardware
![Page 5: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/5.jpg)
Format of IP AddressesClassed Addresses (Static partitioning of Network/host portions)
• Class A (8-bit prefix), B (16-bit), C (24-bit)
CIDR(Dynamic partitioning of Network/hosts portions)
128.23.92.12
10000000
128.23.16.12/31
Specifies the prefix size: the number of bits in the network portion (NetMask)
11111111.11111111.11111111.11111110
10000000.00010111.00010000.00001100
Prefix size = 31 bitsHost size = 1 bit32-31=1Only 2^1 hosts in the network
![Page 6: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/6.jpg)
Other CIDR Examples
128.23.16.12/32
11111111.11111111.11111111.00000000
10000000.00010111.00010000.00001100
128.23.16.12/24
11111111.11111111.11111111.11111111
10000000.00010111.00010000.00001100
Prefix size = 32 bitsHost size = 0 bit32-32=0Only 2^0 hosts in the network
Prefix size = 24 bitsHost size = 8 bits32 – 24 = 8Only 2^8 hosts in the network
![Page 7: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/7.jpg)
Where Does IP-Address Fit Into a packet?
Ethernet
IP
Destination MAC AddressSource MAC Address
Length
Destination IP AddressSource IP Address
Type
Options Padding
TTL Protocol Hdr checksum
V Total Length
FragV TOS
Identification MMM
Src PortSeq Number
Offset Reserved
Dst Port
Ack NumberWindow
Data (Payload)
![Page 8: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/8.jpg)
IP v4 packet format
Destination IP Address
Source IP Address
Options
Total LengthTOS
Identification
Hdr lenvers
TTL Protocol Hdr Checksum
Padding
Fragment Offset
• Forward based on destination address
![Page 9: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/9.jpg)
IP v4 packet format
Destination IP Address
Source IP Address
Options
Total LengthTOS
Identification
Hdr lenvers
TTL Protocol Hdr Checksum
Padding
Fragment Offset
• Forward based on destination address
• TTL = Time to Live• Prevents forwarding loops• Decremented at each hop
![Page 10: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/10.jpg)
IP v4 packet format
Destination IP Address
Source IP Address
Options
Total LengthTOS
Identification
Hdr lenvers
TTL Protocol Hdr Checksum
Padding
Fragment Offset
• Forward based on destination address
• TTL = Time to Live• Prevents forwarding loops• Decremented at each hop
• Cut large packets into smaller ones• E.g. from Ethernet to ATM• From 1500B to 64B• MF: more fragments• DF: don’t fragment (return
an error to the sender)
MFDF
![Page 11: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/11.jpg)
IP v4 packet format
Destination IP Address
Source IP Address
Options
Total LengthTOS
Identification
Hdr lenvers
TTL Protocol Hdr Checksum
Padding
Fragment Offset
• Forward based on destination address
• TTL = Time to Live• Prevents forwarding loops• Decremented at each hop
• Cut large packets into smaller ones• E.g. from Ethernet to ATM• From 1500B to 64B• MF: more fragments• DF: don’t fragment (return
an error to the sender)• Version = IPv4 or IPv6
MFDF
![Page 12: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/12.jpg)
IP v4 packet format
Destination IP Address
Source IP Address
Options
Total LengthTOS
Identification
Hdr lenvers
TTL Protocol Hdr Checksum
Padding
Fragment Offset
• Forward based on destination address
• TTL = Time to Live• Prevents forwarding loops• Decremented at each hop
• Cut large packets into smaller ones• E.g. from Ethernet to ATM• From 1500B to 64B• MF: more fragments• DF: don’t fragment (return
an error to the sender)• Version = IPv4 or IPv6• Protocol = TCP/UDP?
![Page 13: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/13.jpg)
IP v4 packet format
Destination IP Address
Source IP Address
Options
Total LengthTOS
Identification
Hdr lenvers
TTL Protocol Hdr Checksum
Padding
Fragment Offset
• Forward based on destination address
• TTL = Time to Live• Prevents forwarding loops• Decremented at each hop
• Cut large packets into smaller ones• E.g. from Ethernet to ATM• From 1500B to 64B• MF: more fragments• DF: don’t fragment (return
an error to the sender)• Version = IPv4 or IPv6• Protocol = TCP/UDP?
Header length == size of the header, which can vary because you can have an arbitrary number of optionsTotal length == length of header + payload
![Page 14: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/14.jpg)
Today’s Lecture
• Forwarding– IP-Address/IP-Packet Format– Fragmentation– Network Error Messages (Debugging): ICMP– Getting IP-Address: ARP + DHCP
• Routing– Intra-Domain Routing: RIP
![Page 15: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/15.jpg)
Why Do you need to Fragment Packets?
• Different networks have different MTUs.– Router may need to fragment packets to allow
them to cross different mediums
Le Theo Net (ATM)
DukeNet(Ethernet)
ATT(Ethernet)
MTU=1500 MTU=1500MTU=64
![Page 16: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/16.jpg)
Implication of Fragmentation
• If a fragment is lost, must retransmit the whole packet!!! Why?
• Fragmentation delays reassembly of packet until all fragments are received
• Some people avoid fragmentation!!!!
![Page 17: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/17.jpg)
What do Fragmented Packets look like?
• Use ‘identification’, ‘fragment offset’ and ‘MF’ bit in IP header– Set the ‘MF’ bit– Use the same ‘Id’ for all fragments– Offset present position in original packet
1400 Bytes
Rest of header
Start of header
0213 0 512 bytes
Rest of header
Start of header
0213 1
512 bytes
Rest of header
Start of header
64213 1
376 bytes
Rest of header
Start of header
128213 0
![Page 18: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/18.jpg)
Internet Control Message Protocol (ICMP)
• Echo (ping)• Redirect• Destination unreachable (protocol, port, or host)• TTL exceeded• Checksum failed• Reassembly failed• Can’t fragment• Many ICMP messages include part of packet that
triggered them• See
http://www.iana.org/assignments/icmp-parameters
![Page 19: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/19.jpg)
ICMP message format
![Page 20: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/20.jpg)
Example: Time Exceeded
• Code usually 0 (TTL exceeded in transit)• Discussion: traceroute
![Page 21: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/21.jpg)
Example: Can’t Fragment
• Sent if DF=1 and packet length > MTU• What can you use this for?• Path MTU Discovery– Can do binary search on packet sizes– But better: base algorithm on most common
MTUs
![Page 22: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/22.jpg)
Today’s Lecture
• Forwarding– IP-Address/IP-Packet Format– Fragmentation– Debugging the network: ICMP– Getting IP-Address: ARP + DHCP
• Routing– Intra-Domain Routing: RIP
![Page 23: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/23.jpg)
How do you Make a Packet
Ethernet
IP
Destination MAC AddressSource MAC Address
Length
Destination IP Address
Source IP Address
Type
Options Padding
TTL Protocol Hdr checksum
V Total Length
FragV TOS
Identification MMM
Src PortSeq Number
Offset Reserved
Dst Port
Ack NumberWindow
Data (Payload)
Comes with your hardware
???????
DNS gives this to you
![Page 24: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/24.jpg)
Obtaining Host IP Addresses - DHCP
• Address must be assigned to each host by his network.– Manually: Tedious and error-prone: – Automatically: Dynamic Host Configuration Protocol• Client: DHCP Discover to 255.255.255.255 (broadcast)• Server(s): DHCP Offer to 255.255.255.255 (why
broadcast?)• Client: choose offer, DHCP Request (broadcast, why?)• Server: DHCP ACK (again broadcast)
• Result: IP-address, gateway, netmask, DNS server
![Page 25: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/25.jpg)
How do you Make a Packet
Ethernet
IP
Destination MAC AddressSource MAC Address
Length
Destination IP Address
Source IP Address
Type
Options Padding
TTL Protocol Hdr checksum
V Total Length
FragV TOS
Identification MMM
Src PortSeq Number
Offset Reserved
Dst Port
Ack NumberWindow
Data (Payload)
Comes with your hardware
???????
DNS gives this to you
DHCP
![Page 26: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/26.jpg)
What is the Destination Address?
• If dest. is in your network (e.g. Alice to Bob)– Then use the Destination’s Ethernet address.
• If dest. is not in your network (e.g Alice to Google)– Then use the gateway router’s Ethernet address.– The destination may use a different protocol
Le Theo Net (ATM)
DukeNet(Ethernet)
Alice
Bob
Ethernet
Ethernet
ATMATMEthernet
![Page 27: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/27.jpg)
How do you find this destination address?
• Check local ARP table– If found use it. (DONE!)– Start sending packets!
DukeNet(Ethernet)
Alice
Bob
Ethernet
Ethernet
ATMEthernet
![Page 28: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/28.jpg)
How do you find this destination address?
• Check local ARP table– If found use it. (DONE!)
• Compare my IP with dest IP– In same network?
• Then ARP request for Dest IP
– In different Networks?• Then ARP request for Router IP
Alice: 128.23.16.12/30
Google: 128.16.16.16Bob: 128.23.16.14
DukeNet:128.23.16.12/30 4 addresses128.23.16.12– 128.23.16.16
Alice->Bob: same networkAlice->Google: diff network
![Page 29: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/29.jpg)
How do you find this destination address?
Alice: 128.23.16.12/30
Google: 128.16.16.16Bob: 128.23.16.14
DukeNet:128.23.16.12/30 4 addresses128.23.16.12– 128.23.16.16
Alice->Bob: same networkAlice->Google: diff network
DukeNet(Ethernet)
Alice
Bob
Ethernet
Ethernet
ATMEthernet
![Page 30: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/30.jpg)
How ARP works.
DukeNet(Ethernet)
Alice
Bob
Ethernet
Ethernet
ATMEthernet
I am:128.23.16.12Who is IP: 128.23.16.14
![Page 31: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/31.jpg)
How ARP works.
DukeNet(Ethernet)
Alice
Bob
Ethernet
Ethernet
ATMEthernet
I am:128.23.16.12Who is IP: 128.23.16.14
Now I know who:128.23.16.12 is!
Now I know who:128.23.16.12 is!
![Page 32: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/32.jpg)
How ARP works.
DukeNet(Ethernet)
Alice
Bob
Ethernet
Ethernet
ATMEthernet
Now I know who:128.23.16.14 is!
I am:128.23.16.14MacAdd: 02………..
Now I know who:
128.23.16.14 is!
![Page 33: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/33.jpg)
ARP Ethernet frame format
• Why include source hardware address?
![Page 34: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/34.jpg)
How do you Make a Packet
Ethernet
IP
Destination MAC AddressSource MAC Address
Length
Destination IP Address
Source IP Address
Type
Options Padding
TTL Protocol Hdr checksum
V Total Length
FragV TOS
Identification MMM
Src PortSeq Number
Offset Reserved
Dst Port
Ack NumberWindow
Data (Payload)
Comes with your hardware
ARP
DNS gives this to you
DHCP
![Page 35: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/35.jpg)
Today’s Lecture
• Forwarding– IP-Address/IP-Packet Format– Fragmentation– Debugging the network: ICMP– Getting IP-Address: ARP + DHCP
• Routing– Intra-Domain Routing– Distance Vector Protocol• Loop Detection + Avoidance
![Page 36: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/36.jpg)
Routing• Routing is the process of updating forwarding
tables– Routers exchange messages about routers or
networks they can reach– Goal: find optimal route for every destination– … or maybe a good route, or any route (depending
on scale)• Challenges– Dynamic topology– Decentralized – Scale
![Page 37: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/37.jpg)
Scaling Issues• Every router must be able to forward based on
any destination IP address– Given address, it needs to know next hop– Naïve: one entry per address– There would be 108 entries!
• Solutions– Hierarchy (many examples)– Address aggregation
• Address allocation is very important (should mirror topology)
– Default routes
![Page 38: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/38.jpg)
IP Connectivity
• For each destination address, must either:– Have prefix mapped to next hop in forwarding table– Know “smarter router” – default for unknown
prefixes• Route using longest prefix match, default is
prefix 0.0.0.0/0• Core routers know everything – no default• Manage using notion of Autonomous System
(AS)
![Page 39: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/39.jpg)
Internet structure, 1990
• Several independent organizations• Hierarchical structure with single
backbone
![Page 40: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/40.jpg)
Internet structure, today
• Multiple backbones, more arbitrary structure
![Page 41: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/41.jpg)
Autonomous Systems
• Correspond to an administrative domain– AS’s reflect organization of the Internet– E.g., DukeNet, large company, etc.– Identified by a 16-bit number
• AS are also called ISP– ISP = Internet Service Providers
![Page 42: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/42.jpg)
Le Theo Net
DukeNet ATT
• AS’s choose their own local routing algorithm• How should A,B,C,D do routing?
• AS’s want to set policies about non-local routing• Should DukeNet use Link 1 or 2 to ATT?
• AS’s need not reveal internal topology of their network• That Duke Net has 4 routers
A
DC
B
Lnk 1
Lnk2
![Page 43: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/43.jpg)
Inter and Intra-domain routing• Routing organized in two levels• Intra-domain routing
– Complete knowledge, strive for optimal paths– Scale to ~100 networks– Today
• Inter-domain routing– Aggregated knowledge, scale to Internet– Dominated by policy
• E.g., route through X, unless X is unavailable, then route through Y. Never route traffic from X to Y.
– Policies reflect business agreements, can get complex– Next lecture
![Page 44: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/44.jpg)
Le Theo Net
DukeNet ATTA
DC
B
Lnk 1
Lnk2
Intradomain:Routing inside DukeNET
Interdomain:Routing across DukeNet, ATT, TheoNet
![Page 45: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/45.jpg)
Today’s Lecture
• Forwarding– IP-Address/IP-Packet Format– Fragmentation– Debugging the network: ICMP– Getting IP-Address: ARP + DHCP
• Routing– Intra-Domain Routing– Distance Vector Protocol• Loop Detection + Avoidance
![Page 46: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/46.jpg)
Network as a graph
• Nodes are routers• Assign cost to each edge– Can be based on latency, b/w, queue length, …
• Problem: find lowest-cost path between nodes– Each node individually computes routes
![Page 47: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/47.jpg)
Basic Algorithms
• Two classes of intra-domain routing algorithms• Distance Vector (Bellman-Ford SP Algorithm)– Requires only local state– Harder to debug– Can suffer from loops
• Link State (Djikstra-Prim SP Algorithm)– Each node has global view of the network– Simpler to debug– Requires global state
![Page 48: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/48.jpg)
Distance Vector• Local routing algorithm• Each node maintains a set of triples– <Destination, Cost, NextHop>
• Exchange updates with neighbors– Periodically (seconds to minutes)– Whenever table changes (triggered update)
• Each update is a list of pairs– <Destination, Cost>
• Update local table if receive a “better” route– Smaller cost
• Refresh existing routes, delete if time out
![Page 49: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/49.jpg)
DV Example
B only exchanges information with A
and C
![Page 50: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/50.jpg)
Distance Vector• Local routing algorithm• Each node maintains a set of triples– <Destination, Cost, NextHop>
• Exchange updates with neighbors– Periodically (seconds to minutes)– Whenever table changes (triggered update)
• Each update is a list of pairs– <Destination, Cost>
• Update local table if receive a “better” route– Smaller cost
• Refresh existing routes, delete if time out
![Page 51: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/51.jpg)
DV ExampleB only exchanges information with A
and C
Destination Cost Next Hop
A 1 A
C 1 C
D infinity --
E infinity --
F infinity --
G infinity --
B’s routing table@ time = 0D, 1
A, 1
![Page 52: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/52.jpg)
DV ExampleB only exchanges information with A
and C
Destination Cost Next Hop
A 1 A
C 1 C
D 2 C
E infinity --
F infinity --
G infinity --
B’s routing table@ time = 0
D, 1A, 1
![Page 53: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/53.jpg)
Distance Vector• Local routing algorithm• Each node maintains a set of triples– <Destination, Cost, NextHop>
• Exchange updates with neighbors– Periodically (seconds to minutes)– Whenever table changes (triggered update)
• Each update is a list of pairs– <Destination, Cost>
• Update local table if receive a “better” route– Smaller cost
• Refresh existing routes, delete if time out
![Page 54: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/54.jpg)
Calculating the best path• Bellman-Ford equation• Let:
– Db(d) denote the current best distance from b to d– C(b,c) denote the cost of a link from a to b
• Then Db(d) = mind(Db(d) , c(b,c) + Dc(d))• Routing messages contain D• D is any additive metric
– e.g, number of hops, queue length, delay– log can convert multiplicative metric into an additive one
(e.g., probability of failure)
C’s updateD, 1A, 1
Destination Cost Next Hop
A 1 A
C 1 C
D infinity --
E infinite --
F infinite --
G infinite --
Db(d) = mind(infinity, 1 + 1)
Db(A) = minA(1, 1 + 1)
![Page 55: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/55.jpg)
Calculating the best path• Bellman-Ford equation• Let:
– Db(d) denote the current best distance from b to d– C(b,c) denote the cost of a link from a to b
• Then Db(d) = mind(Db(d) , c(b,c) + Dc(d))• Routing messages contain D• D is any additive metric
– e.g, number of hops, queue length, delay– asdf
![Page 56: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/56.jpg)
DV Example
Destination Cost Next Hop
A 1 A
C 1 C
D 2 C
E 2 A
F 2 A
G 3 A
B’s routing table
![Page 57: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/57.jpg)
G, 1, G
• F-G fails• F sets distance to G to infinity, propagates• A sets distance to G to infinity• A receives periodic update from C with 2-hop path to G• A sets distance to G to 3 and propagates• F sets distance to G to 4, through A
G, ∞, -G, 4, A
Adapting to Failures
G, 2, F
G, 2, DG, 3, D
G, 3, A
G, 1, GG, ∞,-G, 3,C
G, 4, A
![Page 58: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/58.jpg)
Count-to-Infinity
• Link from A to E fails• A advertises distance of infinity to E• B and C advertise a distance of 2 to E• B decides it can reach E in 3 hops through C• A decides it can reach E in 4 hops through B• C decides it can reach E in 5 hops through A, …• When does this stop?
![Page 59: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/59.jpg)
Good news travels fast
A
B
C
4 1
10
1
• A decrease in link cost has to be fresh information• Network converges at most in O(diameter) steps
![Page 60: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/60.jpg)
Bad news travels slowly
A
B
C
4 1
10• An increase in cost may cause confusion with old information, may form
loops• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!
A 4 A
C 1 C
A 5 B
B 1 BB 4 B
C 5 B
![Page 61: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/61.jpg)
Bad news travels slowly
A
B
C
4 1
10
12
• An increase in cost may cause confusion with old information, may form loops
• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!
A 6 C
C 1 C
A 5 B
B 1 BB 11 C
C 10 C
A6C
![Page 62: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/62.jpg)
Bad news travels slowly
A
B
C
4 1
10
12
• An increase in cost may cause confusion with old information, may form loops
• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!
A 7 C
C 1 C
A 6 B
B 1 BB 11 C
C 10 C
![Page 63: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/63.jpg)
Bad news travels slowly
A
B
C
4 1
10
12
• An increase in cost may cause confusion with old information, may form loops
• Consider routes to A• Initially, B:A,4,A; C:A,5,B• Then B:A,12,A, selects C as next hop -> B:A,6,C• C -> A,7,B; B -> A,8,C; C -> A,9,B; B -> A,10,C;• C finally chooses C:A,10,A, and B -> A,11,C!
A 11 C
C 1 C
A 10 C
B 1 BB 11 C
C 10 C
![Page 64: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/64.jpg)
How to avoid loops
• IP TTL field prevents a packet from living forever– Does not repair a loop
• Simple approach: consider a small cost n (e.g., 16) to be infinity– After n rounds decide node is unavailable– But rounds can be long, this takes time
• Problem: distance vector based only on local information
![Page 65: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/65.jpg)
Bad news travels slowly
A
B
C
4 1
10
12
A 11 C
C 1 C
A 10 C
B 1 BB 11 C
C 10 C
• Why did it take a while to converge?
![Page 66: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/66.jpg)
Better loop avoidance
• Split Horizon– When sending updates to node A, don’t include
routes you learned from A– Prevents B and C from sending cost 2 to A
• Split Horizon with Poison Reverse– Rather than not advertising routes learned from A,
explicitly include cost of ∞.– Faster to break out of loops, but increases
advertisement sizes
![Page 67: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/67.jpg)
Warning
• Split horizon/split horizon with poison reverse only help between two nodes– Can still get loop with three nodes involved– Might need to delay advertising routes after
changes, but affects convergence time
![Page 68: CPS-356- Computer Networks Class 8: IP Forwarding+ Routing Theophilus Benson Based partly on lecture notes by Rodrigo Fonseca, David Mazières, Phil Levis,](https://reader034.vdocuments.mx/reader034/viewer/2022052509/56649d055503460f949d8f7a/html5/thumbnails/68.jpg)
Today’s Lecture
• Forwarding– IP-Address/IP-Packet Format– Fragmentation– Network Error Messages (Debugging): ICMP– Getting IP-Address: ARP + DHCP
• Routing– Intra-Domain Routing: RIP
• Next class:– Intra-Domain Routing: OSPF, OSPF v RIP