2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 1
Network Layer
Goals:❒ understand principles behind network layer services:
❍routing (path selection) ❍dealing with scale ❍how a router works ❍advanced topics: IPv6,
multicast ❒ instantiation and implementation in the Internet Overview: ❒ last time
❍network layer services ❍IP addressing ❍routing principle: path
selection
❒ today
❍IP
❍hierarchical routing ❍Internet routing protocols
reliable transfer
• intra-domain • inter-domain
❍what’s inside a router? ❍IPv6
❍multicast routing
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 2
The Internet Network layer
routing table
Host, router network layer functions:
Routing protocols •path selection •RIP, OSPF, BGP IP protocol •addressing conventions •datagram format •packet handling conventions ICMP protocol •error reporting •router “signaling”
Transport layer: TCP, UDP
Link layer physical layer Network layer
IP datagram format
ver length 32 bits data (variable length, typically a TCP or UDP segment) 16-bit identifier Internet checksum time to live32 bit source IP address IP protocol version number header length (32-bit words) max number remaining hops (decremented at each router) for fragmentation/ reassembly total datagram length (bytes)
upper layer protocol to deliver payload to
head. len type ofservice
“type” of data flgs fragment offset upper
layer
32 bit destination IP address
Options (if any) E.g. timestamp, record route taken, specify list of routers to visit.
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 4
Fragmentering och hopsättning
❒MTU varierar i olika nät, två val❍Alla paket tillräckligt små ❍Fragmentering och hopsättning ❒Alla fragment har samma Ident ❒Tappas ett fragment slängs alla
❒Varje fragment fullständigt IP-datagram ❒Hopsättning hos mottagaren
❒Designat för ytterligare fragmentering
Ident Flags Offset
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 5
IP Fragmentation and Reassembly
ID =xfragflag=0 offset=0 length =4000 ID =x fragflag=1 offset=0 length =1500 ID =x fragflag=1 offset=1480 length =1500 ID =xfragflag=0 offset=2960 length =1040
One large datagram becomes several smaller datagrams
ICMP: Internet Control Message Protocol
❒ used by hosts, routers, gateways to communicate network-level information
❍error reporting: unreachable host, network, port, protocol
❍echo request/reply (used by ping)
❒ network-layer “above” IP: ❍ICMP msgs carried in IP
datagrams
❒ ICMP message:type, code plus first 8 bytes of IP datagram causing error
Type Code description 0 0 echo reply (ping) 3 0 dest. network unreachable 3 1 dest host unreachable 3 2 dest protocol unreachable 3 3 dest port unreachable 3 6 dest network unknown 3 7 dest host unknown 4 0 source quench (congestion
control - not used) 8 0 echo request (ping) 9 0 route advertisement 10 0 router discovery 11 0 TTL expired 12 0 bad IP header
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 7
Skalbarhet
❒27+ 214+ 221olika nätverksadresser i IP ❒Det blir stora tabeller om varje router ska
hitta alla nätverk
❒Hur får man routing att skala?
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 8
Forwarding algortim
❒Om direkt kopplad till destinationens nätverk - skicka direkt till destination ❒annars om destinationen finns i forwarding
tabellen - skicka till NextHop routern ❒annars -skicka till default routern
R2 R1 H4 H5 H3 H2 H1 Network 2 (Ethernet) Network 1 (Ethernet) H6 Network 3 (FDDI) Network 4 (point-to-point) H7 R3 H8 NetworkNum NextHop 1 2 3 4 R3 R1 interface 1 interface 0 Forwarding tabell R2
DHCP
A new node needs an IP-address: ❒hard-coded by system admin in a file ❒DHCP: Dynamic Host Configuration Protocol:
dynamically get address: “plug-and-play”
❍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 ❒An example on scaling of network
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 10
Hierarchical Routing
scale:with 50 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 in its own network
Our routing study thus far - idealization
❒ all routers identical ❒ network “flat”
… not true in practice
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 11
Hierarchical Routing
❒ aggregate routers into
regions,“autonomous systems” (AS) ❒ routers in same AS run
same routing protocol
❍“intra-AS” routing
protocol
❍routers in different AS
can run different intra-AS routing protocol
❒ special routers in AS ❒ run intra-AS routing protocol with all other routers in AS ❒ also responsible for
routing to destinations outside AS
❍run inter-AS routing
protocol with other gateway routers gateway routers
Intra-AS and Inter-AS routing
Gateways: •perform inter-AS routing amongst themselves •perform intra-AS routers with other routers in their AS inter-AS, intra-AS routing in gateway A.c network layer link layer physical layer a b b a a C A B d A.a A.c C.b B.a c b c
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 13
Intra-AS and Inter-AS routing
Host h2 a b b a a C A B d c A.a A.c C.b B.a c b Host h1 Intra-AS routing within AS A Inter-AS routing between A and B Intra-AS routing within AS B
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 14 Routing in the Internet
❒The Global Internet consists of Autonomous Systems (AS)interconnected with each other:
❍Stub AS: small corporation
❍Multihomed AS: large corporation (no transit) ❍Transit AS: provider
❒Two-level routing:
❍Intra-AS: administrator is responsible for choice ❍Inter-AS: unique standard
Intra-AS Routing
❒Also known as Interior Gateway Protocols (IGP) ❒Most common IGPs:
❍RIP: Routing Information Protocol ❍OSPF: Open Shortest Path First
❍IGRP: Interior Gateway Routing Protocol (Cisco
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 16 RIP ( Routing Information Protocol)
❒Distance vector algorithm
❒Included in BSD-UNIX Distribution in 1982 ❒Distance metric: # of hops (max = 15 hops)
❍Can you guess why?
❒Distance vectors: exchanged every 30 sec via
Response Message (also called advertisement)
❒Each advertisement: route to up to 25 destination
nets
❒RIP v1 RFC 1058 ❒RIP v2 RFC 1723
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 17 RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link declared dead
❍routes via neighbor invalidated ❍new advertisements sent to neighbors
❍neighbors in turn send out new advertisements (if
tables changed)
❍link failure info quickly propagates to entire net ❍poison reverse used to prevent ping-pong loops
(infinite distance = 16 hops)
RIP Table processing
❒RIP routing tables managed by application-level
process called route-d (daemon)
❒advertisements sent in UDP packets, periodically
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 19 RIP Table example (continued)
Router: giroflee.eurocom.fr
❒ Three attached class C networks (LANs) ❒ Router only knows routes to attached LANs ❒ Default router used to “go up”
❒ Route multicast address: 224.0.0.0 ❒ Loopback interface (for debugging)
Destination Gateway Flags Ref Use Interface -- -- --- --- --- ---127.0.0.1 127.0.0.1 UH 0 26492 lo0 192.168.2. 192.168.2.5 U 2 13 fa0 193.55.114. 193.55.114.6 U 3 58503 le0 192.168.3. 192.168.3.5 U 2 25 qaa0 224.0.0.0 193.55.114.6 U 3 0 le0 default 193.55.114.129 UG 0 143454
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 20 OSPF (Open Shortest Path First)
❒“open”: publicly available, v2 RFC 2178 ❒Uses Link State algorithm
❍LS packet dissemination ❍Topology map at each node
❍Route computation using Dijkstra’s algorithm
❒OSPF advertisement carries one entry per neighbor
router
❒Advertisements disseminated to entireAS (via
flooding)
OSPF “advanced” features (not in RIP)
❒Security:all OSPF messages authenticated (toprevent malicious intrusion); TCP connections used
❒Multiple same-cost paths allowed (only one path in
RIP)
❒For each link, multiple cost metrics for different TOS (eg, satellite link cost set “low” for best effort; high for real time)
❒Integrated uni- and multicastsupport:
❍Multicast OSPF (MOSPF) uses same topology data base as
OSPF
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 22
Hierarchical OSPF
❒ Two-level hierarchy: local area, backbone
❍Link-state
advertisements only in area
❍each nodes has
detailed area topology; only know direction (shortest path) to nets in other areas.
❒ Area border routers: “summarize” distances to nets in own area, advertise to other Area Border routers.
❒ Backbone routers:run OSPF routing limited to backbone. ❒ Boundary routers:connect to
other ASs.
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 23
IGRP (Interior Gateway Routing Protocol)
❒CISCO proprietary; successor of RIP (mid 80s) ❒Distance Vector, like RIP
❒several cost metrics (delay, bandwidth, reliability,
load etc)
❒uses TCP to exchange routing updates
❒Loop-free routing via Distributed Updating Alg.
(DUAL) based on diffused computation
Internet AS Hierarchy
Intra-AS border (exterior gateway) routers2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 25
Internet inter-AS routing: BGP
❒BGP (Border Gateway Protocol):the de factostandard
❒Path Vectorprotocol:
❍similar to Distance Vector protocol
❍each Border Gateway broadcast to neighbors
(peers) entire path (I.e, sequence of ASs) to destination
❍E.g., Gateway X may sendits path to dest. Z: Path (X,Z) = X,Y1,Y2,Y3,…,Z
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 26
Internet inter-AS routing: BGP
Suppose:gateway X send its path to peer gateway W❒W may or may not select path offered by X
❍cost, policy (don’t route via competitors AS), loop
prevention reasons.
❒If W selects path advertised by X, then:
Path (W,Z) = w, Path (X,Z)
❒Note: X can control incoming traffic by controlling its
route advertisements to peers:
❍e.g., don’t want to route traffic to Z -> don’t
advertise any routes to Z
Internet inter-AS routing: BGP
❒BGP messages exchanged using TCP. ❒BGP messages:❍OPEN:opens TCP connection to peer and
authenticates sender
❍UPDATE:advertises new path (or withdraws old) ❍KEEPALIVEkeeps connection alive in absence of
UPDATES; also ACKs OPEN request
❍NOTIFICATION:reports errors in previous msg;
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 28 Why different Intra- and Inter-AS routing ?
Policy:
❒Intra-AS: single admin, so no policy decisions needed
❒Inter-AS: admin wants control over how its traffic
routed, who routes through its net. Scale:
❒hierarchical routing saves table size, reduced update
traffic Performance:
❒Intra-AS: can focus on performance
❒Inter-AS: policy may dominate over performance
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 29
Hur får man routing att skala
mer?
❒Adressanvändning ❍Adresser får inte ta slut
❍Klass C med 2 hosts (2/255 = 0.78%) ❍Klass B med 256 hosts (256/65535 = 0.39%) ❒Skalabilitet för routing
❍Routingtabeller skalar ej ❍IGP skalar ej
Subnetting
❒Subnät ny nivå till adress/routing hierarkin ❒Subnätmasken definierar variabel del av
hostdelen => subnät nummer ❒Subnät syns bara i aktuellt nätverk
Network number Host number Class B address
Subnet mask (255.255.255.0)
Subnetted address 111111111111111111111111 00000000
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 31
Subnät exempel
Forwarding table at router R1 Subnet Number Subnet Mask Next Hop 128.96.34.0 255.255.255.128 interface 0 128.96.34.128 255.255.255.128 interface 1 128.96.33.0 255.255.255.0 R2 Subnet mask: 255.255.255.128 Subnet number: 128.96.34.0 128.96.34.15 128.96.34.1 H1 R1
128.96.34.130 Subnet mask: 255.255.255.128Subnet number: 128.96.34.128
128.96.34.129 128.96.34.139 R2 H2 128.96.33.1 128.96.33.14 Subnet mask: 255.255.255.0 Subnet number: 128.96.33.0 H3
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 32
Forwarding algoritm
D = destination IP addressfor each entry (SubnetNum, SubnetMask, NextHop) D1 = SubnetMask & D
if D1 = SubnetNum
if NextHop is an interface deliver datagram directly to D else
deliver datagram to NextHop
❒Använd default router om inget matchar ❒Inte nödvändigt med sammanhängande 1’or ❒Möjligt att ha flera subnät på ett fysiskt nätverk ❒Subnät syns ej ifrån resten av Internet
Supernetting
❒Om alla som vill ha klass B adresser får det blir det dåligt utnyttjande
❒Om alla istället får klass C adresser ökar routingtabellernas storlek
❒Lösning: Supernetting - CIDR ❍Classless InterDomain Routing
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 34
Classless InterDomain Routing
❒Dela ut block av kontinuerliganätverksnummer till närliggande nätverk ❒Representera block med
❍(first_network_address, count), 130.239.40/21 ❒Begränsa storlekar till potens av 2
❒Alla routrar måste förstå CIDR ❒Möjligt att slå ihop adresser rekursivet ❒Längsta möjliga match i router
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 35
Hierarchical addressing: more specific
routes
ISPs-R-Us has a more specific route to Organization 1
“Send me anything with addresses beginning 200.23.16.0/20” 200.23.16.0/23 200.23.18.0/23 200.23.30.0/23 Fly-By-Night-ISP Organization 0 Organization 7 Internet Organization 1
ISPs-R-Us “Send me anythingwith addresses beginning 199.31.0.0/16 or 200.23.18.0/23” 200.23.20.0/23 Organization 2 .. . .. .
Subnetting och CIDR:
skalabiliteten
❒Subnetting
❍Hjälper till att lösa skalabilitetsproblemet • Nya fysiska nätverk kan läggas till utan att använda
nya Klass B eller C nätverksadresser • Samlar ihop information
❒CIDR
❍Kortare routingtabeller • Slår ihop routinginformation ❍Spar adresser
• Dela ut block av kontinuerliga nätverksnummer istället för adresser för större nätverksklass
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 37
Skalbara nätverk
❒Interdomän routing för att hitta rätt AS
❍Färre AS än nätverk
❒Intradomän routing för att hitta rätt nätverk i AS
❍Färre nätverk i en domän än i hela Internet
❒CIDR
❍Slår ihop routing information
❒Subnetting
❍Subnät syns ej utåt
❒ARP (nästa lager)
❍Hitta rätt host i ett nätverk (subnät)
❒Skalabilitet viktigare än optimal väg
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 38
Router Architecture Overview
Two key router functions:❒run routing algorithms/protocol (RIP, OSPF, BGP) ❒switching datagrams from incoming to outgoing link
Input Port Functions
Decentralized switching:
❒ given datagram dest., lookup output port using routing table in input port memory ❒ goal: complete input port processing at
‘line speed’
❒ queuing: if datagrams arrive faster than forwarding rate into switch fabric
Physical layer:
bit-level reception
Data link layer:
e.g., Ethernet see chapter 5
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 40
Input Port Queuing
❒ Fabric slower that input ports combined -> queueing
may occur at input queues
❒ Head-of-the-Line (HOL) blocking:queued datagram
at front of queue prevents others in queue from moving forward
❒ queueing delay and loss due to input buffer overflow!
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 41
Three types of switching fabrics
Via memory First generation routers: ❒packet copied by system’s (single) CPU ❒speed limited by memory bandwidth (2 bus crossings per datagram) Modern routers: ❒input port processor performs lookup, copy into memory Via bus ❒ datagram from input port memory to output port memory via a shared bus ❒ bus contention: switching speed limited by bus bandwidth Via an interconection network
❒ overcome bus bandwidth limitations
❒ Advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric.
Output Ports
❒Bufferingrequired when datagrams arrive from
fabric faster than the transmission rate
❒Scheduling disciplinechooses among queued
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 43
Output port queueing
❒ buffering when arrival rate via switch exceeeds
ouput line speed
❒ queueing (delay) and loss due to output port buffer overflow!
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 44
IPv6
❒Initial motivation:32-bit address space completely allocated by 2008 or 2018 or … ❒Additional motivation:
❍header format helps speed processing/forwarding ❍header changes to facilitate QoS
❍new “anycast” address: route to “best” of several
replicated servers
❒IPv6 datagram format: ❍fixed-length 40 byte header ❍no fragmentation allowed
Transition From IPv4 To IPv6
❒Not all routers can be upgradedsimultaneous ❍no “flag days”
❍How will the network operate with mixed IPv4
and IPv6 routers?
❒Two proposed approaches:
❍Dual Stack: some routers with dual stack (v6,
v4) can “translate” between formats
❍Tunneling: IPv6 carried as payload in IPv4
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 46
Dual Stack Approach
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 47
Tunneling
IPv6 inside IPv4 where needed
Multicast routing
❒Unicast ❍Enkelt, men
bandbreddskrävande
❒Multicast
❍Mindre antal paket,
men kräver support från nätverkslagret
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 49
Multicast routing (forts)
❒Problem
❍Hur identifieras mottagarna av multicast-meddelanden? ❍Hur adresseras ett datagram till dem?
❒Lösning
❍”address indirection”, en identifierare för hel multicast
grupp
❍Class D multicast-adresser
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 50
Multicast routing - frågor
❒Hur startar och slutar en grupp? ❒Hur väljs gruppadress?❒Hur ansluter man till befintlig grupp? ❒Kan vem som helst ansluta sig? ❒Känner man till vilka övriga som är
anslutna?
❒Hur samarbetar routrarna? ❒Involverar IGMP
IGMP
❒Internet Group Management Protocol ❒Mellan host och första router ❒Kan ej identifiera andra i gruppen ❒Tre typer av meddelanden
❍Membership query, membership report, leave
group
❒Körs över IP ❒Receiver-driven
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 52
Multicast routing - generellt
❒Mål: Hitta ett träd med alla routrar ❒Ibland måste andra routrar involveras ❒Två varianter:
❍Group-shared tree, endast ett träd
❍Source-based trees, ett träd för varje sändare
2 October 2001 Data Communications, Jonny Pettersson, UmU Network 2 53
Multicast routing – i Internet
❒DVMRP
❍Distance Vector Multicast Routing Protocol ❍Source-based
❒MOSPF – Multicast OSPF
❍Source-based
❒CBT – Core Based Trees
❍Group-shared
❒PIM – Protocol Independent Multicast
❍Dense mode – liknar DVMRP ❍Sparse mode – group-shared
❒Mellan AS – DVMRP
❍Men inte helt lyckat
Network Layer: Summary
Goals:❒ understand principles behind network layer services:
❍routing (path selection) ❍dealing with scale ❍how a router works ❍advanced topics: IPv6,
multicast
❒ instantiation and implementation in the Internet
Overview:
❒ network layer services ❒ IP addressing ❒ routing principle: path
selection ❒ IP
❒ hierarchical routing ❒ Internet routing protocols
reliable transfer
❍intra-domain ❍inter-domain
❒ what’s inside a router? ❒ IPv6