Download Power Point Slides for Chap. 5

Document related concepts

TCP congestion control wikipedia , lookup

Point-to-Point Protocol over Ethernet wikipedia , lookup

AppleTalk wikipedia , lookup

CAN bus wikipedia , lookup

Backpressure routing wikipedia , lookup

Net bias wikipedia , lookup

Peering wikipedia , lookup

RapidIO wikipedia , lookup

Piggybacking (Internet access) wikipedia , lookup

Distributed firewall wikipedia , lookup

Zero-configuration networking wikipedia , lookup

Network tap wikipedia , lookup

Internet protocol suite wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

IEEE 1355 wikipedia , lookup

List of wireless community networks by region wikipedia , lookup

Computer network wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Deep packet inspection wikipedia , lookup

Airborne Networking wikipedia , lookup

Multiprotocol Label Switching wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Routing wikipedia , lookup

Routing in delay-tolerant networking wikipedia , lookup

Transcript
Chapter 5
The Network Layer
Network layer
• Network layer gets pkts from source to dest.
• The packets may need to go through
different routers to get to the destination.
• Network layer must therefore know the
topology of the subnet (I.e., the set of all
routers) to be able to choose “optimal”
paths through it.
• ASIDE: Subnets allow a network to be split
into several parts for internal use but act
like a single network to the outside world.
More later.
Network layer
• It must do some form of load balancing,
I.e., make sure that certain routers are not
overloaded while others are not
• Must also deal with problems that arise
when source and destination networks are
different
• Design Issues: 1) Services provided to the
transport layer 2) Internal organization of
the network layer
Services provided to transport layer
• Network layer provides services to transport
layer
• Goals of network layer services:
– Services should be independent of subnet
technology
– Transport layer should be shielded from the
number, type, and topology of the subnets
present.
– The network addresses made available to the
transport layer should have a uniform
numbering plan, even across LAN’s and
WAN’s
Services provided to transport layer
2 warring factions
Connection Oriented
Reliable connection oriented service
Connection opened, given id, closed
after data is sent
On opening connection; negotiation
about cost, quality of service is begun
Full duplex with packets delivered in
sequence
Flow control for fast sender slow
receiver
EXAMPLE: ATM
Connectionless
Primitives - SEND PKT, RECV PKT
No packet ordering or flow control is
done since hosts will do it
Each packet carries full destination
address since each pkt sent is carried
independently of its predecessors
EXAMPLE: Internet
Running TCP/IP over an ATM
subnet
Email
FTP
…….
TCP
IP
ATM
Data Link
Physical
Problem: ATM network layer guarantees that packets are
delivered in order but TCP also contains this capability.
Internal organization of Network layer
• Connection is called a virtual circuit
• Packets in a connectionless setup is called a
datagram
• VIRTUAL CIRCUIT:
– Using a virtual circuit ensures that the route for
each packet (in a message consisting of a large
number of packets) is fixed.
– When the connection is released, termination of
the virtual circuit occurs.
– Each router in a virtual circuit must remember
which virtual ckts are open and where they
come from and where they go to
Internal organization of Network layer
• VIRTUAL CIRCUIT (cont’d):
– Therefore each router has a table containing
entries for all virtual ckts contained within it.
– Each packet going through the subnet must
contain a virtual ckt # in its header
– Each machine chooses a virtual circuit
independently. Full duplex case below
– Suppose two machines initiate a virtual ckt &
these propagate to adjacent routers. If each
router (by chance) chooses the same virtual ckt
#, then two unrelated virtual ckts on the same
physical line will have the same #. Data packet
could get confused. Simplex solves the problem
Internal organization of Network layer
• VIRTUAL CIRCUIT (cont’d):
– When processes are through with a virtual ckt,
it must indicate this so that router tables can
free used up space.
– This is achieved by charging for connect time as well
as data quantity sent
• DATAGRAMS
– No routes worked out in advance
– Successive packets may follow different routes
– Routers have tables indicating which outgoing
line to use for each possible destination router
– Datagram contains full destination address
Internal organization of Network layer
• DATAGRAMS
– Addresses can be long for a large network
– Establishment and release of network or
transport layer connections don’t require any
special work on the part of the routers
Comparison of VC and datagram
Issue
Circuit setup
Addressing
State information
Routing
Effect of router
failures
Congestion control
Datagram subnet
Not needed
Each packet contains
full source and
dest. Address
Subnet does not hold
state information
Each packet is
routed independent.
VC subnet
Required
Each packet contains
a short VC #
Each VC requires
subnet table space
Route chosen when
VC is setup; all
packets follow this
route
None, except for
All VC’s that passed
pkts lost during crash thru failed router
are terminated
Difficult
Easy, need enough
ROUTING ALGORITHMS
• Main function of network layer is routing
packets from source to destination machine.
• Routing algorithm is part of the network
layer that takes incoming packets and finds
the “optimal” output line to put it on.
• If subnet uses datagrams internally, routing
algo is invoked for each and every packet
passing through
• If subnet uses VC’s internally, routing algo
is invoked only when a new virtual ckt is set
up. This is called session routing.
ROUTING ALGORITHMS
• Properties of a good routing algorithm
– correctness, simplicity, robustness, stability,
fairness and optimality
– Robustness is extremely important. If network
has to be rebooted every time a router is taken
off line, then it is not robust.
– Stability is impt. Some routing algorithms
never reach equilibrium no matter how long
they are run.
– Fairness and optimality are inherently in
conflict, see slide on next page
Conflict between fairness and optimality
ROUTING ALGORITHMS
• What do we seek to optimize?
– 1)Mean packet delay
– 2)Total network throughput
– 1) and 2) are in conflict since using a queueing
system at capacity implies a long queueing
delay
– COMPROMISE minimize the number of hops a
packet must make. This reduces bandwidth
used as well as improve (reduce) delay
– Routing algos could be nonadaptive (static
routing) or adaptive
ROUTING ALGORITHMS
• NON-ADAPTIVE:
– Routing decisions are not based on current
conditions (topology and traffic)
– Choice of route from I to J (for all I, J) done in
advance, off line prior to network booting
• ADAPTIVE
– Routing decision based on topology and traffic
– Issues: where information is obtained (locally
or from all routers); when they change the
routes (fixed time, when load changes, when
topology changes); optimization metric
(distance, # of hops, estimated transit time)
ROUTING ALGORITHMS
• Optimality Principle:
– If router J is on the optimal path from router I
to router K, then the optimal path from J to K
falls along the same route
– How? Route from I->J is r1 and the rest is r2. If
a route better than r2 existed from J to K, it
could be concatenated with r1 to improve the
route from I to K. This contradicts the
statement that r1r2 is optimal
– Corollary: The set of optimal routes from all
sources to a given destination forma a tree
rooted at the destination (figure on next slide)
A subnet and a sink tree for router B
STATIC ROUTING ALGORITHMS
• Build a graph of the subnet, with each node
of the graph representing a router and each
arc of the graph representing a
communication line (link)
• Shortest path
– Number of hops. In this case, regardless of
geographic distance the hops A->B->C are the
same as the hops A->B->E (see figure on next
slide)
– Geographic distance. A->B->C is much longer
than A->B->E.
– Shortest path=fastest path (recalculated hourly)
STATIC ROUTING ALGORITHMS
• Shortest path (cont’d)
– Weighted calculations. Each arc in the subnet
has a weighting function associated with it. The
weights are a function of distance, bandwidth,
average traffic, communication cost, mean
queue length, measured delay + more
– Change the weighting function and the shortest
distance will change.
– Djikstra’s algorithm - See figure on next slide
STATIC ROUTING ALGORITHMS
First five steps in choosing shortest path from A to D
STATIC ROUTING ALGORITHMS
• Djikstra’s algorithm
– Find shortest path from A to D
– Consider weighted undirected graph (previous)
– Each node is labeled with its distance from the
source node with the best known path.
– Labels may change as algo. Proceeds.
– Initially all labels are tentative (and infinity)
– When shortest path from source node to current
node is discovered, label is called permanent
– Mark node A as permanent (filled in circle)
– Examine all nodes connected to A (adjacent)
relabeling them with distance to A
STATIC ROUTING ALGORITHMS
• Djikstra’s algorithm (continued)
– Examine all nodes connected to A (adjacent)
relabeling them with distance to A
– Also label adjacent nodes to a with the tag A so
that we can construct a final path later. (In this
case B, G are labeled with distance and A)
– Examine tentatively labeled nodes & make the
one with the smallest label permanent (B, this
becomes the new working node - arrowed in)
– Start with B & its adjacent nodes. If sum of the
label on B & the distance from B to the node
being considered is less than the label on that
node, we have a new node which is relabeled
STATIC ROUTING ALGORITHMS
• Djikstra’s algorithm (continued)
– After all nodes adjacent to working node have
been inspected and the tentative labels changed
if possible, entire graph is searched for
tentatively labeled nodes with smallest value.
– This node is made permanent and is the
working node for the next round.
• Why the algorithm works. Read on your
own (bottom half of p. 350 and top of 351)
STATIC ROUTING ALGORITHMS
• Flooding algorithm
– Every incoming packet is sent out on every
outgoing line except the one it arrived on
– Infinite number of packets could be generated
& we need to damp this process.
– Have a hop counter contained in header of each
packet. Counter is decreased with each hop and
packet is discarded when hop reaches 0.
– Ideally - hop counter and distance from source
to destination should be identical. If distance is
unknown, entire diameter of subnet could be
used
STATIC ROUTING ALGORITHMS
• Flooding algorithm
– Alternative - read paras 2, 3 in sec 5.2.3 on own
– Selective flooding - routers don’t send each and
every incoming packet out on every line, only
on those lines that are going approximately in
the right direction (I.e., why send something
East when it should generally be going West).
– Useful in military applications where routers
may be destroyed in a war.
– Flooding could be used as a metric against
which other routing algorithms are compared
since it always chooses the shortest path in
parallel
Incomplete Notes
• Slides for p. 351-358 were done by hand
and are not part of this set. Please read p.
351-358 from your text book.
DYNAMIC ROUTING ALGORITHMS
• Split horizon stack
– (p 358-359) read on your own
• Link state routing
– Problems with distance vector routing
• Doesn’t take BW into account
• Algorithm takes very long to converge (count-toinfinity problem)
– 5 parts to this algo (from a routers viewpoint)
– 1) Discover neighbours and obtain their network
addresses
– 2) Measure delay or cost to each of the neighbours
STATIC ROUTING ALGORITHMS
• Link state routing (cont’d)
– 3) Construct a packet with all it has just learned
– 4) Send packet in 3) to every router
– 5) Compute shortest path to every other router
– Thus topology and delays are empirically obtained
- and Djikstra’s algorithm can be used in this case
• DETAILS OF LINK STATE ROUTING
• Learning about the neighbours
– Router comes up and sends HELLO packet on each
point to point line
DYNAMIC ROUTING ALGORITHMS
• Learning about the neighbours
– Router comes up and sends HELLO packet on each
point to point line
– Router at other end replies with globally unique
name
– What happens when two or more routers are
connected by a LAN? (See next slide)
Routers A, C, F are directly
connected to LAN
LAN has been made into a
node N to which A, C, F are
connected, I.e., we go to F
from A via N.
DYNAMIC ROUTING ALGORITHMS
• Line cost
– It is expected that any router will have a reasonable
estimate of delay to each of its neighbours.
– For example, an ECHO packet could be sent N
times and the average delay computed (total time
divided by 2N)
– Take load into account? If “yes,” then we must start
timer when packet is put on queue. If “no,” then
start timer when packet is at head of queue.
• Build packet (build link state packets)
– Identity, sequence #, age and list of neighbours
(with delay to that neighbour included). (next slide)
Build link state packets
To be discussed
When to build packets? Periodically seems to be a
decent solution, but some recommend when a line
goes down or changes its properties etc. This raises
the question of how the router knows when properties
have changed.
DYNAMIC ROUTING ALGORITHMS
• Distribute link state packets
– Reliability is an issue.
– When link state packet (LSP) is sent out, routers
that are first to get LSP’s will change their routes.
– Ultimately inconsistency will arise since different
routers will have different understanding of what
the topology is.
– Use flooding to distribute LSP’s. Every time a
packet passes through a router and is sent to a new
line its sequence number is incremented.
– Routers keep a log of all pairs (router, seq #) that
have passed through.
DYNAMIC ROUTING ALGORITHMS
• Distribute link state packets
– When new LSP comes in, it is checked against the
list of packets already seen. If new, it is “flooded.”
If a repeat, it is not “flooded.” If sequence number
is less than the highest seen, that LSP is considered
obsolete and rejected.
– Use a 32 bit number in order to prevent
wraparound.
– Crashing routers - lead to lost sequence numbers.
What happens when router comes up?
– What about corruption of sequence numbers, I.e., 4
becomes 5000 for example. All pkts from 5-5000
will be rejected (obsolete that is)
DYNAMIC ROUTING ALGORITHMS
• Distribute link state packets
– When new LSP comes in, it is checked against the
list of packets already seen. If new, it is “flooded.”
If a repeat, it is not “flooded.” If sequence number
is less than the highest seen, that LSP is considered
obsolete and rejected.
– Use a 32 bit number in order to prevent
wraparound.
– Crashing routers - lead to lost sequence numbers.
What happens when router comes up?
– What about corruption of sequence numbers, i.e., 4
becomes 5000 for example. All pkts from 5-5000
will be rejected (obsolete that is)
DYNAMIC ROUTING ALGORITHMS
• Distribute link state packets
– All LSP’s carry a time to live (TTL) (or age). A
node always decrements the TTL of a newly
received LSP before flooding to its neighbours. It
also ages the LSP while it is stored in the node.
– When the TTL reaches 0, the node re-floods LSP
with a TTL of 0 - this is a signal that all nodes in
the network should delete the LSP.
• Route Calculation
– Once a node has a copy of the LSP from every
other node, the topology of the network is
computed and can used Djikstra’s algo for best
DYNAMIC ROUTING ALGORITHMS
• Hierarchical Routing
– As network size increases, routing tables grow and
grow. More time is needed to process these tables.
– When networks grow beyond a certain size, it becomes
necessary to do routing hierarchically.
– Routers are divided into regions. Each router knows
how to route packets to destinations within its own
region but knows nothing about topological structure
of other regions.
– Could have a multi-layer hierarchy when network
grows huge. regions -> clusters -> zones -> groups
– Next slide shows a 5 level hierarchy
DYNAMIC ROUTING ALGORITHMS
Traffic for region 2
goes 1B-2A. Traffic
for regions 3, 4, 5 go
through 1C-3B line.
Hierarchical table is
7 entries as opposed to
17.
DYNAMIC ROUTING ALGORITHMS
• Hierarchical Routing
– Saves table space but at the cost of longer routes (see
1A to 5C via region 2 or region 3)
– How many levels should a hierarchy have? Some math
wizards showed that ln N is optimal for an N router
subnet.
• Ignore 5.2.8, 5.2.9, 5.2.10, and all of section 5.3
• INTERNETWORKING.
– What are the issues when two or more networks are
combined together to form an internetwork.
– Why different networks?
• 1. Installed base is large and growing
INTERNETWORKING
– Why different networks (cont’d)?
2 Different parts of an organization have different latitude in
buying hardware/software resulting in non-standardization
3 Different networks have different technology. This trend will
continue.
– Various scenarios are possible
•
•
•
•
LAN-LAN
LAN-WAN
WAN-WAN
LAN-WAN-LAN - see following slide.
INTERNETWORKING
Common names for devices connecting dis-similar networks
(depending on the layer).
Layer 1: Repeaters copy bits between cable segments
Layer 2: Bridges store and forward data link frames between LAN’s
Layer 3: Multi-protocol routers forward packets between diff
networks
Layer 4: Transport gateways connect byte streams in the transport
layer.
Above 4: Application gateways allow internetworking above layer 4
INTERNETWORKING
– What is the difference between REPEATERS,
BRIDGES, MULTIPROTOCOL ROUTERS,
TRANSPORT GATEWAYS, APPLICATION
GATEWAYS?
– Repeaters are low-level devices that amplify or
regenerate weak signals. They just copy bits as they
arrive.
– Bridges - store-&-forward devices. Takes a frame &
passes it to DLL (where checksum is verified) & then
passes it to physical layer for forwarding to a different
type of network. Do not examine network layer header
or packets inside frames.
INTERNETWORKING
– Multi-protocol routers are in the network layer. Takes
packets from one line and forwards to another. A router
knows whether it is an IP router, IPX router and CLNP
(connectionless packet protocol for OSI) - it examines
headers and makes decisions based on addresses over
there.
– Many devices combine bridge and router capability.
Concatenated Virtual Circuits
A sequence of virtual circuits is built up from the source
through one or more multi-protocol routers (“gateway”) to
the destination.
Connectionless internetworking
No sequence of virtual circuits is necessary
Each packet travels a different path (possibly)
No guarantee packets arrive in order - if they arrive at all
Each network has its own network layer protocol so translation
from one to another is hard
Addressing: Example, IP has 32 bit internet address OSI has
decimal address. Problems.
Can be used over subnets that don’t have virtual circuits inside
them - e.g., mobile networks, some LANs etc.
IP ADDRESSES
• IP Addresses.
IP ADDRESSES
• IP Addresses
Format
# of networks
# of hosts
A
126
16 million
B
16382
64K
C
2 million
254 million
Subnets
• Subnets
– Start with an example. Company A has a class
C network shown below (for completeness).
32 bits
110
Network
Host
8 bits
– A can have 254 different hosts but suppose they
are maxed out. Could get second C class
address or get a LAN of a different type.
– Problems:
• # of networks could grow & grow. Mgt. Of
networks is hard (e.g., go to Network information
Center (NIC) to get new address every time.
Subnets
• Problems:
– Moving machine B from one LAN to another?
B’s IP address will have to be changed. C may
get B’s old IP add. & get mail intended for A.
This continues till changes are propagated
throughout the internet.
– Solution: subnet.
• Subnet
– Network is split into different parts which is
opaque to the rest of the world.
– Example on next slide considers a class B
address.
Subnets
6 bits for the subnet and 10 bits for the host.
Therefore 62 LAN’s are permitted (0,1 reserved)
and up to 1022 hosts.
Subnets – How do they help
• Subnet
– How are IP packets processed at router?
• 1. Pkt. arrives at router
• 2. Destination address is looked up
– For distant network? Forwarded to next router on interface
given on table.
– Local host? Sent directly to destination
– Network not on table? Sent to default router with more
extensive tables
– Consists of pairs (network (IP ADDRESS), 0) (thisnetwork, host). The first pair shows how to get to distant
networks second shows how to get to local hosts.
• ADVANTAGE: Only keep track of other networks
and local hosts. Routing table size is reduced.
Subnets – How do they help
• Subnet
– How are IP packets processed at router (with
subnet)?
• Consists of pairs (network, 0) (this-network, host)
(this-network, subnet, 0) (this-network, this-subnet,
host).
• This allows a router to go to all subnets on its
network as well as to all hosts on its subnet.
• Next slide shows how the subnet mask is used.
Subnets – How do they help?
130.50.15.6
1 0
0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0
Subnet
Subnet mask
1 1
… all ones …
130.50.12.0
Host
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
Boolean and
0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
Subnet 3
Since we have subnet 3, routing tables (on router on subnet
5) are looked up that tell us how to get to hosts on subnet 3.
This reduces space requirements for router table.
Internet Control Protocols
Internet Control Protocols
Internet Control
Message Protocol
(ICMP)
Address Resolution
Protocol (ARP)
Reverse ARP
Boot Protocol
(BOOTP)
Internet Control Message Protocol
Message Type
Description
Destination unreachable Subnet/router can’t locate dest or pkt with DF bit can’t be delivered (“small pkt” netwrk in way)
Time exceeded
TTL counter = 0. Pkts could be looping, or great congestion or timer values are too low.
Parameter problem
Illegal value in header field. Bug in sending hosts IP softw or softw of router along the way.
Source quench
Stop source from sending too many pkts. Now congestion control is done in transport layer.
Redirect
Echo request
Echo reply
Router notes pkt routed wrong. Msg sent to source about probable error
Sent by host to see if a destination is alive
Upon receiving ECHO REQUEST, host sends back acknowledgement ECHO REPLY
Timestamp request
Same as ECHO REQUEST, but with time stamp
Timestamp reply
Upon receiving ECHO REPLY, but with time stamp
Address Resolution Protocol
• ARP
– Ethernet boards in computers, but Ethernet
addresses are 48bits while IP adds are 32bits.
How to translate from Ethernet -> IP
– See figure below (several class C networks CS, EE and FDDI ring). How to go from E1 to
E2 and from E1 to E6.