1 Computer Communications Lectures 14-16 The Network Layer

spleenabackΔίκτυα και Επικοινωνίες

18 Ιουλ 2012 (πριν από 5 χρόνια και 1 μήνα)

270 εμφανίσεις

1
Computer Communications
Lectures 14-16
The Network Layer
Required Reading: Tanenbaum (chapter 5 and section 2.5.5)
2
Circuit Switching
(a) Circuit switching. (b) Packet switching.
2
3
Circuit vs. Message vs. Packet Switching
(a) Circuit switching (b) Message switching (c) Packet switching
4
Circuit vs. Packet Switching
A comparison of circuit switched and packet-switched networks.
3
5
Context
The environment of the network layer protocols.
6
Implementation of Connectionless Service
• Datagrams and datagram subnet
Routing within a diagram subnet.
4
7
Implementation of Connection-Oriented Service
• Virtual-Circuits (VCs) and virtual circuit subnet
Routing within a virtual-circuit subnet.
8
Comparison of Datagram and
Virtual-Circuit Subnets
5
9
The Network Layer in the Internet
• The IP Protocol
• IP Addresses
• Internet Control Protocols
• OSPF – The Interior Gateway Routing Protocol
• BGP – The Exterior Gateway Routing Protocol
• Internet Multicasting
• Mobile IP
• IPv6
10
Design Principles for Internet
1.Make sure it works.
2.Keep it simple.
3.Make clear choices.
4.Exploit modularity.
5.Expect heterogeneity.
6.Avoid static options and parameters.
7.Look for a good design; it need not be perfect.
8.Be strict when sending and tolerant when receiving.
9.Think about scalability.
10.Consider performance and cost.
6
11
Collection of Subnetworks
The Internet is an interconnected collection of many networks.
12
IP (Internet Protocol)
• Best-effort, datagram delivery service
– Datagram size <= 64KB
• Supports internetworking
The IPv4
(Internet Protocol) header.
7
13
IP Options
Some of the IP options.
14
IP Addresses
• An IP address refers to a network interface, not a host
• Managed by ICANN (Internet Corporation for Assigned Names and
Numbers)
• Dotted decimal notation
IP address formats.
128/16 x 10
6
16384/64K
2 x 10
6
/256
8
15
IP Addresses (2)
Special IP addresses.
16
“Subnets”
• Splitting a network into several parts for internal use but still act like a
single network to the outside world
A campus network consisting of LANs for various departments.
9
17
Subnetting Example
• Subnet mask indicates the split between network + subnet number,and
host
• For the example below:
– Subnet mask: 255.255.252.0
– Alternative notation: /22
A class B network subnetted into 64 subnets.
18
IP Routing
• IP routing table without subnetting
– A set of <(Network, 0) IP address, interface, …> t o reach distant networks
– A set of <(this-network, host) IP address, interfa ce, …> entries for local
hosts
– A default router entry
• IP routing table with subnetting
– A set of <(this-network, subnet, 0) IP address, in terface, …> to reach other
subnets on this network
– A set of <(this-network, this-subnet, host) IP add ress, interface, …> entries
for local hosts on this subnet
– A default router entry
• Subnetting reduces router table space by creating a three-level
hierarchy consisting of network, subnet and host
10
19
CIDR – Classless InterDomain Routing
• Allocate remaining IP addresses in variable-sized blocks, without
regard to the classes
• Each routing table entry: <IP address, subnet mask, outgoing line>
triple
• Longest mask matching for forwarding
• Use of aggregation for reducing routing table sizes
A set of IP address assignments.
20
Routing Algorithms
• Main function of network layer: routing packets from source to
destination
– Routing is an issue even for broadcast networks if source and destination
are not on same network
• Routing algorithm
– Part of network layer software that updates
the “routing table”
– Decides the output line on which an incoming packe t should be transmitted
– Datagram subnet routing vs. virtual-circuit subnet routing (session routing)
– Contrast with “forwarding” which refers to routing table lookup
operation
• Desirable properties
– Correctness
– Simplicity
– Robustness
– Stability (convergence to an equilibrium)
– Optimality
– Fairness
11
21
Routing Algorithms: Optimality and Fairness
• Optimality
– Min (mean packet delay)
– Max (total network throughput)
– Min (number of hops for a packet)
• Fairness
• Contradictory goals
Conflict between fairness and optimality.
22
Routing Algorithms: Classification
• Non-adaptive (static) algorithms
– Route choices computed in advance and downloaded t o routers at network
boot time
• Adaptive (dynamic) algorithms
– Adapt routing decisions in response to topology an d traffic changes
– Various algorithms differ in terms of:
» Wheretheygettheirinformation(e.g.,locally,fromadjacentrouters,or
fromallrouters)
» Whentheychangetheroutes(e.g.,periodically,whenloadchanges,or
whentopologychanges)– periodicvs.eventdriven
» Whatmetrictheyuseforoptimization(e.g.,distance,numberof hops,or
estimatedtransittime)
12
23
The Optimality Principle
• General statement about optimal routes without regard to topology or
traffic: “If router J is on the optimal path from router I to router K, then the
optimal path from J to K also falls along the same route”
• Sink tree: Set of optimal routes from all sources to a given destination
form a tree rooted at the destination; not necessarily unique; no loops
• Benchmark against which other routing algorithms can be measured
(a) A subnet. (b) A sink tree for router B.
24
Resource Reservation (Section 5.4, page 405)
• Effective quality-of-service (QoS) provisioning requires reserving resources for
a flow along its assigned route (virtual-circuit like approach)
• Resources
– Bandwidth ￿not oversubscribing any output line
– Buffer space ￿reserve buffers for each QoS flow up to some maximum
– CPU cycles: reserving this resource a bit more tri cky!
» Aroutertaking1$sectoprocessapacketdoesn’tmeanitcanprocess1million
packets/secbecauseofidleperiodsfromstatisticalfluctuationsintheload
» Evenwithaloadslightlybelowthetheoreticallycapacity,queuescanbuildupand
delayscanoccur
• Consider:
– Random packet arrivals with mean rate λ packets/sec
– Random CPU processing time with mean capacity µpac kets/sec
– Assume poisson arrival and service distributions
– Using queuing theory:
»mean delay experienced by a packet (including queu eing and service time),
T = (1/ µ) x (1/(1- λ/ µ)) = (1/ µ) x (1/(1- ρ)), where CPU utilization, ρ = λ/ µ
13
25
Distance Vector Routing (1)
• An example of dynamic and distributed routing algorithm
– Sometimes also called the distributed Bellman-Ford algorithm
– Original ARPANET routing algorithm
– Also was used in the Internet under the name RIP
• Each router maintains a table (e.g., a vector) giving the best known
distance to each destination and which outgoing line to use to reach that
destination
– “distance” or metric can be number of hops, time de lay in milliseconds, total
number of packets queued along the path, etc.
– Assumption: each router knows the distance to each of its neighbors
• Tables updated via information exchange with neighbors
26
Distance Vector Routing (2)
• Note that old routing table is not used in the calculation
(a) A subnet. (b) Input from A, I, H, K, and the new
routing table for J.
14
27
Distance Vector Routing (3)
• Works in theory, but convergence is an issue
• Count-to-infinity problem: reacts rapidly to good news, but bad news
travels slowly
– X tells Y that it has a path somewhere, but Y has no way of knowing
whether it itself is on the path
• Some solutions (e.g., split horizon with poisoned reverse in RFC 1058)
but none work in general
The count
-
to
-
infinity problem.
28
Link State Routing
• Replaced distance vector based routing algorithm in ARPANET in 1979
• Used in Internet OSPF protocol and IS-IS (a precursor to OSPF)
• Assume globally unique router addresses.
• Each router must do the following:
– Discover its neighbors, learn their network addres s (using HELLO packets).
– Measure the delay or cost to each of its neighbors (e.g., using ECHO
packets).
– Construct a packet telling all it has just learned (“link state packet”)
– Send this packet to all other routers (via floodin g).
– Compute the shortest path to every other router (u sing Dijkstra’s algorithm).
15
29
Adapting to Load and Route Oscillations
A subnet in which the East and West parts are connected by two lines.
30
Building Link State Packets
• Periodically or driven by events (e.g., line down)
(a) A subnet. (b) The link state packets for this subnet.
16
31
Flooding
• Send every incoming packet on every outgoing line except the one it
arrived on ￿many duplicates
• Measures to reduce duplicates
– Hop counter in each packet, decremented at each ho p, when zero packet
discarded
– Keep track of packets flooded earlier using source sequence numbers and
avoid sending them again
– Selective flooding: propagate incoming packets onl y on output lines going in
the “right” direction
• Uses of flooding
– Robustness for military applications
– Concurrent updates in distributed database applica tions
– “Wireless multicast advantage”
– Benchmark for routing algorithms
32
Distributing the Link State Packets
• Basic distribution algorithm is flooding
with source sequence numbers
– Issues: sequence number wrap around, router crashe s, sequence number
corruption
– Refinements:
» Includeashortwaitingtimebeforepropagatinglinkstatepacketsto
suppressstaleandduplicatepackets
» Useacknowledgements
The packet buffer for router B in the previous slide.
17
33
Shortest Path Routing
• Represent network as a graph and find “shortest” path on the graph
• Dijkstra’s algorithm
The first 5 steps used in computing the shortest path from A to D.
The arrows indicate the working node.
34
Hierarchical Routing
• To deal with problems
arising from increase in
network size
– Regions, clusters,
zones, groups, …
– Can increase path
length
– How many levels
should the hierarchy
have?
» Kamoun and
Kleinrock (1979):
“ln
N”
optimallevels
with“
e
ln
N”
for
size“
N”
net
Hierarchical routing.
18
35
Internetworking
• Interconnecting two or more different networks to form an “internet”
A collection of interconnected networks.
36
How Networks Differ
• Also differences in physical and data link layers, e.g., different
modulation techniques and frame formats
Some of the many ways networks can differ (in network layer).
19
37
How Networks Can Be Connected
• Physical layer – repeaters and hubs
• Data link layer – switches and bridges• Network layer – (multiprotocol) routers
• Transport layer – gateways
• Application layer – gateways
(a) Two Ethernets connected by a switch. (b) Two Ethernets connected
by routers.
38
Concatenated Virtual Circuits vs.
Connectionless Internetworking
Internetworking using concatenated virtual circuits.
A connectionless internet.
20
39
Tunneling
• To handle the special case where source and destination hosts are on
same type of network, but intermediate network is different
Tunneling a packet from Paris to London.
Tunneling a car from France to England.
40
Internetwork Routing
• Interior gateway protocol for intranetwork routing or routing within a
network (autonomous system)
• Exterior gateway protocol for internetwork routing or routing between
networks (autonomous systems)
– Issues like crossing international boundaries and cost need to be
considered
(a) An internetwork. (b) A graph of the internetwork.
21
Routing in the Internet
42
OSPF: The Interior Gateway Routing Protocol
• Design goals
– Published in open literature
– Support a variety of distance metrics
– Dynamic: adapt to topology changes automatically a nd quickly
– Support routing based on type of service
– Do load balanced routing, i.e., splitting the load over multiple lines
– Support for hierarchical systems
– Security
– Support routers connected to Internet via a tunnel
• Supports three kinds of connections and networks
– Point-to-point lines between exactly two routers
– Multiaccess networks with broadcasting (e.g., most LANs)
– Multiaccess networks without broadcasting (e.g., mo st packet-switched
WANs)
22
43
OSPF (2)
• Operates by abstracting the collection of actual networks, routers and
lines into a directed graph with a cost for each arc.
(a) An autonomous system. (b) A graph representation of (a).
44
OSPF (3)
• Many ASes in the Internet large, so OSPF supports hierarchical routing
by allowing ASes to be divided into numbered “areas”
– Backbone area (area 0) connects to all other areas
– Three types of routes needed: intra-area, inter-ar ea and inter-AS
The relation between ASes, backbones, and areas in OSPF.
The five types of OSPF messages.
23
45
BGP: The Exterior Gateway Routing Protocol
• Designed to allow many kinds of routing policies to be enforced in the
interAS traffic
– Policies themselves not part of the protocol, they are manually configured
into each BGP router
– Stub networks, transit networks and multiconnected networks
– Communication between each pair of BGP routers via TCP connections
– Fundamentally distance vector, but maintains compl ete path info
(a) A set of BGP routers. (b) Information sent to F.
46
Fragmentation
(a) Transparent fragmentation. (b) Nontransparent fragmentation.
24
47
Fragmentation (2)
Fragmentation when the elementary data size is 1 byte.
(a) Original packet, containing 10 data bytes.
(b) Fragments after passing through a network with maximum packet
size of 8 payload bytes plus header.
(c) Fragments after passing through a size 5 gateway.
48
Other Topics
• Internet control protocols: ICMP, ARP, RARP, BOOTP, DHCP & NAT.
• Broadcast Routing, Multicast Routing & IP Multicasting
• Routing for mobile hosts & Mobile IP
• IPv6
• Congestion control and QoS