Sunteți pe pagina 1din 154

The Network Layer

 Design Issues
 Routing Algorithms
 Congestion Control
 Internetworking
 Example Network Layer Protocols

Computer Networks Fall 2002 Page 1


Goals of the Network Layer
 The network layer is concerned with getting
packets from the source all the way to the
destination
 the network layer must
 know the topology of the communication subnet
 choose route to avoid overloading some of the
communication lines and routers while leaving
others idle
 deal with problems when the source and
destination are in different networks

Computer Networks Fall 2002 Page 2


Services Provided to the
Transport Layer
 Connectionless (unreliable) services
 each packet must carry the full destination
address
 no packet ordering and flow control should be
done
 Connection-oriented (reliable) services
 a network layer process on the sending site must set up a
connection to its peer on the receiving side
 when a connection is set up, two processes can enter a
negotiation about service parameters
 packets are delivered in sequence
 flow control is provided automatically
Computer Networks Fall 2002 Page 3
International Organization of the
Network Layer
 virtual circuit
 a route from the source to the destination
is chosen as part of the connection setup
 primarily for connection-oriented service

 datagrams
 each packet sent is routed independently
of its predecessors
 for connection-oriented and connectionless
services
Computer Networks Fall 2002 Page 4
Datagram Vs. Virtual Circuit

Issue Datagram Virtual Circuit (VC)


Circuit Setup Not needed Required
Addressing Each packet contains the full Each packet contains a short
source and destination address VC number
State Subnet does not hold state Each VC requires subnet table
information information space
Routing Each packet is routed Route chosen when a VC is set
independently up; all packets follow this route
Effect of router None, except for packets lost All VCs that passed through the
failures during the crash failed router are terminated
Congestion Difficult Easy if enough buffers can be
control allocated in advance for each
VC

Computer Networks Fall 2002 Page 5


Combinations of Services and
Subnet Structures
Services provided Connection-oriented Connectionless
by Transport layer
Services provided Connection-oriented Connectionless
to Transport layer

Subnet Structures Virtual Circuit Datagram

ATM AAL1 UDP TCP UDP


over ATM Over over over
IP IP IP
Over
Computer Networks Fall 2002 ATM Page 6
Routing

 Packets are often routed from the


source to the destination hop by hop.
 Two networks are connected by at least
a router. The network is defined from
the point of view of the network layer.

Computer Networks Fall 2002 Page 7


Types of Routing
 Static Routing (Nonadaptive Routing)
 Routes to destinations are predetermined and are
not dependent on the current state (traffic,
topology etc.) of the network.
 Dynamic Routing (Adaptive Routing)
 Routes being learned via exchange of routing
information to reflect changes in the topology and
traffic.
 Default Routing:
 Traffic to destinations that are unknown to the
router is sent to a default “outlet”.
Computer Networks Fall 2002 Page 8
The Optimality Principle
 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.
 the set of optimal routes from all sources to a
destination form a tree, called a sink tree, rooted
at the destination. r2
J
I r1 K

 The goal of all routing algorithms is to


discover and use the sink trees for all routers.

Computer Networks Fall 2002 Page 9


Sink Tree

Computer Networks Fall 2002 Page 10


Routing Algorithms
 Static Routing Algorithms
 Shortest Path Routing
 Flooding
 Flow-Based Routing
 Dynamic Routing Algorithms
 Distance Vector Routing
 Link State Routing
 Hierarchical Routing
 Routing for Mobile Hosts
 Broadcast Routing
 Multicast Routing
Computer Networks Fall 2002 Page 11
Shortest Path Routing

 Find the shortest path between a given


pair of routers.
 Cost of a link may be a function of the
distance, bandwidth, average traffic,
communication cost, mean queue
length, delay, etc.
 The Dijkstra’s algorithm is used.

Computer Networks Fall 2002 Page 12


Dijkstra’s Algorithm

Computer Networks Fall 2002 Page 13


Flooding

 Every incoming packet is sent out on every


outgoing line except the one it arrived on.
 Vast numbers of duplicate packets are
generated. M
I J

 Application: K L
 Concurrent updates of all distributed databases
 Always choose the shortest path

Computer Networks Fall 2002 Page 14


Flow-Based Routing

 For a given line, if the capacity and


average flow are known in advance, it is
possible to compute the mean packet
delay on that line from queuing theory.
 The routing problem then reduces to
finding a routing algorithm that
produces the minimum average delay
for the subnet.
Computer Networks Fall 2002 Page 15
Example

Computer Networks Fall 2002 Page 16


Analysis

Computer Networks Fall 2002 Page 17


Distance Vector Routing

 RIP, the distributed Bellman-Ford routing


algorithm, the Ford-Fulkerson algorithm
 Each router maintains a routing table giving
the best known distance to each destination
and which line to use to get there.
 These tables are updated by exchanging
information with the neighbors.

Computer Networks Fall 2002 Page 18


Computer Networks Fall 2002 Page 19
Update Routing Table

Computer Networks Fall 2002 Page 20


Distance Vector
 Each node maintains a set of triples
 (Destination, Cost, NextHop)
 Exchange updates directly connected neighbors
 periodically (on the order of several seconds)

 whenever table changes (called triggered update)

 Each update is a list of pairs:


 (Destination, Cost)

 Update local table if receive a “better” route


 smaller cost

 came from next-hop

 Refresh existing routes; delete if they time out


Computer Networks Fall 2002 Page 21
Example : router B

Destination Cost NextHop


B

A
C
A 1 A
D
C 1 C
E D 2 C
E 2 A
F G F 2 A
G 3 A

Computer Networks Fall 2002 Page 22


Distance Vector Routing

 Metric used to measure the “distance”


 number of hops
 time delay

 queue length

 Drawback
 Count-to-infinity problem
 it reacts rapidly to good news, but leisurely

to bad news.
Computer Networks Fall 2002 Page 23
Count-to-Infinity Problem
A B C D E A B C D E

    Initially 1 2 3 4
1    After 1 exchange 3 2 3 4
1 2   After 2 exchanges 3 4 3 4
1 2 3  After 3 exchanges 5 4 5 4
1 2 3 4 After 4 exchanges 5 6 5 6
After 5 exchanges 7 6 7 6
down initially and After 6 exchanges 7 8 7 8
come up later alive initially and
   
down later
Good News Bad News
Computer Networks Fall 2002 Page 24
Split Horizon Hack
 Try to solve the count-to-infinity problem
 the distance to X is not reported on the line
that packets for X are sent on (actually, it is
reported as infinity)
 In many cases, the bad news propagates one
hop per exchange
infinity 2

A infinity B 1 C
Computer Networks Fall 2002 Page 25
B thinks it can reach D through
A with a cost of 2

2
Infinity infinity

Computer Networks Fall 2002 Page 26


Link State Routing

 Each route must


1.Discover its neighbors and learn their network
addresses.
2.Measure the delay or cost to each of its neighbors.
3.Construct a packet telling all it has just learned.
4.Send this packet to all other routers.
5.Compute the shortest path to every other router.
 Strategy
 send to all nodes (not just neighbors) information
about directly connected links (not entire routing
table)
Computer Networks Fall 2002 Page 27
Computer Networks Fall 2002 Page 28
Learning About the Neighbors
 Send a special HELLO packet on each
point-to-point line
 the router on the other end is expected
to send back a reply telling who it is
HELLO
I J
L I am J

Computer Networks Fall 2002 Page 29


Measuring Line Cost
 Send an ECHO packet over a line
 the other side is required to send back
ECHO immediately
 the round-trip delay can be measured
 if the load is taken into account
 results in better performance
 the routing table may be oscillate wildly

Computer Networks Fall 2002 Page 30


Traffic may oscillate between the
two links

Computer Networks Fall 2002 Page 31


Building Link State Packets

B 2 C Link State Packets


A B C D E F
4 3 Seq. Seq. Seq. Seq. Seq. Seq.
A D Age Age Age Age Age Age
1 6 B 4 A 4 B 2 C 3 A 5 B 6
5 7
E 5 C 2 D 3 F 7 C 1 D 7
E 8 F F 6 E 1 F 8 E 8

(a) (b)

Computer Networks Fall 2002 Page 32


Distributing Link State Packets
 Use flooding
 sequence number is used to determine
among new, duplicate, or obsolete packets
 three problems

 sequence number may wrap around


 a crash router will lose track of its sequence
number when it restarts
 a corrupted bit in sequence number may cause
disaster

Computer Networks Fall 2002 Page 33


The Use of ‘Age’ Field
 Include in each packet
 decremented once per second
 when the age hits zero, the information
from that router is discarded
 also decremented by each router during
the initial flooding process
 no packet can get lost and live for an
indefinite period of time

Computer Networks Fall 2002 Page 34


Reducing Flooding Costs
 When a link state packet comes in
 it is put in a holding area to wait a short while
 when another packet from the source comes in
 duplicate: discarded
 different: the older one is thrown out
 all link state packets are acknowledged

M
I J
K L

Computer Networks Fall 2002 Page 35


The LSP packets are to being
processed

Computer Networks Fall 2002 Page 36


Computing the New Route
 Once a router has accumulated a full
set of link state packets
 it can construct the entire subnet graph by
locally running Dijkstra’s algorithm
 for a subnet with n routers, each of
which has k neighbors, the memory
required to store the input data is
proportional to kn.
Computer Networks Fall 2002 Page 37
Hierarchical Routing

 When hierarchical routing is used, the


routers are divided into regions
 each router knows all the details about
how to route packets to destinations within
its own region
 each router knows nothing about the

internal structure of other regions.

Computer Networks Fall 2002 Page 38


Hierarchical Routing
Dest. Line Hops
Region 1 Region 2 1A ---- ---
Dest. Line Hops
A 1A ---- ---
1B 1B 1
B B 1C 1C 1
1B 1B 1
C C 2A 1B 2
1C 1C 1
2 1B 2
A D 2B 1B 3
3 1C 2
2C 1B 3
4 1C 3
2D 1B 4
5 1C 4
B C 3A 1C 3
3B 1C 2
A A D 4A 1C 3
B B A 4B 1C 4 Hierarchical
4C 1C 4 table for 1A
Region 5
C 5A 1C 4
Region 3 5B 1C 5
Region 4 5C 1B 5 Full table for 1A
5D 1C 5
Computer Networks Fall 2002 Page 39
Optimal Hierarchical Number
 Kamoun and Kleinrock
 N routers
 lnN hierarchical number

 e lnN entries for each router

 Increasing average length of routing path

but the affection is acceptable

Computer Networks Fall 2002 Page 40


Routing for Mobile Hosts
 Each mobile node is assumed to have a permanent
home location that never changes.
 Each area has one or more foreign agents, which
keep track of all mobile nodes visiting the area.
 In addition, each area has a home agent, which keep
track of nodes whose home is in the area, but who
are currently visiting another area.
 When a new node enters an area, it must register
itself with a foreign agent there. Then the mobile
node will register either directly with its home agent,
or through the foreign agent which forwards the
registration to the home agent.
Computer Networks Fall 2002 Page 41
Routing for Mobile Hosts
Home

Foreign

Foreign

Computer Networks Fall 2002 Page 42


Registration operation in Mobile
IP

Computer Networks Fall 2002 Page 43


Routing for Mobile Hosts

 Datagrams sent to the mobile node are


 intercepted by its home agent, then
 tunneled by the home agent towards the

mobile node,
 received at the tunnel foreign agent, and

 finally delivered to the mobile node.

Computer Networks Fall 2002 Page 44


Tunneling Operation in Mobile IP

Computer Networks Fall 2002 Page 45


Routing for Mobile Hosts
1. Packet is sent to the
mobile host’s home

3. Sender is given foreign


agent’s address
2. Packet is tunneled to
the foreign agent
4. Subsequent packets
are tunneled to the
foreign agent
Computer Networks Fall 2002 Page 46
Broadcast Routing

 To simply send a distinct packet to each


destination
 Flooding
 Multidestination Routing
 Spanning Tree Routing
 Reverse Path Forwarding

Computer Networks Fall 2002 Page 47


Multidestination Routing
 Each packet contains a list of desired
destinations.
 When a packet arrives, the router checks all
the destinations to determine the set of
output lines for forwarding the packet. An
output line is selected if it is the best route to
at least one of the destinations.
 The router generates a new copy of the
packet for selected output line, with a set of
destinations that are to use the line.
Computer Networks Fall 2002 Page 48
Spanning Tree Routing

 Assume each router has knowledge of a


spanning tree (e.q. a sink tree) in the
network.
 Each router copies an incoming
broadcast packet onto all the spanning
tree lines except the one it arrives on.
 Use minimum number of packets.

Computer Networks Fall 2002 Page 49


Reverse Path Forwarding

 Without knowing any spanning tree


if a packet arrives at the line that is
normally used for sending packets to
the source of the broadcast
the router forwards copies of it onto all lines
except the one it arrived on.
otherwise
the packet is discarded
Computer Networks Fall 2002 Page 50
RPF check (1)
 A packet received through interface I, from S
(source) to G (multicast group) -packet (S,G)
 A router looks into the routing table to find an
interface used to send packet to S, I(parent).
 If I != I (parent), I is a wrong interface to
(S, G).
 if I = I(parent), I is a correct interface to
receive (S, G).

Computer Networks Fall 2002 Page 51


RPF Check (2)
 If the RPF check succeeds, the datagram is
forwarded to all interfaces except I.
 If the RPF check fails, the datagram is
typically silently discarded.
 Packet is never forwarded back out the RPF
interface.

Computer Networks Fall 2002 Page 52


Reverse Path Forwarding: An
Example
I
B C D
A F H J N
F
G
E I
H N J A D E K G O M O
L
K O E C G D N K
M
H B L
Preferred link
L B

Computer Networks Fall 2002 Page 53


Multicasting
 Send a message to all the other members of
the group
 group management
 create and destroy groups
 for processes to join and leave groups
 routers knows which of their hosts belong to
which group
 routers tell their neighbors, so the
information propagates through the subnet

Computer Networks Fall 2002 Page 54


Multicast Routing
 Each router computes a spanning tree
covering all other routers in the subnet.
 When a multicast packet for a group arrives,
the first router examines its spanning tree
and prunes it, removing all lines that do not
lead to hosts in the group.
 Multicast packets are forwarded only along
the pruned tree.
 mn trees is needed with n groups, each with
an average of m members.
Computer Networks Fall 2002 Page 55
Example

Computer Networks Fall 2002 Page 56


Core-based Tree for Multicast
Routing
 A single spanning tree,called core-based tree,
for a group is computed, with the root (core)
near the middle of the group.
 A host first sends a multicasting message to
the core, which then does the multicasting
along the spanning tree.
 The tree is not optimal. However only n trees
need to be stored.

Computer Networks Fall 2002 Page 57


Computer Networks Fall 2002 Page 58
Congestion

 When too many packets are present in (a


part of) a subnet, performance degrades.
This situation is called congestion.
Maximun carrying Perfect
Packet delivered

capacity of subnet Desirable


Congested

Packet sent
Computer Networks Fall 2002 Page 59
Congestion Control

 goal
 make sure the subnet is able to carry the
offered traffic
 Congestion causes
 bursty data
 insufficient memory

 slow processor

 low-bandwidth line

Computer Networks Fall 2002 Page 60


Flow Control vs. Congestion
Control
 Congestion control
 Make sure the subnet is able to carry the
offered traffic
 It is a global issue, involving the behavior

of all the hosts, all the routers, and etc.


 Flow Control
 Relate to the point-to-point traffic between
a given sender and a given receiver.

Computer Networks Fall 2002 Page 61


Flow Control vs. Congestion
Control
Super 1000 Gbps
Computer PC
Flow
1 Gbps
Control

1 Mbps 1000
Congestion
Control 100 Kbps

1000

Computer Networks Fall 2002 Page 62


General Principles
 Open Loop
 make sure congestion does not occur in the first
place
 Deciding when to accept new traffic, deciding
when to discard packets and which ones, …
 Make decision without regard to the current state of the
network
 Closed Loop
 monitor the system to detect congestion (where
and when)
 pass this information to places where action can
be taken
 adjust system operation to correct the problem
Computer Networks Fall 2002 Page 63
Congestion Control Algorithm
Taxonomy (closed loop)
 explicit feedback
 Packets are sent back from the point of
congestion to warn the source.
 implicit feedback
 The source deduces the existence of
congestion by making local observations,
such as the acknowledgement time.

Computer Networks Fall 2002 Page 64


Policies that Affect Congestion

Computer Networks Fall 2002 Page 65


Congestion Prevention Policies
 Virtual circuit versus datagram
 Most algorithms work only with virtual circuit.

 Packet queuing and service policy


 input queuing versus output queuing

 round robin, priority-based, random, ...

 Packet discarded policy


 which packet is dropped when there is no space

 Routing algorithm
 Load sharing

 Packet lifetime management

Computer Networks Fall 2002 Page 66


Traffic Shaping/Policing

 Congestion would be less common if


traffic is less bursty
 traffic shaping
 force packets to be transmitted at a more
predictable rate
 traffic policing
 monitor a traffic flow

Computer Networks Fall 2002 Page 67


Leaky Bucket Algorithm

packets unregulated
flow
interface
implementing The bucket
Water drips holds
out of the
the leaky
hole at a bucket packets.
constant rate. algorithm regulated
flow
Network

Computer Networks Fall 2002 Page 68


Token Bucket Algorithm

Computer Networks Fall 2002 Page 69


Properties of Token Bucket
 allows saving up permission to send
large bursts later
 throws away token when the bucket fills
up but never discards packets
 C: token bucket capacity; :token
arrival rate; S: burst length; M: maximal
output rate
 C+  S=MS

Computer Networks Fall 2002 Page 70


Leaky Bucket

Computer Networks Fall 2002 Page 71


Token Bucket

Computer Networks Fall 2002 Page 72


Flow Specification
 An agreement on the traffic pattern
 the source gives the flow specification to the
subnet for approval

Computer Networks Fall 2002 Page 73


Congestion Control in Virtual
Circuit Subnets
 Admission control
 once congestion has been signaled, no
more virtual circuits are set up until the
problem has gone away
 carefully route all new virtual circuits
around problem areas
 negotiate an agreement between the
host and subnet when a virtual circuit is
set up
Computer Networks Fall 2002 Page 74
Computer Networks Fall 2002 Page 75
Choke Packets

1 2 3
Choke
Heavy
flow

6 5 4

7
Flow is reduced.
Computer Networks Fall 2002 Page 76
Hop-by-Hop Choke Packets

1 2 3
Choke
Heavy
flow

To provide quick
relief at the point
of congestion at 5 4
the price of using
up more buffers
upstream. Flow is reduced.

Computer Networks Fall 2002 Page 77


Load Shedding

 when routers are being inundated by


packets that they can not handle, they
just throw them away.
 Packet discarding policy
 Wine: Old is better than new.
 Milk: New is better than old.

 Priority Control

Computer Networks Fall 2002 Page 78


Jitter Control
 The jitter is the amount of variation in the
end-to-end packet transit time.
 The jitter can be bounded by computing the
expected transit time for each hop along the
path.
 When a packet arrives at a router, the router
checks to see how much the packet is behind or
ahead of its schedule. This information is stored in
the packet and updated at each hop. If the packet
is ahead of schedule, it may be held just enough
to get it back on schedule. If it is behind schedule,
the router tries to get it out the door quickly.
Computer Networks Fall 2002 Page 79
Congestion Control for
Multicasting
 Multicast flows from multiple sources to
multiple destinations (cable television)
 if it is the sender that reserves bandwidth
 each sender should track membership changes
 regenerate the spanning tree at each change
 RSVP (Resource reSerVation Protocol)
 it is the receiver that reserves bandwidth

Computer Networks Fall 2002 Page 80


RSVP (Resource reSerVation
Protocol)
 allows multiple senders to transmit
multiple groups of receivers.
 permits individual receivers to switch
channels freely.
 optimizes bandwidth use while at the
same time eliminating congestion.
 uses multicast routing using spanning
trees

Computer Networks Fall 2002 Page 81


Multicast Spanning Trees
Multicast spanning Multicast spanning
Senders tree for host 1 tree for host 2
1 2 1 2 1 2

3 4 5 3 4 5 3 4 5
Receivers
Computer Networks Fall 2002 Page 82
Bandwidth Reservation
Senders Senders Senders
1 2 1 2 1 2

Bandwidth Bandwidth Bandwidth


reserved reserved reserved
for source 1 for source 2 for source 1

3 4 5 3 4 5 3 4 5
Receivers Receivers
Computer Networks Fall 2002 Page 83
RSVP (Resource reSerVation
Protocol)
 When making a reservation, a receiver
can (optionally) specify one or more
sources that it wants to receive from.
 It can also specify whether these
choices are fixed for the duration of the
reservation, or whether the receiver
wants to keep open the option of
changing sources later.
Computer Networks Fall 2002 Page 84
RSVP (Resource reSerVation
Protocol)
 Two receivers are only set up to share a
path if they both agree not to change
sources later on.
 Once a receiver has reserved bandwidth,
it can switch to another source and
keep that portion of the existing path
that is valid for the new source.

Computer Networks Fall 2002 Page 85


Internetworking
802.5 LAN DECnet
R

R X.25

802.3 LAN 802.4 LAN R

B R
SNA

Computer Networks Fall 2002 Page 86


Internetworking
Application Protocol
7 Application Application APDU

Presentation Protocol
6 Presentation Presentation PPDU

Session Protocol
5 Session Session SPDU
Transport Protocol
4 Transport Transport TPDU
Internal Subnet Protocol
3 Network Network Network Network Packet

2 Data Link Data Link Data Link Data Link Frame

1 Physical Physical Physical Physical Bit


Layer Host A Router Router Host B
Computer Networks Fall 2002 Page 87
Internetworking Devices

 Layer 1: Repeater or Amplifier


 To amplify or regenerate signals
 Layer 2: (Multi-protocol) Bridge
 Store-and-forward device
 Headers at layer 2 are translated if necessary.
 Layer 3: (Multi-protocol) Router
 Headers at layer 3 (and layer 2) are translated if
necessary.
 Layer 4~7: Transport/Application Gateway

Computer Networks Fall 2002 Page 88


Devices on the Market

 Repeater, Hub
 Bridge
 (Multi-protocol) Router, Layer 3 Switch
 Layer 4 Switch
 Gateway with interfaces of distinct layer
protocols
 Bridge/Router (or called B-Router)
Computer Networks Fall 2002 Page 89
How Networks Differ
 Service offered
 Connection-oriented versus Connectionless
 Protocol
 IP, IPX, CLNP, AppleTalk, DECnet, etc.
 Addressing
 Flat (802) versus hierarchical (IP, PDN, PSTN,
ISDN, etc.)
 Multicasting/Broadcasting
 Present or absent

Computer Networks Fall 2002 Page 90


How Networks Differ (Cont.)

 Packet size
 Every network has its own maximum
 Quality of service
 Present or absent
 Error handling
 Reliable, ordered, and unordered delivery
 Flow control
 Sliding window, rate control, others, or none

Computer Networks Fall 2002 Page 91


How Networks Differ (Cont.)
 Congestion control
 Leaky bucket, choke packets, etc.
 Security
 Privacy rules, encryption, etc.
 Parameters
 Different timeouts, flow specifications, etc.
 Accounting
 By connection time, by packet, by byte, or not at
all

Computer Networks Fall 2002 Page 92


Concatenated Virtual Circuit
SNA
Multiprotocol
Router Router
M
ATM
1 X.25
M

OSI
M Host
M
2

Computer Networks Fall 2002 Page 93


Connectionless Interworking

1 M
M

M
M
2

Computer Networks Fall 2002 Page 94


Tunneling
The same type
Using encapsulation of IP packets of network

Ethernet WAN Ethernet

R R

Ethernet frame WAN packet Ethernet frame


IP IP IP

Ethernet header WAN packet header Ethernet header


Computer Networks Fall 2002 Page 95
Internetwork Routing
 interior gateway protocol: within each
network
 exterior gateway protocol: between networks
A B
2 B 3
A C
Gateway/
1 C D D
Router
E
4 F 5
Network
E F
Computer Networks Fall 2002 Page 96
Autonomous System (AS)

 An autonomous system is a set of


routers having a single routing policy,
running under a single technical
administration.
 Each AS is independent of all the others.

Computer Networks Fall 2002 Page 97


Fragmentation and Reassembly

 Each network imposes some maximum


size on its packets
 When a large packet wants to travel
through a network whose maximum
packet size is too small
 allow gateway to break packets up into
fragments
 fragments are reassembled into packet
latter
Computer Networks Fall 2002 Page 98
Transparent and Nontransparent
Fragmentation
Network 1 Network 2
Packet
G1 G2 G3 G4

G2 G4
G1 fragments reassembles G3 fragments reassembles
a large packet the fragments again again

(a)

Packet
G1 G2 G3 G4

G1 fragments The fragments are not reassembled


a large packet until the final destination (a host) is reached

(b)

Computer Networks Fall 2002 Page 99


Elementary Fragmentation
Number of the first elementary fragment in this packet
Packet End of
number packet bit 1 byte

27 0 1 A B C D E F G H I J

Header
(a)

27 0 0 A B C D E F G H 27 8 1 I J

Header Header
(b)

27 0 0 A B C D E 27 5 0 F G H 27 8 1 I J

Header Header Header


(c)

Computer Networks Fall 2002 Page 100


Firewalls
 Packet filter router is a router equipped with
some extra functionality that allows every
incoming or outgoing packet to be inspected.
 Application gateway (e.g.a mail gateway)
may examine headers and/or contents of
messages.

Outside
Packet Packet
Inside

Application
Filtering Gateway Filtering
Router Router

Computer Networks Fall 2002 Page 101


Internet Network Layer Protocol

 The IP (Internal Protocol) Protocol


 IP Addressing
 Subnets
 Internet Control Protocols
 The Internet Control Message Protocol (ICMP)
 The Address Resolution Protocol (ARP)
 The Reverse Address Resolution Protocol (RARP)

Computer Networks Fall 2002 Page 102


Internet Network Layer Protocol

 The Interior Gateway Routing Protocol:


Open Shortest Path First (OSPF)
 The Exterior Gateway Routing Protocol:
Border Gateway Protocol (BGP)
 Internet Multicasting
 Mobile IP
 Classless InterDomain Routing (CIDR)
 IPv6
Computer Networks Fall 2002 Page 103
The IP Header
0 4 8 16 19 24 31 bit
Version IHL Type of service Total length
DM
Identification F F Fragment offset

Time to live Protocol Header checksum

Source address

Destination address

Options (0 or more words)

Computer Networks Fall 2002 Page 104


The IP Protocol
 Version: The current protocol version is 4.
 IP Header length (IHL): measured in 32-bit
words
 for example, without options, its value is 5.
 Type of service
 Precedence (3 bits): 0 (normal precedence) ~ 7
(network control)
 Delay (1 bit): low delay
 Throughput (1 bit): high throughput
 Reliability (1 bit): high reliability
 unused (2 bits)
Computer Networks Fall 2002 Page 105
The IP Protocol
 Total length: measured in octets, including
the length of the header and data
 Identification: datagram identifier
 Flags
 unused (1 bit)
 DF (1 bit): don’t fragment
 MF (1 bit): more fragment
 Fragment offset: the offset of this fragment in
the original datagram, measured in units of 8
octets
Computer Networks Fall 2002 Page 106
The IP Protocol
 Time to live (TTL): packet lifetime, measured
in seconds (hops, in practice)
 Protocol: protocol type (e.g., TCP, UDP, ...),
RFC 170
 Header checksum
 Source IP address
 Destination IP address
 Options
 Padding: to make the header extend to an
exact multiple of 32 bits, containing 0
Computer Networks Fall 2002 Page 107
IP Options
 Security
 to specify how secret the datagram is
 Strict source routing
 to give the complete path to be followed
 Loose source routing
 to give a list of routers not to be missed
 Record route
 to make each router append its IP address
 Timestamp
 to make each router append its address and
timestamp
Computer Networks Fall 2002 Page 108
IP Option Code

Computer Networks Fall 2002 Page 109


IP Option Code
 Copy (1 bit):
 0: the option will only be copied into the first
fragment and not to all fragments
 1: the option should be copied into all fragments
 Class (2 bits)
 0: datagram or network control
 1: reserved
 2: debugging and measurement
 3: reserved
 Number (5 bits)
Computer Networks Fall 2002 Page 110
Computer Networks Fall 2002 Page 111
IP Addressing

 32 bits long, represented in dotted


decimal notation, like 192.41.6.20
 Network number + Host number
 Network numbers are assigned by the
NIC (Network Information Center) to
avoid conflicts.
 All the hosts in a network must have
the same network number.

Computer Networks Fall 2002 Page 112


IP Addresses
1 2 3 Range of host
Class 01234567890123456789012345678901 addresses
1.0.0.0 to
A 0Network Host 127.255.255.255
128.0.0.0 to
B 10 Network Host 191.255.255.255
192.0.0.0 to
C 110 Network Host 223.255.255.255
224.0.0.0 to
D 1110 Multicast address 239.255.255.255
240.0.0.0 to
E 11110 Reserved for future use 247.255.255.255
Computer Networks Fall 2002 Page 113
Special IP Addresses
00000000000000000000000000000000 This host

00 00 Host A host on this network

11111111111111111111111111111111 Broadcast on the


local network

Network 11 11 Broadcast on a
distant network

127 (anything) Loopback

Computer Networks Fall 2002 Page 114


Network Growth Problem

 Problem
 Immense administrative overhead
 Every time a new network is installed the system
administrator has to contact NIC to get a new network
number.
 Then this number must be announced worldwide.
 Solution: To minimize network numbers by
sharing one network number among multiple
physical networks

Computer Networks Fall 2002 Page 115


Subnet Addressing
•ack like a single network to the outside world
•split into several parts for internal use

Computer Networks Fall 2002 Page 116


Subnets
A Class B Network Host Part

IP address Network Subnet Host

Subnet mask 11 11 11 11 00 00

 The standard does not restrict subnet masks


to select contiguous bits of the address.

Computer Networks Fall 2002 Page 117


How Router Processes IP Packets
network0 A (network0, 0) IP A
(network1, 0) IP B
network1 B
... ...
M N (this-net, host0) IP M
(this-net, host1) IP N
... ...
(default router)
(this-net, subnet, 0) IP X
When subnetting
(this-net, this-sub, host1) IP Y is introduced

Computer Networks Fall 2002 Page 118


The Internet Control Message
Protocol (ICMP)
 ICMP allows routers to send error or control
messages to other routers or hosts; ICMP
provides communication between the
Internet Protocol software on one machine
and the Internet Protocol software on another.

Computer Networks Fall 2002 Page 119


ICMP

Computer Networks Fall 2002 Page 120


The Internet Control Message
Protocol (ICMP)
 RFC 792
 Each ICMP message has its own format.
 Example: Echo request or reply
 Type=8: request, Type=0: reply
 Code=0

IP header
Type Code Checksum
Identifier Sequence number
Optional data
Computer Networks Fall 2002 Page 121
The Address Resolution Protocol
(ARP RFC 826)
 To map an IP address onto data link layer
address, such as Ethernet.
 An IP host runs the ARP protocol to inquiry
the unknown data link layer address of a
destination IP address before a datagram is
sent.
 The ARP of a host may maintain a cache to
record known IP address and DLL address
pairs.
 A machine may broadcast its own mapping
when it boots by using ARP.
Computer Networks Fall 2002 Page 122
Example: ARP

Computer Networks Fall 2002 Page 123


The Reverse Address Resolution
Protocol (RARP)
 RFC 903
 Allow a newly-booted (diskless) workstation
(with a DLL address) to discover its IP
address (by broadcasting )
 Need a RARP server on each network
 Bootp, RFCs 951, 1048, and 1084
 Use UDP messages which are forwarded over
routers to find the file server that holds the
mapping

Computer Networks Fall 2002 Page 124


The Interior Gateway Routing
Protocol
 A Routing Protocol within an autonomous
system (AS).
 Internet interior gateway protocol
 Original: a distance vector protocol, Routing
Information Protocol (RIP), based on the Bellman-
Ford algorithm
 Successor (1979): a link state protocol
 Now (1990): Open Shortest Path First (OSPF), RFC
1247 (ver. 1) and RFC 1583 (ver. 2).

Computer Networks Fall 2002 Page 125


Objectives of OSPF
 published in the open literature
 to support a variety of distance metrics:
distance, delay, ...
 a dynamic algorithm
 to support routing based on type of service
 load balancing
 support for hierarchical systems
 security
 tunneling

Computer Networks Fall 2002 Page 126


Graph Representation of an AS

 OSPF computes the shortest path from


every router to every other router.
A B C router
WAN
LAN

A B C Each arc is assigned a cost

Computer Networks Fall 2002 Page 127


Areas and Backbone Areas
 An AS can be divided into numbered areas
 an area is a network or a set of continuous
networks (a generalization of a subnet)
 areas do not overlap
 Within an area, each router has the same link
state databases and runs the same shortest path
algorithm
 backbone area (area 0)
 all areas within an AS are connected to the
backbone, possibly by tunnels

Computer Networks Fall 2002 Page 128


Classes of Routers

Computer Networks Fall 2002 Page 129


Open Shortest Path First (OSPF)

 Type of service routing: multiple graphs


 one labeled with the costs when delay is
the metric
 one labeled with the costs when
throughput is the metric
 one labeled with the costs when reliability
is the metric
 Three kinds of routes: intra-area, inter-
area and inter-AS.
Computer Networks Fall 2002 Page 130
OSPF Messages
Message type Description
Hello Used to discover who the neighbors are
Link state update Provides the sender’s costs to its neighbors
Link state ack Acknowledges link state update
Database description Announces which updates the sender has
Link state request Requests information from the partner

Computer Networks Fall 2002 Page 131


OSPF Messages

 When a router boots, it sends HELLO


messages on all of its point-to-point lines and
multicasts then on LANs to the group
consisting of all the other routers.
 During normal operation, each router
periodically floods LINK STATE UPDATE
messages to each of its adjacent routers.
Routers also send these messages when a
line goes up or down or its cost changes.
Computer Networks Fall 2002 Page 132
OSPF Messages

 DATABASE DESCRIPTION messages


give the sequence numbers of all the
link state entries currently held by the
sender. By comparing its own values
with those of the sender, the receiver
can determine who has the most recent
values. These messages are used when
a line a brought up.
Computer Networks Fall 2002 Page 133
The Exterior Gateway Routing
Protocol
 A Routing Protocol between ASes
 The main goal of an interior gateway protocol is to
route efficiently, while the exterior gateway
protocols have to worry about “politics”.
 Border Gateway Protocol (BGP)
 described in RFC 1654
 BGP1 in 1989, current version BGP4 in 1993.
 fundamentally a distance vector protocol.

Computer Networks Fall 2002 Page 134


Policies

 Political, security, or economic


considerations
 No transit traffic through certain ASes.
 Never put Iraq on a router starting at the
Pentagon.
 Only transit Albania if there is no
alternative to the destination.
 Traffic starting or ending at IBM should not
transit Microsoft.
Computer Networks Fall 2002 Page 135
Border Gateway Protocol (BGP)

 Each BGP keeps track of the exact path


used to each destination
B C Information F receives
D
A from its neighbors about D
G
F From B: “I use BCD”
H From G: “I use GCD”
From I: “I use IFGCD”
E From E: “I use EFGCD”
I J
Computer Networks Fall 2002 Page 136
Border Gateway Protocol (BGP)

 After all the paths come in from the


neighbors, the best can be determined.
 Since each router keeps the exact
routes used, the count-to-infinite
problem can be easily solved.
 BGPs uses TCP as its transport protocol
(port 179) for reliable transmission.

Computer Networks Fall 2002 Page 137


How BGP Solves The Count-to-
Infinity Problem

B C Information F receives
D
A from its neighbors about D

G From B: “I use BCD”


F
Nothing from G
H
From I: “I use IFGCD”
E From E: “I use EFGCD”
I J
F chooses “FBCD” as its
new route

Computer Networks Fall 2002 Page 138


Internet Multicasting
 IP supports multicasting using class D addresses.
 Permanent addresses and temporary addresses.
 Permanent addresses
 224.0.0.1 all systems on a LAN
 224.0.0.2 all routers on a LAN
 224.0.0.5 all OSPF routers on a LAN
 224.0.0.6 all designated routers on a LAN
 A multicast router uses the IGMP (Internet Group
Management Protocol) to group hosts the groups
their processes currently belong to.
 IGMP in RFC 1112.
 Multicast routing uses spanning trees.
Computer Networks Fall 2002 Page 139
IGMP (Internet Group
Management Protocol)
Query
1, 3 Multicast 1, 2 3
router

Hardware Multicast

Response
Multicast
router
1, 2
1, 3 3

Computer Networks Fall 2002 Page 140


Mobile IP
 Problems with host mobility in Internet
 IP address implies host location
 Major goals of Mobile IP
 Mobile host can use its home IP address anywhere.
 Software changes to the fixed hosts were not
permitted
 changes to the router software and tables were
not permitted
 most packets for mobile hosts should not make
detours on the way
 no overhead should be incurred when at home
Computer Networks Fall 2002 Page 141
How to Handle Mobility

Sender Home agent Foreign agent Mobile host

register
Packet for He is here care-of-address
mobile host
(tunneling)
care-of-address Packet for
mobile host

Computer Networks Fall 2002 Page 142


Gratuitous ARP
Router at
home’s
LAN Home agent Mobile Host

Packet for (about to


mobile host gratuitous ARP move)

ARP Query
Packet for
mobile host ARP Response
Packet for (tunneling)
mobile host

Computer Networks Fall 2002 Page 143


IP Addressing Problems
 32-bit IP address space is not enough
 Organizing the address space by classes
wastes millions of them
 a class B address is far too large for most
organizations
 the routing table explosion
 every router in the Internet would need a
table with half a million entries, if that
much class C networks are in use

Computer Networks Fall 2002 Page 144


Classless InterDomain Routing
(CIDR)
 To solve the IP address depletion problem
and the routing table explosion problem
 RFC 1519
 The basic idea behind CIDR is to allocate the
remaining class C networks in variable- sized
blocks

192.0.0.0 223.255.255.255

Computer Networks Fall 2002 Page 145


Example
 X University needs 2048 addresses and is
assigned the addresses 194.24.0.0 through
194.24.7.255, along with mask 255.255.248.0.
 Y University needs 4096 addresses and is
assigned the addresses 194.24.16.0 through
194.24.31.255, along with mask
255.255.240.0.
 Z University needs 1024 addresses and is
assigned the addresses 194.24.8.0 through
194.24.11.255, along with mask
255.255.252.0.
Computer Networks Fall 2002 Page 146
Example

 Routing table with entries


 base address: 194.24.0.0, mask: 255.255.248.0
 base address: 194.24.16.0, mask: 255.255.240.0
 base address: 194.24.8.0, mask: 255.255.252.0
 Destination address with 194.24.17.4
matching the second entry, so the packet is
sent to the Y router.

Computer Networks Fall 2002 Page 147


Classless InterDomain Routing
(CIDR)
 The world was partitioned into zones, each given a
portion of the class C address space:
 Addresses 194.0.0.0 to 195.255.255.255 for Europe
 Addresses 196.0.0.0 to 197.255.255.255 for Others
 Addresses 198.0.0.0 to 199.255.255.255 for North America
 Addresses 200.0.0.0 to 201.255.255.255 for Central and
South America
 Addresses 202.0.0.0 to 203.255.255.255 for Asia and Pacific
 Addresses 204.0.0.0 to 207.255.255.255 for Others
 Addresses 208.0.0.0 to 223.255.255.255 reserved for future
use

Computer Networks Fall 2002 Page 148


IP Address Allocation
 Class A address allocation is restricted.
 Class B address are also restricted .They will be
allocated only if the need for them is justified.
 Class C addresses are allocated with a contiguous
block of addresses which consists of several
contiguous class C addresses.Class C addresses are
being distributed to ISPs so that the allocation could
last at least two years.
 If a subscriber has a requirement for more than 4096
IP address, a Class B network number may be
allocated.
 Organizations are encouraged to use Variable Length
Subnet Mask for efficient use of address space.
Computer Networks Fall 2002 Page 149
IPv6

 A modified combined version of Deering


and Francis proposals. SIPP (Simple
Internet Protocol Plus)
 Longer addresses
 Simplification of headers
 Support for options
 Security and authentication
 Type of services
Computer Networks Fall 2002 Page 150
The IPv6 Header
0 4 8 16 24 31
Version Priority Flow label
Payload length Next header Hop limit

Source address
(16 bytes)

Destination address
(16 bytes)

Computer Networks Fall 2002 Page 151


The IPv6 Protocol

 Version: 6
 Priority
 0~7: for transmission possibly slowed down in
case of congestion
 8~15: for real time traffic with constant sending
rate
 suggestion
 1: news
 4: FTP
 6: Telnet

Computer Networks Fall 2002 Page 152


The IPv6 Protocol
 Flow label: for setting up a pseudo
connection with particular properties and
requirements
 Payload length: information bytes following
the 40 byte header
 Next header: specify which of the (currently)
six extension headers, if any, follows the
header. If the header is the last IP header,
the Next header specifies the transport
protocol handler.
 Hop limit: for limiting packet lifetime
Computer Networks Fall 2002 Page 153
IPv6 Address Expression
 Written as eight groups of four hexadecimal
digits with colons between groups
8000:0000:0000:0000:0123:4567:89AB:CDEF
 optimizations
8000::123:4567:89AB:CDEF
 IPv4 addresses
::192.31.20.46

Computer Networks Fall 2002 Page 154

S-ar putea să vă placă și