4: Network Layer 4b-2
Hierarchical Routing
scale: with 200 million destinations:
can’t store all dest’s in routing tables!
routing table exchange would swamp links!
administrative autonomy internet = network of
networks each network admin may
want to control routing (cost metrics, etc.) in its own network
Our routing study thus far - idealization all routers identical network “flat”
… … notnot true in practice true in practice
Why?Why?
4: Network Layer 4b-3
Hierarchical Routing
Organization: aggregate routers into regions, called “autonomous systems” (AS)
routers in same AS run same routing protocol “intra-AS” routing (i.e.,
within an AS) protocol routers in different AS
can run different intra-AS routing protocol
special routers in (on the edge of) an AS
run intra-AS routing protocol with all other routers in AS
also responsible for routing to destinations outside AS run inter-AS routing
(i.e., between AS) protocol with other gateway routers
gateway routers
4: Network Layer 4b-4
Intra-AS and Inter-AS routing
Gateway routers:•perform inter-AS routing amongst themselves•perform intra-AS routing with other routers in their AS
inter-AS, intra-AS routing in
gateway A.c
network layer
data link layerphysical layer
a
b
b
aaC
A
Bd
A.a
A.c
C.bB.a
cb
c
4: Network Layer 4b-5
Intra-AS and Inter-AS routing
Host h2
a
b
b
aaC
A
Bd c
A.a
A.c
C.bB.a
cb
Hosth1
Intra-AS routingwithin AS A
Inter-AS routingbetween A and B
Intra-AS routingwithin AS B
We’ll examine specific inter-AS and intra-AS Internet routing protocols shortly (section 4.5)
4: Network Layer 4b-6
IP datagram format
ver length
32 bits
data (variable length,
typically a TCP segment, a UDP segment,
or an ICMP message)
16-bit identifier
Header checksum
time tolive
32 bit source IP address
IP protocol versionnumber
header length (4-byte multiples)
max numberremaining hops
(decremented at each router)
forfragmentation/reassembly
total datagramlength (bytes)
upper layer protocolto deliver payload to
(RFC 1700, 3232)
head.len
type ofservice
DS codepoint, ECN flgsfragment
offsetupper layer
32 bit destination IP address
Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.
how much overhead with TCP?
20 bytes of TCP 20 bytes of IP = 40 bytes +
app layer overhead
4: Network Layer 4b-7
IP Fragmentation & Reassembly network links have MTU
(Max. Transfer Unit) size - largest possible link-level frame. different link types,
different MTUs large IP datagram is divided
(“fragmented”) within network one datagram becomes
several datagrams “reassembled” only at
the final destination IP header bits are used
to identify and order related fragments
fragmentation: in: one large datagramout: 3 smaller datagrams
reassembly
4: Network Layer 4b-8
IP Fragmentation and Reassembly
ID=x
offset=0
More bit=0
bytes*=3980
ID=x
offset=0
More bit=1
bytes*=1480
ID=x
offset=1480
More bit=1
bytes*=1480
ID=x
offset=2960
More bit=0
bytes*=1020
One large datagram becomesseveral smaller datagrams
Note: Offset is actuallyspecified as number of 8-byte (64-bit) units.
Example 4000 byte
datagram MTU = 1500
bytes
* This is the number of data bytes in the IP datagram. The IP length field would show this + 20. Why?
4: Network Layer 4b-9
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address from network server when it joins a networkCan renew its lease on address in useAllows reuse of addresses (only hold address while connected an
“on”Support for mobile users who want to join network (more shortly)
DHCP overview: host broadcasts “DHCP discover” msg DHCP server responds with “DHCP offer” msg host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg
4: Network Layer 4b-10
DHCP client-server scenario
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4 223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2223.1.3.1
223.1.3.27
A
BE
DHCP server
arriving DHCP client needsaddress in thisnetwork
4: Network Layer 4b-11
DHCP client-server scenarioDHCP server: 223.1.2.5 arriving
client
time
DHCP discover
src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654
DHCP offer
src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
4: Network Layer 4b-12
NAT: Network Address Translation
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
138.76.29.7
local network(e.g., home network)
10.0.0/24
rest ofInternet
Datagrams with source or destination in this networkhave 10.0.0/24 address for
source, destination (as usual)
All datagrams leaving localnetwork have same single source
NAT IP address: 138.76.29.7,different source port numbers
4: Network Layer 4b-13
NAT: Network Address Translation
Motivation: local network uses just one IP address as far as outside word is concerned: no need to be allocated range of addresses from
ISP: - just one IP address is used for all devices can change addresses of devices in local network
without notifying outside world can change ISP without changing addresses of
devices in local network devices inside local net not explicitly
addressable, visible by outside world (a security plus).
4: Network Layer 4b-14
NAT: Network Address Translation
Implementation: NAT router must:
outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #)
. . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr.
remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair
incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
4: Network Layer 4b-15
NAT: Network Address Translation
10.0.0.1
10.0.0.2
10.0.0.3
S: 10.0.0.1, 3345D: 128.119.40.186, 80
1
10.0.0.4
138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40, 80
NAT translation tableWAN side addr LAN side addr
138.76.29.7, 5001 10.0.0.1, 3345…… ……
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
4
S: 138.76.29.7, 5001D: 128.119.40.186, 80
2
2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table
S: 128.119.40.186, 80 D: 138.76.29.7, 5001
3
3: Reply arrives dest. address: 138.76.29.7, 5001
4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345
4: Network Layer 4b-16
NAT: Network Address Translation
16-bit port-number field: 60,000 simultaneous connections with a
single LAN-side address! Reserved address space (rfc 1918) NAT is controversial:
routers should only process up to layer 3 violates end-to-end argument
• NAT possibility must be taken into account by app designers, eg, P2P applications
address shortage should instead be solved by IPv6
4: Network Layer 4b-17
Intra-AS Routing
Also known as Interior Gateway Protocols (IGP) Most common IGPs:
RIP: Routing Information Protocol (legacy, RIPv2 still in use)
OSPF: Open Shortest Path First (common)
EIGRP: Enhanced Interior Gateway Routing Protocol (proprietary – Cisco Systems)
4: Network Layer 4b-18
RIP ( Routing Information Protocol)
Distance vector algorithm Included in BSD-UNIX Distribution in 1982
RFC 1058 (version 1), RFC 2453 (version 2)
Distance metric: # of hops (max = 15 hops) Can you guess why?
Distance vectors: exchanged every 30 seconds via Response Message (also called advertisement)
Each advertisement: routing info for maximum of 25 destination nets within the AS
Uses UDP transport, port 520
4: Network Layer 4b-19
Problems/limitations with RIP
Good for small systems, but doesn’t scale well
Count-to-infinity problem… poisoned reverse only
Comparatively slow convergence
1979 – RIP version 1 1988 – IETF initiates work on
replacement 1990 – OSPF became new standard 1990’s – RIP version 2
4: Network Layer 4b-20
OSPF (Open Shortest Path First)
“open”: publicly available Uses Link State algorithm
LS packet dissemination Topology map at each node Route computation using Dijkstra’s algorithm
However…. OSPF advertisement carries only one entry per
neighbor router Advertisements disseminated to entire AS (via
flooding) Sent as payload in IP datagram
4: Network Layer 4b-21
EIGRP (Enhanced Interior Gateway Routing Protocol) CISCO proprietary; successor of RIP (mid 80’s) uses Distance Vector, like RIP several cost metrics (delay, bandwidth,
reliability, load etc) uses TCP (!) to exchange routing updates Loop-free routing via a distributed update
routing algorithm (called DUAL) based on diffused computation