Date post: | 08-Apr-2018 |
Category: |
Documents |
Upload: | seif-hawamdeh |
View: | 216 times |
Download: | 0 times |
of 92
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
1/92
Network Layer 4-1
Chapter 4Network Layer
Computer Networking:A Top Down ApproachFeaturing the Internet,3rd edition.
Jim Kurose, Keith RossAddison-Wesley, July2004.
A note on the use of these ppt slides:Were making these slides freely available to all (faculty, students, readers).
Theyre in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
represent a lotof work on our part. In return for use, we only ask thefollowing:
If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, wed like people to use our book!) If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
note our copyright of this material.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2004
J.F Kurose and K.W. Ross, All Rights Reserved
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
2/92
Network Layer 4-2
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol Datagram format
IPv4 addressing ICMP
IPv6
4.5 Routing algorithms
Link state Distance Vector
Hierarchical routing
4.6 Routing in theInternet RIP
OSPF
BGP 4.7 Broadcast and
multicast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
3/92
Network Layer 4-3
Network layer delivers the segments from
the sending to the receivinghosts
on the sending side, itencapsulates the segmentsinto datagrams
on the receiving side, it
delivers the segments to thetransport layer
network layer protocols existin everyhost and router
the router examines theheader fields in all IPdatagrams passing through it
networkdata linkphysical
networkdata linkphysical
networkdata link
physical
networkdata linkphysical
networkdata linkphysical
network
data linkphysical
networkdata linkphysical
network
data linkphysical
applicationtransportnetworkdata linkphysical
applicationtransportnetwork
data linkphysical
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
4/92
Network Layer 4-4
Key Network-Layer Functions forwarding:moving the
packets from the routerinput to appropriaterouter output locally
routing:determining theend-to-end route to betaken by the packetsfrom source to
destination using routingalgorithms& updatingthe forwarding tables
analogy:
routing: the process ofplanning a trip fromsource to destination
forwarding: the processof getting through asingle street interchange
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
5/92
Network Layer 4-5
1
23
0111
value in arriving
packets header
routing algorithm
local forwarding tableheader value output link
0100
0101
0111
1001
3
2
2
1
Interplay between routing and forwarding
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
6/92
Network Layer 4-6
Packet Switching DevicesA packet-switching device can be either:
A link-layer switch (or layer-2 switch): The forwarding decision is based on a value (usually the
physical address or MAC address) in the data-link layerheader (chap 5)
A network layer switch (or layer-3 switch or router): The forwarding decision is based on a value (usually thelogical address or IP address) in the network layer header
The routing algorithm, which can be centralized or
distributed, determines the entries of the routersforwarding table
The router receives routing protocol messages, which areused to configure the forwarding tables.
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
7/92
Network Layer 4-7
Connection setup 3rd important function (after routing and
forwarding) in somenetwork architectures: ATM, frame relay, X.25 (virtual-circuit switching)
before the datagrams flow, the two hosts and
the intervening routers establish a virtualconnection i.e.; the routers get involved in the connection setup
network & transport layer connection service:Network layer: between two hosts
Transport layer: between two processes
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
8/92
Network Layer 4-8
Network service modelQ: What is the service modelof the channeltransporting datagrams from a sender to a receiver?
Example services forindividual datagrams:
guaranteed delivery
guaranteed delay:e.g. delivery withless than 40 msec
Example services for aflow of datagrams:
in-order datagram
delivery guaranteed minimum
bandwidth to flow
guaranteed maximumjitter: restrictions onchanges in inter-packetspacing (maximum jitter)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
9/92
Network Layer 4-9
Network layer service models:Network
Architecture
Internet
ATM
ATM
ATM
ATM
Service
Model
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constant
rateguaranteed
rate
guaranteed
minimum
none
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestion
feedback
no
no
congestionno
congestion
yes
no
Guarantees ?
ATM: Asynchronous Transfer Mode
CBR: Constant Bit Rate, VBR: Variable Bit Rate
ABR: Available Bit Rate, UBR: Unspecified Bit Rate
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
10/92
Network Layer 4-10
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
11/92
Network Layer 4-11
Network-layer connection andconnection-less service
Datagram networks provide network-layer
connectionless service VC network provides network-layer connection
service
Analogous to the transport-layer services, but: Service: host-to-host (vs. process-to-process)
No choice: network provides one service or the other
but not both (vs. both are available at the same time) Implementation: in both the core and the end systems
(vs. in the end systems only)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
12/92
Network Layer 4-12
Virtual circuits
call setup for each call beforethe data can flow
call teardown for each call afterthe data transfer is complete
each packet carries a VC identifier (not a destination hostaddress)
everyrouter on the source-destination path maintains a statefor each passing connection
the link and router resources (e.g., bandwidth, buffers) may beallocatedto the VC
source-to-dest path behaves much like telephone circuit performance-wise
network actions along source-to-dest path
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
13/92
Network Layer 4-13
VC implementationA VC consists of:
1. a path from the source to the destination2. VC numbers: one number for each link along path
3. entries in the forwarding tables of the routers
along the path packet belonging to VC carries a VC number.
the VC number must be changed on each link.
a new VC number comes from the forwarding table shorter VC field in the packet header
simpler VC setup: local independent decision
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
14/92
Network Layer 4-14
Forwarding table
12 22 32
12
3
VC number
interfacenumber
Incoming interface Incoming VC # Outgoing interface Outgoing VC #
1 12 3 222 63 1 183 7 2 171 97 3 87
Forwarding table inthe northwest router:
Routers maintain connection state information!
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
15/92
Network Layer 4-15
Virtual circuits: signaling protocols end system and routers use signaling messages to
setup, maintain, and teardown VC
used in ATM, frame-relay, and X.25
applicationtransportnetwork
data linkphysical
applicationtransportnetwork
data linkphysical
1. Initiate call
2. incoming call
3. Accept call4. Call connected5. Data flow begins 6. Receive data
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
16/92
Network Layer 4-16
Datagram networks
no call setup at the network layer
routers: no state about end-to-end connections no network-level concept of a connection
packets are forwarded using destination host address packets between the same source-destination pair may take
different paths depending on the network status and therouter decision making
applicationtransport
networkdata linkphysical
applicationtransportnetworkdata linkphysical
1. Send data 2. Receive data
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
17/92
Network Layer 4-17
Forwarding tableDestination Address Range Link Interface
11001000 00010111 00010000 00000000 (200.23.16.0)
through 0
11001000 00010111 00010111 11111111 (200.23.23.255)
11001000 00010111 00011000 00000000 (200.23.24.0)through 1
11001000 00010111 00011000 11111111 (200.23.24.255)
11001000 00010111 00011001 00000000 (200.23.25.0)through 2
11001000 00010111 00011111 11111111 (200.23.31.255)
otherwise 3
32-bit IP Address 4
billion possible entries
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
18/92
Network Layer 4-18
Longest prefix matchingPrefix 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?
for the longest prefix matching to be effective, eachoutput link interface should be responsible forforwarding a large number of contiguous addresses this is the case with the Internet addresses as they are
assigned in a hierarchical fashion
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
19/92
Network Layer 4-19
Datagram or VC networkInternet data exchange among computers
elastic services, no stricttiming requirements
smart end systems (e.g. PCs)
can adapt and perform
control and error recovery simple network core
complexity at the edge
quick and easy to add and
attach new services many link types
different characteristics
uniform service is difficult
ATM evolved from telephony
human conversation: strict timing and
reliability requirements
there is a need for
guaranteed service dumb end systems
telephones
complexity moved to
inside the network
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
20/92
Network Layer 4-20
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
21/92
Network Layer 4-21
Router Architecture Overview
There are two key router functions: running routing algorithms/protocol (RIP, OSPF, BGP)
forwardingdatagrams from incoming to outgoing link
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
22/92
Network Layer 4-22
Input Port Functions
Decentralized switching: given a packet dest., lookup the output port using
the forwarding table in input port memory an updated copy of the forwarding table is stored
in each input port avoiding a processingbottleneck at routing processor
goal: complete input port processing at line speed queuing: occurs if a new packet arrives faster
than the forwarding rate into switch fabric
Physical layer:bit-level reception
Data link layer:e.g., Ethernetsee chapter 5
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
23/92
Network Layer 4-23
Speed of the input port processing example:
an OC-48 link runs at 2.5 Gbps. Therefore, with 256 bytepackets, the lookup speed should be about 1 million lookup/sec
lookup techniques to speed-up the datagram forwarding: binary tree: N steps to lookup N-bit addresses
even not fast enough for backbone routing requirements
Content Addressable Memory (CAM): constant time using cache memory other recent techniques: log(N) steps
queuing reasons at the input port: when a new packet is received and is ready to be forwarded
before the current packet is forwarded when the forwarding of the current packet is blocked by the
switching fabric (i.e.; fabric is busy forwarding another packetfrom another input port)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
24/92
Network Layer 4-24
Three types of switching fabrics
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
25/92
Network Layer 4-25
Switching Via MemoryFirst generation routers:
traditional computers with switching under direct control of the CPU
I/O ports functioned as traditional I/O devices input ports used interrupts to signal the packet arrival
packets are then copied to the system memory CPU reads the header and then forwards the packet to an output port
speed limited by memory bandwidth (2 bus crossings per datagram) therefore, the input-to-output forwarding speed is one-half of the memory
access speed
modern routers use this method as a shared-memory multiprocessors Examples: Cisco Catalyst 8500 Series & Bay Networks Accelar 1200 Series
Input
PortOutput
Port
Memory
System Bus
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
26/92
Network Layer 4-26
Switching Via a Bus packet from input port memory to output port memory via ashared bus
one packet at a time can be transferred
bus contention: switching speed is limited by the busbandwidth (at least as fast as all input port together)
example: 1 Gbps bus, Cisco 1900: sufficient speed for accessand enterprise routers (not regional or backbone)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
27/92
Network Layer 4-27
Switching Via An Interconnection Network n x n crossbar switch with 2n busses
overcomes the bus bandwidth limitations (to a certain extent)
Advanced design: fragment the packets into fixed length cells,then switch the cells through the fabric to simplify andspeedup the switching
example: Cisco 12000: switches at up to 60 Gbps through theinterconnection network
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
28/92
Network Layer 4-28
Output Ports
Buffering(queuing) required when packets arrive from fabricfaster than the transmission rate
Scheduling disciplinechooses among queued packets fortransmission
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
29/92
Network Layer 4-29
Where does queuing and loss occur? the actual location of packet queuing and/or loss
depends on:
the traffic load (arrival rate, packet size, etc.) the relative speed of the switching fabric
the line speed
queuing reasons at the input port (review): when a new packet is received and is ready to be forwarded
before the current packet is forwarded
when the forwarding of the current packet is blocked bythe switching fabric
queuing reasons at the output port: when the arrival rate via the switching fabric exceeds the
output line speed
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
30/92
Network Layer 4-30
Output port queueing Example:
3 input ports
3 output ports line speeds are identical = S
switch fabric speed = 3S
worst case: all packets at
input ports are destined tothe same output port
queuing delay and loss due tooutput port buffer overflow!
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
31/92
Network Layer 4-31
Packet scheduling & queue management Which packet in the queue is selected next for transmission? Or
what is the scheduling scheme? Simply, First-Come-First-Served (FCFS) Weighted Fair Queuing (WFQ)
Fair share of outgoing link among end-to-end connections
What if the buffer is full? drop arriving packets (drop-tail policy) when full. But, can we do better?
Active Queue Management (AQM) algorithms:
Drop or mark the header of the arriving packet before the buffer isfilled. Why? A congestion indication to the sender Example: Random Early Detection (RED) algorithm:
Weighted average of the queue length is maintained If queue length is less than a min. threshold, accept packets
If queue length is greater than a max. threshold, mark or drop new packets If queue length is in between, drop or mark new packets based on a
probability that is a function of the queue length
Packet scheduling is very important for Quality-of-Service (QoS)guarantees
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
32/92
Network Layer 4-32
Input Port Queuing
Fabric switch is slower than the input ports combined queuing may occur at the input queues
Head-of-the-Line (HOL) blocking: queued packet atthe front of the queue prevents others in the queuefrom moving forward
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
33/92
Network Layer 4-33
Chapter 4: Network Layer 4.1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
34/92
Network Layer 4-34
The Internet Network layerHost, router network layer functions:
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
35/92
Network Layer 4-35
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
P d f
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
36/92
Network Layer 4-36
IP datagram format
ver length
32 bits
data(variable length,typically a TCP
or UDP segment)
16-bit identifierInternetchecksum
time tolive
32 bit source IP address
IP protocol version number
header length (bytes)
max number remaininghops (decremented ateach router)
for
fragmentation/reassembly
total datagramlength (bytes)
upper layer protocol
to deliver payload to(glue between networkand transport layers)
headlen
type ofservice
type of dataflgs
fragment
offsetupperlayer
32 bit destination IP address
Options (if any) E.g. timestamp,record routetaken, specifylist of routers
to visit, etc.
how much overheadwith TCP/IP typically?
20 bytes of TCP
20 bytes of IP
= 40 bytes + applayer overhead
Headerchecksum
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
37/92
Network Layer 4-37
IP Fragmentation & Reassembly network links have MTU (Max.Transmission Unit), which is thelargest possible link-level frame
different link types and hencedifferent MTUs along the route
Ethernet: 1500 bytes
Some WANs: 576 bytes
large IP datagram is divided(fragmented) within the network
one datagram becomes severaldatagrams
reassembled only at the finaldestination (keep core simple)
IP header bits are used toidentify and order the relatedfragments
fragmentation:in: one large datagramout: 3 smaller datagrams
reassembly
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
38/92
Network Layer 4-38
IP Fragmentation and ReassemblyID=x
offset=0
fragflag=0
length=4000
ID
=x
offset
=0
fragflag
=1
length
=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x offset=370fragflag
=0length=1040
One large datagram becomesseveral smaller datagrams
Example
4000 byte datagram
3980 byte payload 20 bytes IP header
MTU = 1500 bytes
1480 bytes in data field(must be multiple of 8 bytesexcept for last fragment)
offset = 1480/8
offset = (1480 + 1480)/8
3980 - 1480 - 1480 = 1020bytes in the data field
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
39/92
Network Layer 4-39
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
40/92
Network Layer 4-40
IP Addressing: introduction IP address: 32-bit ID for the
interfaceof the host or router interface:is the connection
between the host or routerand the physical link routers typically have multiple
interfaces a host typically has one
interface one IP addresses is associated
with each interface a portion of the interfaces IP
address is determined by thesubnet it is connected to
IP addresses in the globalInternet should be unique(except for interfaces behindthe NATs)
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
2231 11
Dotted-Decimal Notation
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
41/92
Network Layer 4-41
Subnets
the IP address consists of: subnet part: the x most
significant bits
host part: 32-x leastsignificant bits
whats a subnet ? a network of devices with
their interfaces having thesame subnet part of IPaddress
the devices on the samesubnet can physically reach
each other without anintervening router
Connected by a data-linklayer hub or switch
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
subnet subnet
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
42/92
Network Layer 4-42
Subnets
223.1.1.0/24223.1.2.0/24
223.1.3.0/24
Recipe To determine the subnets,
detach each interfacefrom its host or router,creating islands of isolatednetworks. Each isolatednetwork is called a subnet.
The subnet mask indicatesthe number of most
significant bits used toidentify the subnet part ofthe IP address
Subnet mask: /24 256 addresses
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
43/92
Network Layer 4-43
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.1
223.1.8.0223.1.8.1
223.1.9.1
223.1.9.2
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
44/92
Network Layer 4-44
IP addressing: Classful Addressing the old method of IP addressing
subnet addresses must be 1, 2, or 3 bytes
subnet address classes: Class A: a.b.c.d/8 (over 16 million addresses)
Class B: a.b.c.d/16 (over 65 thousand addresses)
Class C: a.b.c.d/24 (only 256 addresses) what if an organization needs only 500 addresses?
Problems with classful addressing: fast depletion of class B address space
poor utilization of the assigned number space
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
45/92
Network Layer 4-45
IP addressing: CIDR strategyCIDR: Classless InterDomain Routing
subnet portion of address can be of an arbitrary length
address format: a.b.c.d/x, where x is # bits in subnet portion of
address (also called the prefix or the network prefix) the prefix represents the network portion of the IP address
IP addresses are usually assigned to organizations in blocks ofcontiguous addresses that share a common prefix
only the x bits are considered by routers outside the organizationsnetwork
the remaining 32-x bits are used to identify device interfaces withinthe organizations network (may have additional subnetting structure)
11001000 00010111 00010000 00000000
subnetpart
hostpart
200.23.16.0/23
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
46/92
Network Layer 4-46
IP addresses: how to get one?Q: How does a hostget an IP address?
manually configured by system admin in a system file
Windows: control-panel->network->configuration->tcp/ip->properties
UNIX: /etc/rc.config
DHCP: Dynamic Host Configuration Protocol: dynamically get anIP address from a server
plug-and-play
efficient IP address utilization
efficient for mobile hosts such as laptops
(more in next chapter)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
47/92
Network Layer 4-47
IP addresses: how to get one?Q: How does a networkget the subnet part of IP
address?
A: gets allocated a portion of its provider ISPsaddress space
ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20
Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23
Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... .. . .Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
Hi hi l dd ssi : t ti
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
48/92
Network Layer 4-48
Hierarchical addressing: route aggregation
Send me anythingwith addressesbeginning200.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-UsSend me anythingwith addressesbeginning199.31.0.0/16
200.23.20.0/23Organization 2
.
.
.
...
hierarchical addressing: addresses are assigned in contiguous blocks to ISPsand then from ISPs to client organizations: allows for efficient advertisement of routing info
route (or address) aggregation is the ability to use a single prefix toadvertise multiple networks: works very well with hierarchical addressing
Hi hi l dd i ifi
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
49/92
Network Layer 4-49
Hierarchical addressing: more specific routes
ISPs-R-Us has a more specific route to Organization 1
Send me anythingwith addressesbeginning
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 7Internet
Organization 1
ISPs-R-UsSend me anythingwith addressesbeginning 199.31.0.0/16or 200.23.18.0/23
200.23.20.0/23
Organization 2
.
..
...
Fly-By-Night acquires ISPs-R-Us and connect Organization 1 through it: Organization 1 renumbers all its routers and hosts (very costly solution)
Organization 1 keeps the same numbers, which are specifically advertised byISPs-R-Us benefiting from the longest-prefix-match routing feature
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
50/92
Network Layer 4-50
IP addressing: the last word...
Q: How does an ISP get block of addresses?
A: ICANN: Internet Corporation for AssignedNames and Numbers
allocates addresses
manages DNS assigns domain names, resolves disputes
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
51/92
Network Layer 4-51
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.0/24
rest ofInternet
Datagrams with source ordestination in this networkhave 10.0.0.0/24 address forsource, destination (as usual)
Alldatagrams leavinglocalnetwork have same single sourceNAT IP address: 138.76.29.7 butwith different source port numbers
Note: 10.0.0.0/8 range is reserved for private networks
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
52/92
Network Layer 4-52
NAT: Network Address Translation Motivation: the local network uses just one IP address
as far as outside world is concerned: no need to be allocated a range of addresses from the ISP: -
just one IP address is used for all devices
can change addresses of the devices in the local networkwithout notifying the outside world
can change the ISP without changing the addresses of thedevices in the local network
devices inside the local network are not explicitly addressableor visible by the outside world (a security plus).
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
53/92
Network Layer 4-53
NAT: Network Address TranslationImplementation: NAT router must: change the header of the outgoing datagrams: replace(source
IP address, port #) of every outgoing datagram to (NAT IPaddress, new port #). . . remote clients/servers will respond using (NAT IP address,
new port #) as destination address
remember (in NAT translation table)every (source IP address,port #) to (NAT IP address, new port #) translation pair
change the header of the incoming datagrams: replace(NAT IPaddress, new port #) in dest fields of every incoming datagramwith corresponding (source IP address, port #) stored in NATtable
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
54/92
Network Layer 4-54
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.1sends datagram to128.119.40.186, 80
NAT translation tableWAN side addr LAN side addr
138.76.29.7, 5001 10.0.0.1, 3345
S: 128.119.40.186, 80D: 10.0.0.1, 3345 4
S: 138.76.29.7, 5001D: 128.119.40.186, 802
2: NAT routerchanges datagram
source addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table
S: 128.119.40.186, 80D: 138.76.29.7, 5001 3
3: Reply arrivesdest. address:138.76.29.7, 5001
4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
55/92
Network Layer 4-55
NAT: Network Address Translation
16-bit port-number field: over 60,000 simultaneous connections with a single LAN-
side address!
NAT is controversial: port addresses are meant to be used for addressing
processes not hosts causes trouble to servers running within the local network
routers should only process up to layer 3 violates end-to-end argument
NAT possibility must be taken into account by networkapplication designers, e.g., P2P applications
address shortage should instead be solved by IPv6
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
56/92
Network Layer 4-56
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
l l
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
57/92
Network Layer 4-57
ICMP: Internet Control Message Protocol
used by hosts & routers tocommunicate network-levelinformation
error reporting: unreachablehost, network, port, protocol
echo request/reply (used byping)
network-layer above IP:
ICMP msgs carried in IPdatagrams
ICMP datagrams aredecapsulated and demuxed
to the ICMP ICMP message: type & code plus
first 8 bytes of IP datagramcausing error
Type Code description
0 0 echo reply (ping)
3 0 dest. network unreachable
3 1 dest host unreachable3 2 dest protocol unreachable
3 3 dest port unreachable
3 6 dest network unknown
3 7 dest host unknown
4 0 source quench (congestioncontrol - not used)
8 0 echo request (ping)
9 0 route advertisement
10 0 router discovery
11 0 TTL expired12 0 bad IP header
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
58/92
Network Layer 4-58
Traceroute and ICMP Source sends series of
UDP segments to dest
First has TTL =1 Second has TTL=2, etc.
Unlikely port number
When nth datagram arrives
to nth router: Router discards datagram
And sends to source aTTL Expired ICMPmessage (type 11, code 0)
Message includes name &IP address of the router
When ICMP messagearrives, source calculates
RTT Traceroute does this 3
times
Stopping criterion
UDP segment eventuallyarrives at destination host
Destination returns ICMPport unreachable packet
(type 3, code 3) When source gets this
ICMP, it stops.
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
59/92
Network Layer 4-59
Chapter 4: Network Layer 4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
60/92
Network Layer 4-60
IPv6 Initial motivation: 32-bit address space is
soon to be completely allocated.
Additional motivation: header format helps speed processing/forwarding
header changes are to facilitate QoS
IPv6 datagram format:
fixed-length 40 byte header
no fragmentation allowed at intermediate routers
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
61/92
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
62/92
Network Layer 4-62
Other Changes from IPv4 Fragmentation/reassembly:not allowed any more
Too large packets are dropped by the router
A Packet Too Big ICMP error message is sent to source
Checksum: removed entirely to reduce processingtime at each hop
Options:allowed, but outside of header, indicatedby Next Header field
ICMPv6:new version of ICMP additional message types, e.g. Packet Too Big
multicast group management functions
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
63/92
Network Layer 4-63
Transition From IPv4 To IPv6 Not all routers can be upgraded simultaneously
no flag day (all machines are turned off & upgraded together)
How will the network operate with mixed IPv4 and IPv6 routers?
Dual-stack (IPv6/IPv4) nodes: should be able to know if other nodes are dual-stack: DNS
two IPv6-capable nodes may end-up communicating using IPv4 ifan intermediate node in between is not
Tunneling:IPv6 carried as payload in IPv4 datagramamong IPv4 routers
Tunneling
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
64/92
Network Layer 4-64
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: A
Dest: F
data
Flow: XSrc: A
Dest: F
data
Flow: XSrc: ADest: F
data
Src:B
Dest: E Flow: XSrc: ADest: F
data
Src:B
Dest: E
A-to-B:IPv6
E-to-F:IPv6
B-to-C:IPv6 inside
IPv4
B-to-C:IPv6 inside
IPv4
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
65/92
Interplay between routing and forwarding
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
66/92
Network Layer 4-66
1
23
0111
value in arriving
packets header
routing algorithm
local forwarding tableheader value output link
0100
0101
0111
1001
3
2
2
1
Graph abstraction
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
67/92
Network Layer 4-67
u
yx
wv
z2
2
13
1
1
2
53
5
Graph: G = (N,E)
N = set of nodes (or routers ) = { u, v, w, x, y, z }
E = set of edges (or links ) = { (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
Graph abstraction
Remark: Graph abstraction is useful in other network contexts
Example: P2P, where N is set of peers and E is set of TCP connections
Graph abstraction: costs
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
68/92
Network Layer 4-68
Graph abstract on costs
u
yx
wv
z
2
21
3
1
12
53
5 c(a,b) = cost of link (a,b)
- e.g., c(w,z) = 5
cost could always be 1, orinversely related tobandwidth, or inverselyrelated to congestion
Cost of path (x1, x2, x3,, xp) = c(x1,x2) + c(x2,x3) + + c(xp-1,xp)
Question: Whats the least-cost path between u and z ?
Routing algorithm: algorithm that finds least-cost path
Default, first-hop,
or source router
Destination router
Routing Algorithm classification
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
69/92
Network Layer 4-69
Routing Algorithm classification
Global or decentralized?Global:
all routers have complete
topology & link cost info link state or LS algorithms
Decentralized:
router only knows thephysically-connected neighbors& the link costs to them
iterative process ofcomputation, exchange of info
with neighbors distance vector or DS
algorithms
Static or dynamic?Static:
routes change very slowly
over time e.g. manually updated tables
Dynamic:
routes change more quickly
periodic update
in response to topologyor link cost changes
adapts to network status
susceptible to routing loopsand oscillation in routes
Chapter 4: Network Layer
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
70/92
Network Layer 4-70
Chapter 4: Network Layer
4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
A Link-State (LS) Routing Algorithm
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
71/92
Network Layer 4-71
A Link State (LS) Routing Algorithm
Dijkstras algorithm network topology and link
costs are known to all nodes
accomplished via linkstate broadcast
all nodes have the sameinformation
computes least cost pathsfrom one node (source) toall other nodes gives the forwarding table
for that node
iterative: after kiterations,it knows the least cost pathto kdestinations
Notation: c(x,y): the link cost from node
x to y; c(X,Y) = if X and Y
are not direct neighbors D(v): the current value of the
cost of the path from source todestination v
p(v): the predecessor nodealong the path from source to v
N': the set of nodes whoseleast cost path are definitively
known
Dijsktras Algorithm
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
72/92
Network Layer 4-72
Dijsktra s Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u5 then D(v) = c(u,v)
6 else D(v) =
7
8 Loop9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known14 least-cost path cost to w plus cost from w to v */
15 until all nodes in N'
Dijkstras algorithm: example
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
73/92
Network Layer 4-73
Dijkstra s algorithm example
Step
0
1
2
3
4
5
N'
u
ux
uxy
uxyv
uxyvw
uxyvwz
D(v),p(v)
2,u
2,u
2,u
D(w),p(w)
5,u
4,x
3,y
3,y
D(x),p(x)
1,u
D(y),p(y)
2,x
D(z),p(z)
4,y4,y
4,y
u
yx
wv
z2
2
13
1
1
2
53
5
Dijkstras algorithm: example (2)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
74/92
Network Layer 4-74
Dijkstra s algorithm example (2)
u
yx
wv
z
Resulting shortest-path tree from u:
v
xy
w
z
(u,v)
(u,x)(u,x)
(u,x)
(u,x)
destination link
Resulting forwarding table in u:
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
75/92
Chapter 4: Network Layer
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
76/92
Network Layer 4-76
p L y
4. 1 Introduction
4.2 Virtual circuit anddatagram networks
4.3 Whats inside arouter
4.4 IP: InternetProtocol 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 andmulticast routing
Distance Vector (DV) Algorithm
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
77/92
Network Layer 4-77
( ) g
Based on Bellman-Ford Equation (dynamic programming)
Definedx(y) : is the total cost of least-cost path from x to y
dx(y) = min {c(x,v) + dv(y) }
where min is taken over all neighbors v of x
v
Distributed: each node receives info from direct neighbors, runs thealgorithm, and redistribute the results back to direct neighbors
Iterative: same process continues until no more changes are possible Self-terminating: the algorithm finally converges Asynchronous: does not require all nodes to operate simultaneously
Bellman-Ford example
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
78/92
Network Layer 4-78
u
yx
wv
z
2
21
3
1
12
53
5
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) }= min {2 + 5, 1 + 3, 5 + 3}
= 4
The node that achieves the minimum cost is the nexthop in the path in forwarding table
Using B-F equation:
Distance Vector Algorithm
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
79/92
Network Layer 4-79
g
Dx(y) = estimate of least cost from x to y
Distance vector: Dx = [Dx(y): y
N ] Least cost estimate to every node in the network
Node x:
knows cost to each neighbor v: c(x,v)maintains Dx = [Dx(y): y N ]
maintains its neighbors distance vectors For each neighbor v, x maintains Dv = [Dv(y): y N ]
Distance vector algorithm (4)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
80/92
Network Layer 4-80
g ( )
Basic idea:
Each node periodically sends its own distancevector estimate to neighbors
When a node x receives new DV estimate fromneighbor, it updates its own DV using B-F equation:
Dx(y)minv{c(x,v) + Dv(y)} for each node y N
Under normal conditions, the estimateDx(y)
converge to the actual least costdx(y)
Distance Vector Algorithm (5)
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
81/92
Network Layer 4-81
Iterative, asynchronous:each local iteration caused by:
local link cost change
DV update message from aneighbor
Distributed:
each node notifies neighborsonlywhen its DV changes neighbors then notify their
neighbors if necessary
waitfor (change in local linkcost or msg from neighbor)
recomputeestimates
if DV to any dest has
changed, notifyneighbors
Each node:
node x table
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
82/92
Network Layer 4-82
x y z
xy
z
0 2 7
from
cost to
from
from
x y z
xy
z
0 2 3
from
cost tox y z
xy
z
0 2 3
from
cost to
x y z
x
yz
cost tox y z
x
yz
0 2 7
fro
m
cost to
x y z
x
yz
0 2 3
from
cost to
x y z
xyz
0 2 3
from
cost tox y z
xyz
0 2 7
from
cost to
x y z
xyz
7 1 0
cost to
2 0 1
2 0 1
7 1 0
2 0 17 1 0
2 0 13 1 0
2 0 1
3 1 0
2 0 1
3 1 0
2 0 1
3 1 0
time
xz
12
7
y
node y table
node z table
Distance Vector: link cost changes
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
83/92
Network Layer 4-83
Link cost changes: node detects local link cost change
updates routing info, recalculatesdistance vector
if DV changes, notify neighbors
goodnewstravels
fast
x z
14
50
y1
At time t0, ydetects the link-cost change, updates its DV,
and informs its neighbors.
At time t1, zreceives the update from yand updates its table.It computes a new least cost to x and sends its neighbors its DV.
At time t2, yreceives zs update and updates its distance table.ys least costs do not change and hence y does notsend anymessage to z.
Distance Vector: link cost changes
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
84/92
Network Layer 4-84
Link cost changes: good news travels fast
bad news travels slow - count toinfinity problem!
44 iterations before algorithmstabilizes
Poisoned-reverse solution: If Z routes through Y to get to X :
Z tells Y its (Zs) distance to X is
infinity (so Y wont route to X via Z) will this completely solve count to
infinity problem? No.
x z
14
50
y60
before the change y x = 4 z y x = 5
after the change, y doesntknow that z routes to x via y Y z x = 1 + 5 = 6 A routing loop is created Y informs z of the change
z changes to z y x = 6 + 1 = 7 z informs y of the change
and so on ..
Comparison of LS and DV algorithms
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
85/92
Network Layer 4-85
Message complexity LS: with n nodes, E links,
O(nE) msgs sent
DV: exchange betweenneighbors only
convergence time varies
Speed of Convergence
LS: O(n2
) algorithm requiresO(nE) msgs
may have oscillations
DV: convergence time varies
may be routing loops
count-to-infinity problem
Robustness: what happens ifrouter malfunctions?
LS (more robust):
node can advertiseincorrect linkcost
each node computes onlyits owntable
DV (less robust): DV node can advertise
incorrectpathcost
each nodes table used byothers
error propagate thrunetwork
Chapter 4: Network Layer
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
86/92
Network Layer 4-86
4. 1 Introduction
4.2 Virtual circuit and
datagram networks 4.3 Whats inside a
router
4.4 IP: InternetProtocol Datagram format
IPv4 addressing
ICMP IPv6
4.5 Routing algorithms Link state
Distance Vector Hierarchical routing
4.6 Routing in theInternet RIP
OSPF
BGP
4.7 Broadcast andmulticast routing
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
87/92
Hierarchical RoutingS l i
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
88/92
Network Layer 4-88
Solution: organize routers into autonomous systems (AS)
each AS is a group of routers that are under the sameadmin control
routers in same AS run same routing protocol intra-AS routing protocol
routers in different AS can run different intra-AS routingprotocol
Gateway router direct link to a routers in another AS
Interconnected ASes
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
89/92
Network Layer 4-89
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
Intra-ASRouting
algorithm
Inter-ASRouting
algorithm
Forwarding
table
3c
Forwarding table isconfigured by both intra-and inter-AS routing
algorithm Intra-AS sets entries for
internal dests
Inter-AS & Intra-AS setsentries for external dests
same inter-AS routingprotocol in all ASs
Inter-AS tasks S s t i AS1 AS1 ds t :
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
90/92
Network Layer 4-90
3b
1d
3a
1c2aAS3
AS1
AS21a
2c2b
1b
3c
Suppose a router in AS1receives a datagram ofwhich the dest is outsideof AS1
Router should forwardpacket towards one of thegateway routers, butwhich one?
AS1 needs to:1. learn which dests are
reachable through AS2and which through AS3
2. propagate thisreachability info to allrouters in AS1
A job of the inter-AS routing!
Example: Setting forwarding table in router 1d
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
91/92
Network Layer 4-91
Suppose AS1 learns from the inter-AS protocolthat subnet xis reachable from AS3 (gateway 1c)but not from AS2.
Intra-AS protocol propagates reachability info toall internal routers.
Router 1d determines from intra-AS routing info
that its interface I is on the least cost path to 1c. Puts in forwarding table entry (x,I).
Example: Choosing among multiple ASes
8/6/2019 Networks - Chapter 4 - Network Layer 1spp
92/92
Network Layer 4-92
Learn from inter-AS
protocol that subnet
x is reachable viamultiple gateways
Use routing info
from intra-AS
protocol to determine
costs of least-costpaths to each
of the gateways
Hot potato routing:
Choose the gateway
that has thesmallest least cost
Determine from
forwarding table the
interface I that leads
to least-cost gateway.Enter (x,I) in
forwarding table
Now suppose AS1 learns from the inter-AS protocolthat subnet xis reachable from AS3 andfrom AS2.
To configure forwarding table, router 1d mustdetermine towards which gateway it should forwardpackets for dest x.
Hot potato routing: send packet towards closest
(the one with least-cost) of two routers.