TCP/IP Network layer
-
Upload
swapnil-kulkarni -
Category
Software
-
view
360 -
download
1
description
Transcript of TCP/IP Network layer
Network Layer
Session No.4
Network Layer
Network Layer
Chapter 4: Network Layer
Chapter goals: r understand principles behind network layer
services:m network layer service modelsm forwarding versus routingm how a router worksm routing (path selection)m dealing with scalem advanced topics: IPv6
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
Network layerr transport segment from
sending to receiving host r on sending side
encapsulates segments into datagrams
r on rcving side, delivers segments to transport layer
r network layer protocols in every host, router
r router examines header fields in all IP datagrams passing through it
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
networkdata linkphysical network
data linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysicalnetwork
data linkphysical
Network Layer
Two Key Network-Layer Functions
r forwarding: move packets from router’s input to appropriate router output
r routing: determine route taken by packets from source to dest. m routing algorithms
analogy:
r routing: process of planning trip from source to dest
r forwarding: process of getting through single interchange
Network Layer
1
23
0111
value in arrivingpacket’s header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing and forwarding
Network Layer
Connection setup
r 3rd important function in some network architectures:m ATM, frame relay, X.25
r before datagrams flow, two end hosts and intervening routers establish virtual connectionm routers get involved
r network vs transport layer connection service:m network: between two hosts (may also involve
intervening routers in case of VCs)m transport: between two processes
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
Network layer connection and connection-less service
r datagram network provides network-layer connectionless service
r VC network provides network-layer connection service
r analogous to the transport-layer services, but:m service: host-to-hostm no choice: network provides one or the otherm implementation: in network core
Network Layer
Virtual circuits
r call setup, teardown for each call before data can flowr each packet carries VC identifier (not destination host
address)r every router on source-dest path maintains “state” for
each passing connectionr link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable service)
“source-to-dest path behaves much like telephone circuit”m performance-wisem network actions along source-to-dest path
Network Layer
Virtual circuits: signaling protocols
r used to setup, maintain teardown VCr used in ATM, frame-relay, X.25r not used in today’s Internet
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1. Initiate call 2. incoming call3. Accept call4. Call connected
5. Data flow begins 6. Receive data
Network Layer
Datagram networksr no call setup at network layerr routers: no state about end-to-end connections
m no network-level concept of “connection”r packets forwarded using destination host address
m packets between same source-dest pair may take different paths
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
1. Send data 2. Receive data
Network Layer
Forwarding table
Destination Address Range Link Interface
11001000 00010111 00010000 00000000 through 0 11001000 00010111 00010111 11111111
11001000 00010111 00011000 00000000 through 1 11001000 00010111 00011000 11111111
11001000 00010111 00011001 00000000 through 2 11001000 00010111 00011111 11111111
otherwise 3
4 billion possible entries
Network Layer
Longest prefix matching
Prefix Match Link Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3
DA: 11001000 00010111 00011000 10101010
Examples
DA: 11001000 00010111 00010110 10100001 Which interface?
Which interface?
Network Layer
Datagram or VC network: why?
Internet (datagram)r data exchange among
computersm “elastic” service, no strict
timing req. r “smart” end systems
(computers)m can adapt, perform
control, error recoverym simple inside network,
complexity at “edge”r many link types
m different characteristicsm uniform service difficult
ATM (VC)r evolved from telephonyr human conversation:
m strict timing, reliability requirements
m need for guaranteed service
r “dumb” end systemsm telephonesm complexity inside
network
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
r 4.7 Broadcast and multicast routing
Network Layer
Router Architecture Overview
Two key router functions: r run routing algorithms/protocol (RIP, OSPF, BGP)r forwarding datagrams from incoming to outgoing link
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
The Internet Network layer
forwardingtable
Host, router network layer functions:
Routing protocols•path selection•RIP, OSPF, BGP
IP protocol•addressing conventions•datagram format•packet handling conventionsICMP protocol•error reporting•router “signaling”
Transport layer: TCP, UDP
Link layer
physical layer
Networklayer
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
IP datagram format
ver length
32 bits
data (variable length,typically a TCP
or UDP segment)
16-bit identifierheader
checksumtime to
live32 bit source IP address
IP protocol versionnumber
header length (bytes)
max numberremaining hops
(decremented at each router)
forfragmentation/reassembly
total datagramlength (bytes)
upper layer protocolto 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 routetaken, specifylist of routers to visit.
how much overhead with TCP?
r 20 bytes of TCPr 20 bytes of IPr = 40 bytes + app
layer overhead
Network Layer
IP Fragmentation & Reassemblyr network links have MTU (max.
transfer size) - largest possible link-level frame.m different link types,
different MTUs r large IP datagram divided
(“fragmented”) within netm one datagram becomes
several datagramsm “reassembled” only at final
destinationm IP header bits used to
identify, order related fragments
fragmentation: in: one large datagramout: 3 smaller datagrams
reassembly
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
IP Addressing: introductionr IP address: 32-bit
identifier for host, router interface
r interface: connection between host/router and physical linkm router’s typically have
multiple interfacesm host typically has one
interfacem IP addresses
associated with each interface
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
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 11
Network Layer
Subnetsr IP address:
m subnet part (high order bits)
m host part (low order bits)
r What’s a subnet ?m device interfaces with
same subnet part of IP address
m can physically reach each other without intervening router
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
network consisting of 3 subnets
subnet
Network Layer
Subnets 223.1.1.0/24 223.1.2.0/24
223.1.3.0/24
Reciper To determine the
subnets, detach each interface from its host or router, creating islands of isolated networks. Each isolated network is called a subnet.
Subnet mask: /24
Network Layer
SubnetsHow many? 223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.2223.1.2.1
223.1.2.6
223.1.3.2223.1.3.1
223.1.3.27
223.1.1.2
223.1.7.0
223.1.7.1223.1.8.0223.1.8.1
223.1.9.1
223.1.9.2
Network Layer
IP addresses: how to get one?
Q: How does a host get IP address?
r hard-coded by system admin in a filem Windows: control-panel->network->configuration-
>tcp/ip->propertiesm UNIX: /etc/rc.config
r DHCP: Dynamic Host Configuration Protocol: dynamically get address from as serverm “plug-and-play”
Network Layer
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its IP address from network server when it joins 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:
m host broadcasts “DHCP discover” msgm DHCP server responds with “DHCP offer” msgm host requests IP address: “DHCP request” msgm DHCP server sends address: “DHCP ack” msg
Network Layer
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
Network Layer
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 offersrc: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 654Lifetime: 3600 secs
DHCP requestsrc: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
DHCP ACKsrc: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddrr: 223.1.2.4transaction ID: 655Lifetime: 3600 secs
Network Layer
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
Network Layer
NAT: Network Address Translation
r Motivation: local network uses just one IP address as far as outside world is concerned:m range of addresses not needed from ISP: just one IP
address for all devicesm can change addresses of devices in local network
without notifying outside worldm can change ISP without changing addresses of
devices in local networkm devices inside local net not explicitly addressable,
visible by outside world (a security plus).
Network Layer
NAT: Network Address TranslationImplementation: NAT router must:
m 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.m remember (in NAT translation table) every (source
IP address, port #) to (NAT IP address, new port #) translation pair
m 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
Network Layer
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
110.0.0.4
138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
NAT translation tableWAN side addr LAN side addr138.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, 802
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
Network Layer
NAT: Network Address Translation
r 16-bit port-number field: m 60,000 simultaneous connections with a single
LAN-side address!r NAT is controversial:
m routers should only process up to layer 3m violates end-to-end argument
• NAT possibility must be taken into account by app designers, eg, P2P applications
m address shortage should instead be solved by IPv6
Network Layer
NAT traversal problemr client wants to connect to
server with address 10.0.0.1m server address 10.0.0.1 local
to LAN (client can’t use it as destination addr)
m only one externally visible NATted address: 138.76.29.7
r solution 1: statically configure NAT to forward incoming connection requests at given port to serverm e.g., (123.76.29.7, port 2500)
always forwarded to 10.0.0.1 port 25000
10.0.0.1
10.0.0.4
NAT router
138.76.29.7
Client ?
Network Layer
NAT traversal problemr solution 2: Universal Plug and
Play (UPnP) Internet Gateway Device (IGD) Protocol. Allows NATted host to:❖ learn public IP address
(138.76.29.7)❖ add/remove port mappings
(with lease times)
i.e., automate static NAT port map configuration
10.0.0.1
10.0.0.4
NAT router
138.76.29.7
IGD
Network Layer
NAT traversal problemr solution 3: relaying (used in Skype)
m NATed client establishes connection to relaym External client connects to relaym relay bridges packets between to connections
138.76.29.7Client
10.0.0.1
NAT router
1. connection torelay initiatedby NATted host
2. connection torelay initiatedby client
3. relaying established
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
ICMP: Internet Control Message Protocol
r used by hosts & routers to communicate network-level informationm error reporting:
unreachable host, network, port, protocol
m echo request/reply (used by ping)
r network-layer “above” IP:m ICMP msgs carried in IP
datagramsr ICMP message: type, code plus
first 8 bytes of IP datagram causing error
Type Code description0 0 echo reply (ping)3 0 dest. network unreachable3 1 dest host unreachable3 2 dest protocol unreachable3 3 dest port unreachable3 6 dest network unknown3 7 dest host unknown4 0 source quench (congestion control - not used)8 0 echo request (ping)9 0 route advertisement10 0 router discovery11 0 TTL expired12 0 bad IP header
Network Layer
Traceroute and ICMP
r Source sends series of UDP segments to destm First has TTL =1m Second has TTL=2, etc.m Unlikely port number
r When nth datagram arrives to nth router:m Router discards datagramm And sends to source an
ICMP message (type 11, code 0)
m Message includes name of router& IP address
r When ICMP message arrives, source calculates RTT
r Traceroute does this 3 times
Stopping criterionr UDP segment eventually
arrives at destination hostr Destination returns ICMP
“host unreachable” packet (type 3, code 3)
r When source gets this ICMP, stops.
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
IPv6r Initial motivation: 32-bit address space soon
to be completely allocated. r Additional motivation:
m header format helps speed processing/forwardingm header changes to facilitate QoS IPv6 datagram format: m fixed-length 40 byte headerm no fragmentation allowed
Network Layer
IPv6 Header (Cont)Priority: identify priority among datagrams in flowFlow Label: identify datagrams in same “flow.” (concept of“flow” not well defined).Next header: identify upper layer protocol for data
Network Layer
Other Changes from IPv4
r Checksum: removed entirely to reduce processing time at each hop
r Options: allowed, but outside of header, indicated by “Next Header” field
r ICMPv6: new version of ICMPm additional message types, e.g. “Packet Too Big”m multicast group management functions
Network Layer
Transition From IPv4 To IPv6
r Not all routers can be upgraded simultaneousm no “flag days”m How will the network operate with mixed IPv4 and
IPv6 routers? r Tunneling: IPv6 carried as payload in IPv4
datagram among IPv4 routers
Network Layer
TunnelingA B E F
IPv6 IPv6 IPv6 IPv6
tunnelLogical view:
Physical view:A B E F
IPv6 IPv6 IPv6 IPv6IPv4 IPv4
Network Layer
TunnelingA B E F
IPv6 IPv6 IPv6 IPv6
tunnelLogical view:
Physical view:A B E F
IPv6 IPv6 IPv6 IPv6
C D
IPv4 IPv4
Flow: XSrc: ADest: F
data
Flow: XSrc: ADest: F
data
Flow: XSrc: ADest: F
data
Src:BDest: E
Flow: XSrc: ADest: F
data
Src:BDest: E
A-to-B:IPv6
E-to-F:IPv6B-to-C:
IPv6 insideIPv4
B-to-C:IPv6 inside
IPv4
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
1
23
0111
value in arrivingpacket’s header
routing algorithm
local forwarding tableheader value output link
0100010101111001
3221
Interplay between routing, forwarding
Network Layer
Routing Algorithm classification
Global or decentralized information?
Global:r all routers have complete
topology, link cost infor “link state” algorithmsDecentralized: r router knows physically-
connected neighbors, link costs to neighbors
r iterative process of computation, exchange of info with neighbors
r “distance vector” algorithms
Static or dynamic?Static: r routes change slowly
over timeDynamic: r routes change more
quicklym periodic updatem in response to link
cost changes
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
A Link-State Routing Algorithm
Dijkstra’s algorithmr net topology, link costs
known to all nodesm accomplished via “link
state broadcast” m all nodes have same info
r computes least cost paths from one node (‘source”) to all other nodesm gives forwarding table
for that noder iterative: after k
iterations, know least cost path to k dest.’s
Notation:r c(x,y): link cost from node
x to y; = ∞ if not direct neighbors
r D(v): current value of cost of path from source to dest. v
r p(v): predecessor node along path from source to v
r N': set of nodes whose least cost path definitively known
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
Distance vector algorithm (4)
Basic idea: r From time-to-time, each node sends its own
distance vector estimate to neighborsr Asynchronousr When a node x receives new DV estimate from
neighbor, it updates its own DV using B-F equation:Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
r Under minor, natural conditions, the estimate Dx(y) converge to the actual least cost dx(y)
Network Layer
Distance Vector: link cost changes
Link cost changes:r node detects local link cost change r updates routing info, recalculates
distance vectorr if DV changes, notify neighbors
“goodnews travelsfast”
x z14
50
y1
At time t0, y detects the link-cost change, updates its DV, and informs its neighbors.
At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV.
At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z.
Network Layer
Distance Vector: link cost changes
Link cost changes:r good news travels fast r bad news travels slow -
“count to infinity” problem!r 44 iterations before
algorithm stabilizes: see text
Poisoned reverse: r If Z routes through Y to
get to X :m Z tells Y its (Z’s) distance
to X is infinite (so Y won’t route to X via Z)
r will this completely solve count to infinity problem?
x z14
50
y60
Network Layer
Comparison of LS and DV algorithms
Message complexityr LS: with n nodes, E links, O
(nE) msgs sent r DV: exchange between
neighbors onlym convergence time varies
Speed of Convergencer LS: O(n2) algorithm requires
O(nE) msgsm may have oscillations
r DV: convergence time variesm may be routing loopsm count-to-infinity problem
Robustness: what happens if router malfunctions?
LS: m node can advertise
incorrect link costm each node computes only
its own tableDV:
m DV node can advertise incorrect path cost
m each node’s table used by others
• error propagate thru network
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
Hierarchical Routing
scale: with 200 million destinations:
r can’t store all dest’s in routing tables!
r routing table exchange would swamp links!
administrative autonomyr internet = network of
networksr each network admin may want
to control routing in its own network
Our routing study thus far - idealization r all routers identicalr network “flat”… not true in practice
Network Layer
Hierarchical Routing
r aggregate routers into regions, “autonomous systems” (AS)
r routers in same AS run same routing protocolm “intra-AS” routing
protocolm routers in different AS
can run different intra-AS routing protocol
Gateway routerr Direct link to router in
another AS
Network Layer
3b
1d
3a
1c2aAS3
AS1AS2
1a
2c2b
1b
Intra-ASRouting algorithm
Inter-ASRouting algorithm
Forwardingtable
3c
Interconnected ASes
r forwarding table configured by both intra- and inter-AS routing algorithmm intra-AS sets entries
for internal destsm inter-AS & intra-As
sets entries for external dests
Network Layer
3b
1d
3a
1c2aAS3
AS1AS2
1a
2c2b
1b
3c
Inter-AS tasksr suppose router in AS1
receives datagram destined outside of AS1:m router should
forward packet to gateway router, but which one?
AS1 must:1. learn which dests are
reachable through AS2, which through AS3
2. propagate this reachability info to all routers in AS1
Job of inter-AS routing!
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
Intra-AS Routing
r also known as Interior Gateway Protocols (IGP)r most common Intra-AS routing protocols:
m RIP: Routing Information Protocol
m OSPF: Open Shortest Path First
m IGRP: Interior Gateway Routing Protocol (Cisco proprietary)
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
RIP ( Routing Information Protocol)
r distance vector algorithmr included in BSD-UNIX Distribution in 1982r distance metric: # of hops (max = 15 hops)
DC
BA
u vw
x
yz
destination hops u 1 v 2 w 2 x 3 y 3 z 2
From router A to subnets:
Network Layer
RIP advertisements
r distance vectors: exchanged among neighbors every 30 sec via Response Message (also called advertisement)
r each advertisement: list of up to 25 destination subnets within AS
Network Layer
RIP: Example
Destination Network Next Router Num. of hops to dest. w A 2
y B 2 z B 7
x -- 1…. …. ....
w x y
z
A
C
D B
Routing/Forwarding table in D
Network Layer
RIP: Example
Destination Network Next Router Num. of hops to dest. w A 2
y B 2 z B A 7 5
x -- 1…. …. ....
Routing/Forwarding table in D
w x y
z
A
C
D B
Dest Next hops w - 1 x - 1 z C 4 …. … ...
Advertisementfrom A to D
Network Layer
RIP: Link Failure and Recovery If no advertisement heard after 180 sec -->
neighbor/link declared deadm routes via neighbor invalidatedm new advertisements sent to neighborsm neighbors in turn send out new advertisements (if
tables changed)m link failure info quickly (?) propagates to entire netm poison reverse used to prevent ping-pong loops
(infinite distance = 16 hops)
Network Layer
RIP Table processing
r RIP routing tables managed by application-level process called route-d (daemon)
r advertisements sent in UDP packets, periodically repeated
physicallink
network forwarding (IP) table
Transprt (UDP)
routed
physicallink
network (IP)
Transprt (UDP)
routed
forwarding
table
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
OSPF (Open Shortest Path First)
r “open”: publicly availabler uses Link State algorithm
m LS packet disseminationm topology map at each nodem route computation using Dijkstra’s algorithm
r OSPF advertisement carries one entry per neighbor router
r advertisements disseminated to entire AS (via flooding)m carried in OSPF messages directly over IP (rather than TCP
or UDP
Network Layer
OSPF “advanced” features (not in RIP)
r security: all OSPF messages authenticated (to prevent malicious intrusion)
r multiple same-cost paths allowed (only one path in RIP)
r For each link, multiple cost metrics for different TOS (e.g., satellite link cost set “low” for best effort; high for real time)
r integrated uni- and multicast support: m Multicast OSPF (MOSPF) uses same topology data
base as OSPFr hierarchical OSPF in large domains.
Network Layer
Hierarchical OSPF
Network Layer
Hierarchical OSPF
r two-level hierarchy: local area, backbone.m Link-state advertisements only in area m each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.r area border routers: “summarize” distances to nets
in own area, advertise to other Area Border routers.r backbone routers: run OSPF routing limited to
backbone.r boundary routers: connect to other AS’s.
Network Layer
Chapter 4: Network Layer
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP
Network Layer
Internet inter-AS routing: BGP
r BGP (Border Gateway Protocol): the de facto standard
r BGP provides each AS a means to:1. Obtain subnet reachability information from
neighboring ASs.2. Propagate reachability information to all AS-
internal routers.3. Determine “good” routes to subnets based on
reachability information and policy.r allows subnet to advertise its existence to
rest of Internet: “I am here”
Network Layer
BGP basicsr pairs of routers (BGP peers) exchange routing info
over semi-permanent TCP connections: BGP sessionsm BGP sessions need not correspond to physical
links.r when AS2 advertises a prefix to AS1:
m AS2 promises it will forward datagrams towards that prefix.
m AS2 can aggregate prefixes in its advertisement
3b
1d
3a
1c2aAS3
AS1
AS21a
2c
2b
1b
3ceBGP session
iBGP session
Network Layer
Path attributes & BGP routes
r advertised prefix includes BGP attributes. m prefix + attributes = “route”
r two important attributes:m AS-PATH: contains ASs through which prefix
advertisement has passed: e.g, AS 67, AS 17 m NEXT-HOP: indicates specific internal-AS router
to next-hop AS. (may be multiple links from current AS to next-hop-AS)
r when gateway router receives route advertisement, uses import policy to accept/decline.
Network Layer
BGP route selection
r router may learn about more than 1 route to some prefix. Router must select route.
r elimination rules:1. local preference value attribute: policy decision2. shortest AS-PATH 3. closest NEXT-HOP router: hot potato routing4. additional criteria
Network Layer
BGP messages
r BGP messages exchanged using TCP.r BGP messages:
m OPEN: opens TCP connection to peer and authenticates sender
m UPDATE: advertises new path (or withdraws old)m KEEPALIVE keeps connection alive in absence of
UPDATES; also ACKs OPEN requestm NOTIFICATION: reports errors in previous msg;
also used to close connection
Network Layer
Chapter 4: summary
r 4. 1 Introductionr 4.2 Virtual circuit and
datagram networksr 4.3 What’s inside a
routerr 4.4 IP: Internet
Protocolm Datagram formatm IPv4 addressingm ICMPm IPv6
r 4.5 Routing algorithmsm Link statem Distance Vectorm Hierarchical routing
r 4.6 Routing in the Internetm RIPm OSPFm BGP