Tải bản đầy đủ (.pdf) (24 trang)

Chapter 03 network layer and IP

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.3 MB, 24 trang )

Contents
Chapter 3: Network Layer and IP
Address


Network Layer



IP Address




3.1 Introduction
3.2 Internet Protocol






Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6



3.3 Routing algorithms








Link state
Distance Vector
Hierarchical routing

3.4 Routing in the
Internet


RIP
OSPF



BGP



4-2

How TCP/IP works …

Network layer



segment





datagram




transport segment from sending
to receiving host
on sending side encapsulates
segments into datagrams
on rcving side, delivers
segments to transport layer

application
transport
network
data link
physical

network
data link
physical

network layer protocols in every
host, router


network
data link
physical
network
data link
physical

network
data link
physical
network
data link
physical

network
network
data link
data link
physical
physical
network
data link
physical

router examines header fields
in all IP datagrams passing
through it.
network
data link

physical

network
data link
physical

network
data link
physical

application
transport
network
data link
physical

4-4

1


Interplay between routing and forwarding

Two Key Network-Layer Functions

routing algorithm






forwarding: move packets from
router’s input to appropriate router
output

local forwarding table
header value output link
0100
0101
0111
1001

routing: determine route taken by
packets from source to dest.
 routing

3
2
2
1

value in arriving
packet’s header

algorithms

0111

1
3 2


Datagram networks

Forwarding table



no call setup at network layer
routers: no state about end-to-end connections



packets forwarded using destination host address







Destination Address Range

no network-level concept of “connection”
packets between same source-dest pair may take different paths

application
transport
network
data link 1. Send data
physical


application
transport
2. Receive data network
data link
physical

4 billion
possible entries
Link Interface

11001000 00010111 00010000 00000000
through
11001000 00010111 00010111 11111111

0

11001000 00010111 00011000 00000000
through
11001000 00010111 00011000 11111111

1

11001000 00010111 00011001 00000000
through
11001000 00010111 00011111 11111111

2

otherwise


3

4-7

2


Longest prefix matching
Prefix Match
11001000 00010111 00010
11001000 00010111 00011000
11001000 00010111 00011
otherwise

Contents


Link Interface
0
1
2
3



3.1 Introduction
3.2 Internet Protocol





Examples



DA: 11001000 00010111 00010110 10100001
DA: 11001000 00010111 00011000 10101010



Which interface?
Which interface?

Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6



3.3 Routing algorithms






Link state

Distance Vector
Hierarchical routing

3.4 Routing in the
Internet


RIP
OSPF



BGP



4-10

The Internet Network layer
Host, router network layer functions:
Transport layer: TCP, UDP

Network
layer

IP protocol
•addressing conventions
•datagram format
•packet handling conventions


Routing protocols
•path selection
•RIP, OSPF, BGP

forwarding
table

IP – Internet Protocol





IP is the main protocol of the TCP/IP protocol
suite.
Data packet is transmitted as a datagram.
IP provides an unreliable, connectionless
datagram delivery service.

ICMP protocol
•error reporting
•router “signaling”

Link layer
physical layer

3


IP - Datagram delivery service



Unreliable:

Review: Connectionless vs.
Connection-oriented Protocols


guarantees that an IP datagram successfully
gets to its destination.
 Provides a best effort service.
 Reliability must be provided by the upper layers
(e.g., TCP).

Send data across the network to its destination
without guaranteeing receipt
 Fast; require little overhead


 No



Connectionless:
 not

maintain any state information about
successive datagrams.
 IP datagrams can get delivered out of order.


Connectionless protocols



Connection-oriented protocols
Establish a formal connection between two
computers, guaranteeing the data will reach its
destination
 Slower; more reliable


IP datagram format

IP Datagram

IP protocol version
number
header length
(bytes)
“type” of data
max number
remaining hops
(decremented at
each router)
Header
10101011101010101010010101010100101010100
11010010101010010101111111010000011101111
10100001011101010100110101011110100000101
00100000000010101000011010000111111010101
......... 1011011001010100011001001010110

Data

upper layer protocol
to deliver payload to

how much overhead
with TCP?
 20 bytes of TCP
 20 bytes of IP
 = 40 bytes + app
layer overhead

32 bits
type of
ver head.
len service
16-bit identifier
upper
time to
layer
live

flgs

total datagram
length (bytes)
length
fragment
offset
header

checksum

for
fragmentation/
reassembly

32 bit source IP address
32 bit destination IP address
Options (if any)

data
(variable length,
typically a TCP
or UDP segment)

E.g. timestamp,
record route
taken, specify
list of routers
to visit.

4


IP Address

IP Addressing: introduction





IP address: 32-bit
identifier for host,
router interface
interface: connection
between host/router
and physical link

223.1.1.1



223.1.1.2
223.1.1.4
223.1.1.3

223.1.2.1



223.1.2.9



223.1.2.2

223.1.3.27




router’s typically have
multiple interfaces



host typically has one
interface
IP addresses associated
223.1.1.1 = 11011111 00000001 00000001 00000001
with each interface



IPv4: 32-bits
IPv6: 128-bits

223.1.3.2

223.1.3.1

223

Version:

1

Addressing and Delivering

1


1

IPv4
Size: 4 bytes (32 bits)
Format:
— Each byte is represented by a decimal number,
called a octet
— two octets separated by a dot “.”
 Example:



10101100.00011101.00000001.00001010
172.29.1.10


Divided into 2 parts:



Network ID (NetID)
Host ID

5


IPv4

IPv4






Subnet mask:
Use to identify the NetID and HostID parts of
the IPv4 address
4 bytes in size
 NetID

bits have a value of 1
bits have a value of 0

 HostID

IPv4

IPv4

NetAddr = SubnetMask AND HostIP



Network address (NetAddr):





Example: 172.29.5.128/255.255.192.0

(or 172.29.5.128/18)

HostIP 1010 1100 0001 1101 0000 0101
Subne
1111 1111 1111 1111 1100 0000
tMask
Net
1010 1100 0001 1101 0000 0000
Addr



0000 0000
0000 0000

Broadcast address:





1000 0000

NetID bits: keep the same
Host ID bits: up 1

Example: 192.168.1.2/24






NetID bits: keep the same
Host ID bits: clear to 0

NetAddr: 192.168.1.0
Broadcast: 192.168.1.255

Two nodes with the same network address belong to same network:
 Example:
192.168.1.2 and 192.168.1.200: same network
192.168.1.2 and 192.168.2.1: different network

6


IPv4

IPv4: class

Number of valid host addresses in a network:
 2^m-2: m is the number of bits in the HostID
 Host addresses range:
(Network address + 1) -> (Broadcast address –
1)
 Example: 172.29.1.1/16
=>m = 32-SM=32-16
=>Number of hosts in this network = 2^16-2



IPv4: class

IPv4:


Default subnet mask:
 Class

A: 255.0.0.0 (/8)
B: 255.255.0.0 (/16)
 Class C: 255.255.255.0 (/24)
 Class



Example: 15.19.18.29
 Class: A
 Default

Subnet mask: 255.0.0.0

7


IPv4:


IPv4: Exercise

For IP address: 172.29.7.10




Class: B
 SubnetMask: 255.255.0.0 (/16)
 NetAddr = IP address AND SubnetMask


172.29.7.10 AND

For IP address: 191.24.197.12/20
 Class:

?

 SubnetMask:

?

 NetAddr

:?
of hosts in the network: ?
 Host addresses range: ?
 Broadcast address: ?
 Number

255.255.0.0
172.29.0.0


Number of hosts in the network: 2^m-2=2^16-2
Host addresses range: 172.29.0.1->172.29.255.254
 Broadcast address: 172.29.1111 1111. 1111 1111



IPv4: Public address Vs. Private

IPv4: Classify


Public address:





Used to exchange on the Internet
Real address

Private address:





address

Used to address LANs within an organization
Virtual Address


Clas
s

Address (range)

Network
s

Total Private
Hosts

A

10.0.0.0

1

16,777,214

B

172.16.0.0-172.31.0.0

16

1,048,544

C


192.168.0.0-192.168.255.0

256

65,024

Loopback address: 127.0.0.0 – 127.255.255.255

8


IPv4: Subnetting


Reasons for subnetting:
the number of nodes => Increase
network throughput
 Increased security
 Ease of administration
 Ease of maintenance
 Avoid wasting IP addresses

IPv4: Subnetting


 Reduce

Rule:
 Borrow


the first bits in HostID => NetID
of subnets = 2^n (n: number of bits
borrowed from HostID)
 New Subnet Mask = SM + n
 Number



Planning:
 (1)

Number of subnets to divide <=2^n, =>n=?
Number of nodes in each subnet <=2^m – 2,
=>n=?

 (2)

IPv4: Subnetting

IPv4: Subnetting

A company is granted the site address
192.168.1.0 The company needs 5 subnets.
Design the subnets:
+ The number of the appropriate subnets?
+ The number of Hosts in each subnet?
+ New Subnet Mask?
+ Host addresses range of each subnet?
+ Broadcast address of each subnet?


192.168.1.0/SM
Class: C (N.N.N.H), =>SM=24
+ The number of the appropriate subnets:
5 subnets <=2^n, => n=3 (n: number of bits borrowed from
HostID)
The number of the appropriate subnets: 2^3 = 8
+ The number of Hosts in each subnet:
m is the number of bits in the HostID: m= (32-24) – 3 = 5
The number of Hosts in each subnet: 2^m – 2 = 2^5 – 2 =
30
+ New Subnet Mask?
NewSM=SM+n=24+3=27
255.255.255.1110 0000 <=> 255.255.255.224



9


IPv4: Subnetting

IPv4: Subnetting

+ Host addresses range of each subnet?
192.168.1.xxxh hhhh

+ Host addresses range of each subnet?
192.168.1.0110 0000 : 192.168.1.96 (Subnet No.4)

192.168.1.0000 0000 : 192.168.1.0 (Subnet No.1)

Host range: 192.168.1.1 - > 192.168.1.30

Host range: 192.168.1.97 - > 192.168.1.126
Broadcast: 192.168.1. 0111 1111 : 192.168.1.127

Broadcast: 192.168.1.0001 1111 : 192.168.1.31
192.168.1.0010 0000 : 192.168.1.32 (Subnet No.2)
Host range: 192.168.1.33 - > 192.168.1.62

192.168.1.1000 0000 : 192.168.1.128 (Subnet No.5)
Host range: 192.168.1.129 - > 192.168.1.158

Broadcast: 192.168.1.0011 1111 : 192.168.1.63

Broadcast: 192.168.1. 1001 1111 : 192.168.1.159

192.168.1.0100 0000 : 192.168.1.64 (Subnet No.3)

192.168.1.1010 0000

Host range: 192.168.1.65 - > 192.168.1.94
Broadcast: 192.168.1. 0101 1111 : 192.168.1.95

192.168.1.1100 0000
192.168.1.1110 0000

IPv4: Subnetting

IPv4: Homework


Exercise: A company is granted the site
address 172.29.0.0/18. The company needs 5
subnets. Design the subnets:
+ The number of the appropriate subnets?
+ The number of Hosts in each subnet?
+ New Subnet Mask?
+ Host addresses range of each subnet?
+ Broadcast address of each subnet?

Given 172.100.112.4/19. Please indicate:



1. Which network does the above address belong to?
2. The number of IP addresses that can be used in the network. And please tell me
which addresses include?
3. Broadcast address of that network.
4. With the above network address, divide it into 5 subnets.
+ The number of the appropriate subnets?
+ The number of Hosts in each subnet?
+ New Subnet Mask?
+ Host addresses range of each subnet?
+ Broadcast address of each subnet?

10


IP addresses: how to get one?

Goal: allow host to dynamically obtain its IP address from network

server when it joins network

Q: How does a host get IP address?


hard-coded by system admin in a file

Windows: control-panel->network->configuration>tcp/ip->properties
 UNIX: /etc/rc.config




DHCP: Dynamic Host Configuration Protocol: dynamically
get address from as server


“plug-and-play”

223.1.1.2
223.1.1.4

223.1.3.1






host broadcasts “DHCP discover” msg

DHCP server responds with “DHCP offer” msg
host requests IP address: “DHCP request” msg
DHCP server sends address: “DHCP ack” msg

local network
(e.g., home network)
10.0.0/24

10.0.0.1

10.0.0.4
223.1.2.9

B
223.1.1.3

DHCP overview:

rest of
Internet

223.1.2.1

DHCP
server

Can renew its lease on address in use
Allows reuse of addresses (only hold address while connected an “on”)
Support for mobile users who want to join network (more shortly)


NAT: Network Address Translation

DHCP client-server scenario
A 223.1.1.1

DHCP: Dynamic Host Configuration Protocol

223.1.3.27

223.1.2.2
223.1.3.2

10.0.0.2

138.76.29.7

E

arriving DHCP
client needs
address in this
network

10.0.0.3

All datagrams leaving local
network have same single source
NAT IP address: 138.76.29.7,
different source port numbers


Datagrams with source or
destination in this network
have 10.0.0/24 address for
source, destination (as usual)

11


NAT: Network Address Translation


NAT: Network Address Translation

Motivation: local network uses just one IP address as far as
outside world is concerned:
 range

of addresses not needed from ISP: just one
IP address for all devices
 can change addresses of devices in local network
without notifying outside world
 can change ISP without changing addresses of
devices in local network
 devices inside local net not explicitly addressable,
visible by outside world (a security plus).

ARP: Address Resolution Protocol

2: NAT router
changes datagram

source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
2

RARP

48-bit Ethernet Address

S: 10.0.0.1, 3345
D: 128.119.40.186, 80

S: 138.76.29.7, 5001
D: 128.119.40.186, 80

S: 128.119.40.186, 80
D: 138.76.29.7, 5001

3: Reply arrives
dest. address:
138.76.29.7, 5001

3

1
10.0.0.4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345


10.0.0.1

10.0.0.2

4

10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345

RARP: Reverse Address
Resolution Protocol


ARP

1: host 10.0.0.1
sends datagram to
128.119.40.186, 80

138.76.29.7, 5001 10.0.0.1, 3345
……
……

138.76.29.7




32-bit Internet Address

NAT translation table
WAN side addr
LAN side addr







RARP = Reverse ARP.
RARP is the opposite of ARP.
ARP is used when the IP address is known but
the physical address is not known.
RARP is used when the physical address is
known but the IP address is not known.
RARP is often used in conjunction with the
BOOTP protocol (boot PROM) to boot diskless
workstations.

12


ICMP - Internet Control Message
Protocol











Data sent to a remote computer often travels
through one or more routers.
These routers can encounter a number of problems
in sending the message to its ultimate destination.
Routers use Internet Control Message Protocol
(ICMP) messages to notify the source IP of these
problems.
ICMP is also used for other diagnosis and
troubleshooting functions.
ICMP messages encapsulated within an IP
datagram.

IPv6 Header (Cont)
Priority: identify priority among datagrams in flow
Flow Label: identify datagrams in same “flow.”
(concept of“flow” not well defined).
Next header: identify upper layer protocol for data

IPv6





Initial motivation: 32-bit address space soon to
be completely allocated.
Additional motivation:
 header

format helps speed processing/forwarding
 header changes to facilitate QoS
IPv6 datagram format:
 fixed-length 40 byte header
 no fragmentation allowed

Contents



3.1 Introduction
3.2 Internet Protocol






Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6




3.3 Routing algorithms






Link state
Distance Vector
Hierarchical routing

3.4 Routing in the
Internet


RIP
OSPF



BGP



4-52

13



Interplay between routing, forwarding

Graph abstraction
5

routing algorithm

2

local forwarding table
header value output link
0100
0101
0111
1001

v

u

3
2
2
1

2
1

Graph: G = (N,E)


x

3

w
3

1

5

z

1
2

y

N = set of routers = { u, v, w, x, y, z }
value in arriving
packet’s header

E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
1

0111

Remark: Graph abstraction is useful in other network contexts

3 2


Example: P2P, where N is set of peers and E is set of TCP connections

Graph abstraction: costs
5
2

u

v
2

1

x

• c(x,x’) = cost of link (x,x’)
3

w
3

1

5

z

1


y

- e.g., c(w,z) = 5

2

• cost could always be 1, or
inversely related to bandwidth,
or inversely related to
congestion

Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
Question: What’s the least-cost path between u and z ?

Routing algorithm: algorithm that finds least-cost path

Routing Algorithm classification
Global or decentralized
information?
Global:
 all routers have complete
topology, link cost info
 “link state” algorithms
Decentralized:
 router knows physicallyconnected neighbors, link costs
to neighbors
 iterative process of
computation, exchange of info
with neighbors
 “distance vector” algorithms


Static or dynamic?
Static:
routes change slowly
over time
Dynamic:
 routes change more
quickly


 periodic

update
response to link
cost changes

 in

14


Contents



3.1 Introduction
3.2 Internet Protocol







Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6

A Link-State Routing Algorithm








Dijkstra’s algorithm

3.3 Routing algorithms
Link state
Distance Vector
Hierarchical routing



3.4 Routing in the
Internet



RIP
OSPF



BGP







Notation:
c(x,y): link cost from node x

net topology, link costs known
to all nodes
 accomplished via “link
state broadcast”
 all nodes have same info
computes least cost paths
from one node (‘source”) to
all other nodes
 gives forwarding table for
that node
iterative: after k iterations,
know least cost path to k
dest.’s




to y; = ∞ if not direct
neighbors

D(v): current value of cost of
path from source to dest. v



p(v): predecessor node
along path from source to v



N': set of nodes whose least
cost path definitively known



4-57

Dijsktra’s Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4
if v adjacent to u
5

then D(v) = c(u,v)
6
else D(v) = ∞
7
8 Loop
9 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 known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'

Dijkstra’s algorithm: example
Step
0
1
2
3
4
5

N'
u
ux
uxy
uxyv
uxyvw
uxyvwz


D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y

D(x),p(x)
1,u

D(y),p(y)

2,x

D(z),p(z)



4,y
4,y
4,y

5
2

u


v
2

1

x

3

w
3

1

5

z

1

y

2

15


Dijkstra’s algorithm: example (2)

Dijkstra’s algorithm, discussion


Resulting shortest-path tree from u:

v

Algorithm complexity: n nodes
each iteration: need to check all nodes, w, not in N
2
 n(n+1)/2 comparisons: O(n )
 more efficient implementations possible: O(nlogn)


w

u

z
x

Oscillations possible:
e.g., link cost = amount of carried traffic

y



Resulting forwarding table in u:
destination

link


v
x

(u,v)
(u,x)

y

(u,x)

w

(u,x)

z

(u,x)

1

D
0
1



3.1 Introduction
3.2 Internet Protocol







Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6

0 0

C

A

1+e

2+e

e

D 1+e 1 B
0
0
C

B
1


e

0

… recompute
routing

initially

Contents


A

0

D

A

2+e

2+e
0 0 B
1
1+e

C


… recompute

A

0

D 1+e 1 B
e
0
C
… recompute

Distance Vector Algorithm








Bellman-Ford Equation (dynamic programming)
Define
dx(y) := cost of least-cost path from x to y

3.3 Routing algorithms
Link state
Distance Vector
Hierarchical routing


3.4 Routing in the
Internet


RIP
OSPF



BGP



Then
dx(y) = min {c(x,v) + dv(y) }
v

where min is taken over all neighbors v of x
4-63

16


Bellman-Ford example
5
2

u

v

2

1

x

3

w
3

1

Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
z
2




5

1

y

Distance Vector Algorithm

B-F equation says:
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





Dx(y) = estimate of least cost from x to y
Node x knows cost to each neighbor v: c(x,v)
Node x maintains distance vector Dx = [Dx(y):
yєN]
Node x also maintains its neighbors’ distance
vectors
 For

each neighbor v, x maintains
Dv = [Dv(y): y є N ]

Node that achieves minimum is next
hop in shortest path ➜ forwarding table

Distance vector algorithm (4)
Basic idea:
From time-to-time, each node sends its own distance
vector estimate to neighbors
 Asynchronous
 When a node x receives new DV estimate from

neighbor, it updates its own DV using B-F equation:
Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

Distance Vector Algorithm (5)
Iterative, asynchronous:
each local iteration caused
by:



 Under minor, natural conditions, the estimate Dx(y)

converge to the actual least cost dx(y)




local link cost change
DV update message from
neighbor

Distributed:


Each node:
wait for (change in local link
cost or msg from neighbor)
recompute estimates

each node notifies neighbors

only when its DV changes


neighbors then notify their
neighbors if necessary

if DV to any dest has
changed, notify neighbors

17


from

7

z

time

4-69

Link cost changes:
 node detects local link cost change
 updates routing info, recalculates

distance vector
 if DV changes, notify neighbors

from


from

x 0 2 3
y 2 0 1
z 3 1 0

cost to
x y z

cost to
x y z

x 0 2 7
y 2 0 1
z 7 1 0

x 0 2 3
y 2 0 1
z 3 1 0

cost to
x y z

Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3

2


x

y

1

7

z

cost to
x y z

x 0 2 7
y 2 0 1
z 3 1 0

x 0 2 3
y 2 0 1
z 3 1 0
time

Distance Vector: link cost changes
Example:

1
4

x


x ∞∞ ∞
y ∞∞ ∞
z 7 1 0

x 0 2 3
y 2 0 1
z 7 1 0

4-70

Distance Vector: link cost changes

“good
news
travels
fast”

x ∞ ∞ ∞
y 2 0 1
z ∞∞ ∞
node z table
cost to
x y z

cost to
x y z

from

from


x

1

cost to
x y z

from

x ∞ ∞ ∞
y 2 0 1
z ∞∞ ∞
node z table
cost to
x y z
from

y

2

x ∞∞ ∞
y ∞∞ ∞
z 7 1 0

x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
node y table

cost to
x y z

from

x 0 2 3
y 2 0 1
z 7 1 0

node x table
cost to
x y z
from

from

from

x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
node y table
cost to
x y z

cost to
x y z

from


node x table
cost to
x y z

Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2

from

Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3

Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2

y
50

 Consider the three-node topology shown in Figure

1

z

At time t0, y detects the link-cost change, updates its DV,
and informs its neighbors.

4.30. Rather than having the link costs shown in
Figure 4.30, the link costs are c(x,y) = 3, c(y,z) = 6,

c(z,x) = 4. Compute the distance tables after the
initialization step and after each iteration of a
synchronous version of the distance-vector algorithm

At time t1, z receives the update from y and updates its table.
It computes a new least cost to x and sends its neighbors its DV.
At time t2, y receives z’s update and updates its distance table.
y’s least costs do not change and hence y does not send any
message to z.

3

x

y

4

6

z

18


Comparison of LS and DV algorithms
Message complexity





Robustness: what happens
if router malfunctions?
LS:

LS: with n nodes, E links,
O(nE) msgs sent
DV: exchange between
neighbors only
 convergence time varies




Speed of Convergence




Contents





node can advertise
incorrect link cost
each node computes only
its own table






DV:

LS: O(n2) algorithm requires
O(nE) msgs
 may have oscillations
DV: convergence time varies
 may be routing loops
 count-to-infinity problem




3.1 Introduction
3.2 Internet Protocol



Datagram format
IPv4 addressing
DHCP, NAT, ARP










ICMP
IPv6

Link state
Distance Vector
Hierarchical routing

3.4 Routing in the
Internet


RIP
OSPF



BGP



DV node can advertise
incorrect path cost
each node’s table used by
others


3.3 Routing algorithms


error propagate thru network

4-74

Hierarchical Routing

Hierarchical Routing
Our routing study thus far - idealization



 all routers identical
 network “flat”

… not true in practice
scale: with 200 million
destinations:




can’t store all dest’s in
routing tables!
routing table exchange would
swamp links!

administrative autonomy




internet = network of networks
each network admin may want
to control routing in its own
network



aggregate routers into
regions, “autonomous
systems” (AS)
routers in same AS run
same routing protocol


“intra-AS” routing protocol



routers in different AS can
run different intra-AS
routing protocol

Gateway router
Direct link to router in
another AS



4-76


19


Inter-AS tasks

Interconnected ASes



3c

3a
AS3

3b

2c

2a
1c
1a

AS2

1b AS1

1d

Intra-AS

Routing
algorithm



Inter-AS
Routing
algorithm

2b





3.1 Introduction
3.2 Internet Protocol






Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6

should

forward packet to
gateway router, but
which one?
3c

intra-AS sets entries for
internal dests
inter-AS & intra-As sets
entries for external dests

Contents


AS1 must:
learn which dests are
reachable through AS2,
which through AS3
2.
propagate this reachability
info to all routers in AS1
Job of inter-AS routing!
1.

 router

forwarding table
configured by both intraand inter-AS routing
algorithm



Forwarding
table

suppose router in AS1
receives datagram
destined outside of AS1:

3b

3a
AS3

2a
1c
1a

1d

2c
AS2

2b

1b AS1

Intra-AS Routing


3.3 Routing algorithms









Link state
Distance Vector
Hierarchical routing



 RIP:

3.4 Routing in the
Internet


RIP
OSPF



BGP



also known as Interior Gateway Protocols (IGP)
most common Intra-AS routing protocols:


Routing Information Protocol

 OSPF:

Open Shortest Path First

 IGRP:

Interior Gateway Routing Protocol (Cisco
proprietary)

4-79

20


RIP advertisements

RIP ( Routing Information Protocol)




distance vector algorithm
included in BSD-UNIX Distribution in 1982
distance metric: # of hops (max = 15 hops)






From router A to subnets:
u

z

destination hops
u
1
v
2
w
2
x
3
y
3
z
2

v

A

B

C

D


w

x

distance vectors: exchanged among neighbors
every 30 sec via Response Message (also
called advertisement)
each advertisement: list of up to 25 destination
subnets within AS

y

RIP: Example

RIP: Example
z
w
A

x

y

D

Dest
w
x
z

….

Next hops
- 1
- 1
C 4
… ...

w

B

A

Advertisement
from A to D

z
x

C
Destination Network

w
y
z
x
….

Next Router


Num. of hops to dest.

A
B
B
--

2
2
7
1

….

....

Routing/Forwarding table in D

y

D

B

C
Destination Network

w
y

z
x
….

Next Router

Num. of hops to dest.

A
B
BA
--

2
2
75
1

….

....

Routing/Forwarding table in D

21


RIP: Link Failure and Recovery
If no advertisement heard after 180 sec --> neighbor/link
declared dead

 routes

via neighbor invalidated
advertisements sent to neighbors
 neighbors in turn send out new advertisements (if
tables changed)
 link failure info quickly (?) propagates to entire net
 poison reverse used to prevent ping-pong loops
(infinite distance = 16 hops)
 new

RIP Table processing




RIP routing tables managed by application-level
process called route-d (daemon)
advertisements sent in UDP packets, periodically
repeated
routed
Transprt
(UDP)
network
(IP)
link
physical

OSPF (Open Shortest Path First)









Transprt
(UDP)
forwarding
table

forwarding
table

network
(IP)
link
physical

Link-State Advertisement (LSA)

“open”: publicly available
uses Link State algorithm




routed


LS packet dissemination
topology map at each node
route computation using Dijkstra’s algorithm

OSPF advertisement carries one entry per neighbor
router
advertisements disseminated to entire AS (via flooding)


carried in OSPF messages directly over IP (rather than TCP or
UDP

22


OSPF “advanced” features (not in RIP)







Hierarchical OSPF

security: all OSPF messages authenticated (to prevent
malicious intrusion)
multiple same-cost paths allowed (only one path in RIP)
For each link, multiple cost metrics for different TOS
(e.g., satellite link cost set “low” for best effort; high for

real time)
integrated uni- and multicast support:
 Multicast

OSPF (MOSPF) uses same topology
data base as OSPF



hierarchical OSPF in large domains.

Hierarchical OSPF


two-level hierarchy: local area, backbone.

advertisements only in area
 each nodes has detailed area topology; only know
direction (shortest path) to nets in other areas.

Internet inter-AS routing: BGP


 Link-state









BGP (Border Gateway Protocol): the de facto
standard
BGP provides each AS a means to:
1.

area border routers: “summarize” distances to nets in
own area, advertise to other Area Border routers.
backbone routers: run OSPF routing limited to backbone.
boundary routers: connect to other AS’s.

2.
3.


Obtain subnet reachability information from
neighboring ASs.
Propagate reachability information to all ASinternal routers.
Determine “good” routes to subnets based on
reachability information and policy.

allows subnet to advertise its existence to rest
of Internet: “I am here”

23


BGP basics





Why different Intra- and Inter-AS routing ?

pairs of routers (BGP peers) exchange routing info
over semi-permanent TCP connections: BGP sessions
 BGP sessions need not correspond to physical
links.
when AS2 advertises a prefix to AS1:
 AS2 promises it will forward datagrams towards that
prefix.
 AS2 can aggregate prefixes in its advertisement



3a
AS3

iBGP session

Scale:
hierarchical routing saves table size, reduced update
traffic
Performance:
 Intra-AS: can focus on performance
 Inter-AS: policy may dominate over performance

2c
2a


1c

1a
AS1 1d

Inter-AS: admin wants control over how its traffic routed,
who routes through its net.
Intra-AS: single admin, so no policy decisions needed



eBGP session

3c
3b

Policy:


2b
AS2

1b

Summary



3.1 Introduction

3.2 Internet Protocol






Datagram format
IPv4 addressing
DHCP, NAT, ARP
ICMP
IPv6



3.3 Routing algorithms






Link state
Distance Vector
Hierarchical routing

3.4 Routing in the
Internet



RIP
OSPF



BGP



4-95

24



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×