Title: Chapter 4: Network Layer
1Chapter 4 Network Layer
- 4. 1 Introduction
- 4.2 Virtual circuit and datagram networks
- 4.3 Whats inside a router
- 4.4 IP Internet Protocol
- Datagram format
- IPv4 addressing
- ICMP
- IPv6
- 4.5 Routing algorithms
- Link state
- Distance Vector
- Hierarchical routing
- 4.6 Routing in the Internet
- RIP
- OSPF
- BGP
- 4.7 Broadcast and multicast routing
2Two Key Network-Layer Functions
- analogy
- routing process of planning trip from source to
dest - forwarding process of getting through single
interchange
- forwarding move packets from routers input to
appropriate router output - routing determine route taken by packets from
source to dest. - routing algorithms
3Router Architecture Overview
- Two key router functions
- run routing algorithms/protocol (RIP, OSPF, BGP)
- forwarding datagrams from incoming to outgoing
link
4The Internet Network layer
- Host, router network layer functions
Transport layer TCP, UDP
Network layer
Link layer
physical layer
5IP Fragmentation Reassembly
- network links have MTU (max.transfer size) -
largest possible link-level frame. - different link types, different MTUs
- large IP datagram divided (fragmented) within
net - one datagram becomes several datagrams
- reassembled only at final destination
- IP header bits used to identify, order related
fragments
fragmentation in one large datagram out 3
smaller datagrams
reassembly
6IP Addressing introduction
223.1.1.1
- IP address 32-bit identifier for host, router
interface - interface connection between host/router and
physical link - routers typically have multiple interfaces
- host typically has one interface
- IP addresses associated with each interface
223.1.2.9
223.1.1.4
223.1.1.3
223.1.1.1 11011111 00000001 00000001 00000001
223
1
1
1
7IP addressing CIDR
- CIDR Classless InterDomain Routing
- subnet portion of address of arbitrary length
- address format a.b.c.d/x, where x is bits in
subnet portion of address
8Hierarchical addressing more specific routes
ISPs-R-Us has a more specific route to
Organization 1
Organization 0
Send me anything with addresses beginning
200.23.16.0/20
Organization 2
Fly-By-Night-ISP
Internet
Organization 7
Send me anything with addresses beginning
199.31.0.0/16 or 200.23.18.0/23
ISPs-R-Us
Organization 1
9A Link-State Routing Algorithm
- Dijkstras algorithm
- net topology, link costs known to all nodes
- accomplished via link state broadcast
- all nodes have same info
- computes least cost paths from one node
(source) to all other nodes - gives forwarding table for that node
- iterative after k iterations, know least cost
path to k dest.s
- Notation
- c(x,y) link cost from node x to y 8 if not
direct neighbors - D(v) current value of cost of path from source
to dest. v - p(v) predecessor node along path from source to
v - N' set of nodes whose least cost path
definitively known
10Distance Vector Algorithm
- Bellman-Ford Equation (dynamic programming)
- Define
- dx(y) cost of least-cost path from x to y
- Then
- dx(y) min c(x,v) dv(y)
- where min is taken over all neighbors v of x
v
11Comparison of LS and DV algorithms
- Message complexity
- LS with n nodes, E links, O(nE) msgs sent
- DV exchange between neighbors only
- convergence time varies
- Speed of Convergence
- LS O(n2) algorithm requires O(nE) msgs
- may have oscillations
- DV convergence time varies
- may be routing loops
- count-to-infinity problem
- Robustness what happens if router malfunctions?
- LS
- node can advertise incorrect link cost
- each node computes only its own table
- DV
- DV node can advertise incorrect path cost
- each nodes table used by others
- error propagate thru network
12Hierarchical 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
- Gateway router
- Direct link to router in another AS
13Internet inter-AS routing BGP
- BGP (Border Gateway Protocol) the de facto
standard - BGP provides each AS a means to
- Obtain subnet reachability information from
neighboring ASs. - Propagate reachability information to all
AS-internal routers. - Determine good routes to subnets based on
reachability information and policy. - allows subnet to advertise its existence to rest
of Internet I am here
14BGP basics
- pairs of routers (BGP peers) exchange routing
info over semi-permanent TCP connections BGP
sessions - BGP sessions need not correspond to physical
links. - when AS2 advertises prefix to AS1
- AS2 promises it will forward any addresses
datagrams towards that prefix. - AS2 can aggregate prefixes in its advertisement
eBGP session
iBGP session
3a
3b
2a
AS3
AS2
1a
AS1
15Multicast Routing Problem Statement
- Goal find a tree (or trees) connecting routers
having local mcast group members - tree not all paths between routers used
- source-based different tree from each sender to
rcvrs - shared-tree same tree used by all group members
Shared tree
16Shortest Path Tree
- mcast forwarding tree tree of shortest path
routes from source to all receivers - Dijkstras algorithm
S source
LEGEND
R1
R4
router with attached group member
R2
router with no attached group member
R5
link used for forwarding, i indicates order
link added by algorithm
R3
R7
R6
17Reverse Path Forwarding
- rely on routers knowledge of unicast shortest
path from it to sender - each router has simple forwarding behavior
- if (mcast datagram received on incoming link on
shortest path back to center) - then flood datagram onto all outgoing links
- else ignore datagram
18Consequences of Sparse-Dense Dichotomy
- Dense
- group membership by routers assumed until routers
explicitly prune - data-driven construction on mcast tree (e.g.,
RPF) - bandwidth and non-group-router processing
profligate
- Sparse
- no membership until routers explicitly join
- receiver- driven construction of mcast tree
(e.g., center-based) - bandwidth and non-group-router processing
conservative
19Link Layer Services
- framing, link access
- encapsulate datagram into frame, adding header,
trailer - channel access if shared medium
- MAC addresses used in frame headers to identify
source, dest - different from IP address!
- reliable delivery between adjacent nodes
- we learned how to do this already (chapter 3)!
- seldom used on low bit-error link (fiber, some
twisted pair) - wireless links high error rates
- Q why both link-level and end-end reliability?
20Checksumming Cyclic Redundancy Check
- view data bits, D, as a binary number
- choose r1 bit pattern (generator), G
- goal choose r CRC bits, R, such that
- ltD,Rgt exactly divisible by G (modulo 2)
- receiver knows G, divides ltD,Rgt by G. If
non-zero remainder error detected! - can detect all burst errors less than r1 bits
- widely used in practice (802.11 WiFi, ATM)
21Byte Stuffing
- data transparency requirement data field must
be allowed to include flag pattern lt01111110gt - Q is received lt01111110gt data or flag?
- Sender adds (stuffs) extra lt 01111110gt byte
after each lt 01111110gt data byte - Receiver
- two 01111110 bytes in a row discard first byte,
continue data reception - single 01111110 flag byte
22Multiple Access Links and Protocols
- Two types of links
- point-to-point
- PPP for dial-up access
- point-to-point link between Ethernet switch and
host - broadcast (shared wire or medium)
- old-fashioned Ethernet
- upstream HFC
- 802.11 wireless LAN
humans at a cocktail party (shared air,
acoustical)
shared wire (e.g., cabled Ethernet)
shared RF (e.g., 802.11 WiFi)
shared RF (satellite)
23Multiple Access protocols
- single shared broadcast channel
- two or more simultaneous transmissions by nodes
interference - collision if node receives two or more signals at
the same time - multiple access protocol
- distributed algorithm that determines how nodes
share channel, i.e., determine when node can
transmit - communication about channel sharing must use
channel itself! - no out-of-band channel for coordination
24MAC Protocols a taxonomy
- Three broad classes
- Channel Partitioning
- divide channel into smaller pieces (time slots,
frequency, code) - allocate piece to node for exclusive use
- Random Access
- channel not divided, allow collisions
- recover from collisions
- Taking turns
- nodes take turns, but nodes with more to send can
take longer turns
25Random Access Protocols
- When node has packet to send
- transmit at full channel data rate R.
- no a priori coordination among nodes
- two or more transmitting nodes ? collision,
- random access MAC protocol specifies
- how to detect collisions
- how to recover from collisions (e.g., via delayed
retransmissions) - Examples of random access MAC protocols
- slotted ALOHA
- ALOHA
- CSMA, CSMA/CD, CSMA/CA
26Goodput vs. Offered Load
0.4
0.3
Goodput
0.2
0.1
1.5
2.0
0.5
1.0
offered load Np
How to improve goodput without relying on global
coordination or synchronization Add
activity-sensitive behavior to distributed nodes
Carrier sense and Collision detection
27CSMA/CD (Collision Detection)
- CSMA/CD carrier sensing, deferral as in CSMA
- collisions detected within short time
- colliding transmissions aborted, reducing channel
wastage - collision detection
- easy in wired LANs measure signal strengths,
compare transmitted, received signals - difficult in wireless LANs received signal
strength overwhelmed by local transmission
strength
28Ethernet CSMA/CD algorithm
- 1. NIC receives datagram from network layer,
creates frame - 2. If NIC senses channel idle, starts frame
transmission If NIC senses channel busy, waits
until channel idle, then transmits - 3. If NIC transmits entire frame without
detecting another transmission, NIC is done with
frame !
- 4. If NIC detects another transmission while
transmitting, aborts and sends jam signal - 5. After aborting, NIC enters exponential
backoff after mth collision, NIC chooses K at
random from 0,1,2,,2m-1. NIC waits K?512 bit
times, returns to Step 2 -
29ARP Address Resolution Protocol
- Each IP node (host, router) on LAN has ARP table
- ARP table IP/MAC address mappings for some LAN
nodes - lt IP address MAC address TTLgt
- TTL (Time To Live) time after which address
mapping will be forgotten (typically 20 min)
137.196.7.78
1A-2F-BB-76-09-AD
137.196.7.23
137.196.7.14
LAN
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
137.196.7.88
30DHCP Dynamic Host Configuration Protocol
- Goal allow host to dynamically obtain its IP
address from network server when joining network - support for mobile users joining network
- host holds address only while connected and on
(allowing address reuse) - renew address already in use
- DHCP overview
- 1. host broadcasts DHCP discover msg
- 2. DHCP server responds with DHCP offer msg
- 3. host requests IP address DHCP request msg
- 4. DHCP server sends address DHCP ack msg
31IEEE 802.11 multiple access
- avoid collisions 2 nodes transmitting at same
time - 802.11 CSMA - sense before transmitting
- dont collide with ongoing transmission by other
node - 802.11 no collision detection!
- difficult to receive (sense collisions) when
transmitting due to weak received signals
(fading) - cant sense all collisions in any case hidden
terminal, fading - goal avoid collisions CSMA/C(ollision)A(voidance
)
32IEEE 802.11 MAC Protocol CSMA/CA
- 802.11 sender
- 1 if sense channel idle for DIFS then
- transmit entire frame (no CD)
- 2 if sense channel busy then
- start random backoff time
- timer counts down while channel idle
- transmit when timer expires
- if no ACK, increase random backoff interval,
repeat 2 - 802.11 receiver
- - if frame received OK
- return ACK after SIFS (ACK needed due to
hidden terminal problem)
sender
receiver
33Collision Avoidance RTS-CTS exchange
A
B
AP
defer
time
34Components of cellular network architecture
35Multimedia and Quality of Service What is it?
multimedia applications network audio and
video (continuous media)
36MM Networking Applications
- Fundamental characteristics
- typically delay sensitive
- end-to-end delay
- delay jitter
- loss tolerant infrequent losses cause minor
glitches - antithesis of data, which are loss intolerant but
delay tolerant.
- Classes of MM applications
- 1) stored streaming
- 2) live streaming
- 3) interactive, real-time
Jitter is the variability of packet delays
within the same packet stream
37Streaming Multimedia Client Buffering
constant bit rate video transmission
Cumulative data
time
- client-side buffering, playout delay compensate
for network-added delay, delay jitter
38Internet Phone Packet Loss and Delay
- network loss IP datagram lost due to network
congestion (router buffer overflow) - delay loss IP datagram arrives too late for
playout at receiver - delays processing, queueing in network
end-system (sender, receiver) delays - typical maximum tolerable delay 400 ms
- loss tolerance depending on voice encoding,
losses concealed, packet loss rates between 1
and 10 can be tolerated.
39Adaptive Playout Delay (1)
- Goal minimize playout delay, keeping late loss
rate low - Approach adaptive playout delay adjustment
- estimate network delay, adjust playout delay at
beginning of each talk spurt. - silent periods compressed and elongated.
- chunks still played out every 20 msec during talk
spurt.
dynamic estimate of average delay at receiver
where u is a fixed constant (e.g., u .01).
40Content distribution networks (CDNs)
origin server in North America
- Content replication
- challenging to stream large files (e.g., video)
from single origin server in real time - solution replicate content at hundreds of
servers throughout Internet - content downloaded to CDN servers ahead of time
- placing content close to user avoids
impairments (loss, delay) of sending content over
long paths - CDN server typically in edge/access network
CDN distribution node
CDN server in S. America
CDN server in Asia
CDN server in Europe
41Real-Time Protocol (RTP)
- RTP runs in end systems
- RTP packets encapsulated in UDP segments
- interoperability if two Internet phone
applications run RTP, then they may be able to
work together
- RTP specifies packet structure for packets
carrying audio, video data - RFC 3550
- RTP packet provides
- payload type identification
- packet sequence numbering
- time stamping
42Real-Time Control Protocol (RTCP)
- feedback can be used to control performance
- sender may modify its transmissions based on
feedback
- works in conjunction with RTP.
- each participant in RTP session periodically
transmits RTCP control packets to all other
participants. - each RTCP packet contains sender and/or receiver
reports - report statistics useful to application
packets sent, packets lost, interarrival
jitter, etc.
43How should the Internet evolve to better support
multimedia?
- Integrated services philosophy
- fundamental changes in Internet so that apps can
reserve end-to-end bandwidth - requires new, complex software in hosts routers
- Laissez-faire
- no major changes
- more bandwidth when needed
- content distribution, application-layer multicast
- application layer
- Differentiated services philosophy
- fewer changes to Internet infrastructure, yet
provide 1st and 2nd class service
44Providing Multiple Classes of Service
- thus far making the best of best effort service
- one-size fits all service model
- alternative multiple classes of service
- partition traffic into classes
- network treats different classes of traffic
differently (analogy VIP service vs regular
service)
- granularity differential service among multiple
classes, not among individual connections - history ToS bits
0111
45Scheduling And Policing Mechanisms
- scheduling choose next packet to send on link
- FIFO (first in first out) scheduling send in
order of arrival to queue - real-world example?
- discard policy if packet arrives to full queue
who to discard? - Tail drop drop arriving packet
- priority drop/remove on priority basis
- random drop/remove randomly
46Scheduling Policies still more
- Weighted Fair Queuing
- generalized Round Robin
- each class gets weighted amount of service in
each cycle - real-world example?
47Policing Mechanisms
- Token Bucket limit input to specified Burst Size
and Average Rate. - bucket can hold b tokens
- tokens generated at rate r token/sec unless
bucket full - over interval of length t number of packets
admitted less than or equal to (r t b).
48Policing Mechanisms (more)
- token bucket, WFQ combine to provide guaranteed
upper bound on delay, i.e., QoS guarantee!
49Diffserv Architecture
- Edge router
- per-flow traffic management
- marks packets as in-profile and out-profile
- Core router
- per class traffic management
- buffering and scheduling based on marking at
edge - preference given to in-profile packets