0% found this document useful (0 votes)
88 views82 pages

Cs8591 Computer Networks: Unit - Iii

The document discusses key concepts in computer networks including: 1. The network layer provides services like logical addressing, packet forwarding at routers and destination computers. Common network layer protocols are IP and ICMP. 2. Routing algorithms determine the best path for packet forwarding and are classified as static or dynamic. Common routing protocols include RIP, OSPF, and BGP. 3. Packet switching is the dominant switching technique where messages are divided into packets that can be routed independently and reassembled at the destination.

Uploaded by

SENTHIL KUMAR T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views82 pages

Cs8591 Computer Networks: Unit - Iii

The document discusses key concepts in computer networks including: 1. The network layer provides services like logical addressing, packet forwarding at routers and destination computers. Common network layer protocols are IP and ICMP. 2. Routing algorithms determine the best path for packet forwarding and are classified as static or dynamic. Common routing protocols include RIP, OSPF, and BGP. 3. Packet switching is the dominant switching technique where messages are divided into packets that can be routed independently and reassembled at the destination.

Uploaded by

SENTHIL KUMAR T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

CS8591 COMPUTER NETWORKS

UNIT – III

Dr.A.Kathirvel, Professor & Head, Computer Science & Engg.


M N M Jain Engineering College, Chennai
Unit - III
NETWORK LAYER
Network Layer Services – Packet
switching – Performance – IPV4
Addresses – Forwarding of IP Packets –
Network Layer Protocols: IP, ICMP v4 –
Unicast Routing Algorithms – Protocols
– Multicasting Basics – IPV6 Addressing
– IPV6 Protocol.
Behrouz A. Forouzan, Data Communications and Networking, Fifth Edition
TMH, 2013 2
Network layer duties

Network layer in an internetwork

3
NETWORK LAYER SERVICES
In this section, we briefly discuss services provided by the network layer. Our discussion
is mostly based on the connectionless service, the dominant service in today’s Internet.
 Logical Addressing
 Services Provided at the Source Computer
 Services Provides at the Each Router
 Services Provided at the Destination Computer

Goal: Router is to forward packets through a set of networks.

1. Classification of Routing algorithm - Two Types


Static routing algorithm ( non – adaptive)
Dynamic routing algorithm (adaptive)
2. Routing tables

At the conceptual level, we can think of the global Internet as a black box network that connects
millions (if not billions) of computers in the world together. At this level, we are only concerned that a
message from the application layer in one computer reaches the application layer in another
computer.
4
Logical Addressing: An imaginary part of the Internet

5
Services provided at the source computer

6
Processing at each router

7
Processing at the destination computer

8
ROUTING
 Routing algorithm:: that part of the Network Layer responsible for
deciding on which output line to transmit an incoming packet.
 Remember: For virtual circuit subnets the routing decision is made
ONLY at set up.
 Algorithm properties:: correctness, simplicity, robustness,
stability, fairness, optimality, and scalability.

Routing Classification Adaptive Routing


based on current measurements
Non-Adaptive Routing
of traffic and/or topology.
1. Flooding 1. centralized
2. Static routing using shortest 2. isolated
path algorithms 3. distributed
9
SWITCHING
From the previous discussion, it is clear that the passage of a message from a source to a destination
involves many decisions. When a message reaches a connecting device, a decision needs to be made
to select one of the output ports through which the packet needs to be send out. In other words, the
connecting device acts as a switch that connects one port to another port.
 Circuit Switching
Note  Packet Switching
In circuit switching, the whole message is sent from the source to the
destination without being divided into packets.
A good example of a circuit-switched network is the early telephone systems in which the path was established between a
caller and a callee when the telephone number of the callee was dialed by the caller. When the callee responded to the call,
the circuit was established. The voice message could now flow between the two parties, in both directions, while all of the
connecting devices maintained the circuit. When the caller or callee hung up, the circuit was disconnected.

In packet switching, the message is first divided into manageable packets at the
source before being transmitted. The packets are assembled at the destination.
The NL is designed as a packet-switched network. This means that the packet at the source is divided into manageable
packets called datagrams. Individual datagrams are then transferred from S to D. The received datagrams are assembled at
the destination before recreating the original message. The packet-switched network layer of the Internet was originally
designed as a connectionless service, but recently there is a tendency to change this to a connection-oriented service.
10
Types of Services
Note Connectionless Service
 Connection-Oriented Service
In a connectionless packet-switched network, the forwarding decision is
based on the destination address of the packet.

Network
A connectionless
packet-swtiched network
R1 R2
4 3 2 1 2 Delay in a connectionless network
Sender 1
Network
4 Destination
2
3 Souce
R4 1
3 3
4 1 3 4 2 1
R3 R5 Out of order Receiver

Total delay
2

Time Time Time Time 11


Connection-oriented packet switched network

Note In a connection-oriented packet switched network, the forwarding


decision is based on the label of the packet.

Source D

Setup
4 3 2 1
2
4

Total delay
3 3 Transmission
time
2 4
1
5
4 3 2 1 4 3 2 1

Teardown
6

Time Time Time Time

Delay in a connection-oriented network

12
Forwarding of IP Packets
The network layer supervises the handling of the packets by the underlying physical networks. We
define this handling as the delivery of a packet. The delivery of a packet to its final destination is
accomplished using two different methods of delivery: direct and indirect.  Direct Delivery
Direct delivery  Indirect Delivery

Direct delivery

Direct delivery

Indirect delivery
A B

Link Link Link

Indirect delivery
Indirect delivery 13
FORWARDING
Forwarding means to place the packet in its route to its destination. Since the Internet
today is made of a combination of links (networks), forwarding means to deliver the
packet to the next hop (which can be the final destination or the intermediate connecting
device). Although the IP protocol was originally designed as a connectionless protocol,
today the tendency is to use IP as a connection-oriented protocol.

Forwarding Based on Destination Address


Forwarding Based on Label
Forwarding Based on Destination Address

4 types

Next – hop
Network Specific method
Host specific method
Default method

14
Figure 6.3 Next-hop method

15
Figure 6.4 Network-specific method

Network-specific
routing table for host S
Destination Next Hop
Host-specific
routing table for host S N2 R1

Destination Next Hop


A R1
B R1
C R1
D R1

16
Figure 6.5 Host-specific routing

Routing table for host A


Host A
Destination Next Hop
Host B R3
N2 R1
N3 R3
...... ......

N1

R1 R3
Host B

N2 R2 N3

17
Figure 6.6 Default routing

Routing table for host A N1 N2


Host A
Destination Next Hop
N2 R1 R1
...... ......
Default R2

Default
R2
router

Rest of the Internet

18
ADDRESSING
 The address in the network layer of the TCP/IP model is called Internet Address or
IP address, an IP address is a 32-bit address
 The IP addresses are unique (each connection has a different address) and
universal (must be accepted by any host wants to connect to the internet).
 Consists of 4 octets (bytes)
 Network IP addresses are managed by a nonprofit organization called ICANN
(International Corporation for Assigned Names and Numbers) to avoid conflicts.
 Assigns addresses to regional Authorities which assign numbers to ISPs

 Assigns and manages DNS (Domain Name System)

32
The address space of IPv4 is 2 or 4,294,967,296.

Network + Host: Complete IP address


Network Address: Host part set to 0
Network ID: identifies the network to
which the host is connected
Host ID: identifies the interface of the
network connection to the host not the
host itself
19
Figure Dotted-decimal notation

Example 1
Change the IP addresses from binary notation to dotted-decimal notation.
a. 10000001 00001011 00001011 11101111
b. 11111001 10011011 11111011 00001111

Solution
We replace each group of 8 bits with its equivalent decimal number and add dots for separation:
a. 129.11.11.239
b. 249.155.251.15

20
ADDRESSING
PROBLEM
Example 2 Change the IP addresses from dotted-decimal notation to binary notation.
a. 111.56.45.78
b. 75.45.34.78
Solution We replace each decimal number with its binary equivalent:

a. 01101111 00111000 00101101 01001110


b. 01001011 00101101 00100010 01001110

Example 3 Find the error, if any, in the following IP address: 75.45.301.14

Solution In dotted-decimal notation, each number is less than or equal to 255;


301 is outside this range.

Note

In classful addressing, the address space is divided into five classes:


A, B, C, D, and E.
21
Finding the classes in binary and dotted-decimal notation

Figure 19.11 Finding the address class

22
Find the class of each address:
Example 3
a. 00000001 00001011 00001011 11101111
b. 11110011 10011011 11111011 00001111
See the procedure in Figure 19.11.
Solution a. The first bit is 0; this is a class A address.
b. The first 4 bits are 1s; this is a class E address.

Figure Netid and hostid


Find the class of each address:
Example 4
a.227.12.14.87 b.252.5.15.111 c.134.11.78.56
a. The first byte is 227 (between 224 and 239); the class is D.
Solution b. The first byte is 252 (between 240 and 255); the class is E.
c. The first byte is 134 (between 128 and 191); the class is B. 23
Classful Addressing
 Class A
 Start with binary 0
 All 0 reserved (default route) or any network
 01111111 (127) reserved for loopback
 231 or 2,147,483,648 class A complete IP addresses
 27 =128 blocks (network addresses)
 Number of complete IP addresses in each block is 224=16777216 – (all zeros
host - network address, and all ones – broadcast address)
 Valid Range 1.x.x.x to 126.x.x.x (126 valid blocks)
 All allocated

 Class B
 Start with binary 10
 Range 128.x.x.x to 191.x.x.x
 230 class B complete IP addresses
 214=16384 blocks (network addresses)
 Number of addresses in each block is 216=65536 – (all zeros host, and all ones)
 All allocated
24
Classful Addressing
 Class C
 229 Class C complete IP addresses
 221=2097152 blocks (network addresses)
 Start with binary 110

 Range 192.x.x.x to 223.x.x.x

 Number of addresses in each block is 256 – (all zeros host, and all ones) class

 Nearly all allocated

 Class D Range Total


 Multicast addresses 10.0.0.0 to
224
 No network/host hierarchy 10.255.255.255
172.16.0.0 to
220
172.31.255.255
Private addresses
192.168.0.0 to
216
192.168.255.255

25
Figure 19.14 Blocks in class A

Note

Millions of class A addresses are wasted. 26


Figure 19.15 Blocks in class B

Note:

27 Many class B addresses are wasted.


Figure 19.16 Blocks in class C

Note
The number of addresses in class C block is
28
smaller than the needs of most organizations.
Figure 19.17 Network address

Note In classful addressing, the network address is


the one that is assigned to the organization.

Example 5 Given the address 23.56.7.91, find the network address.


The class is A. Only the first byte defines the netid. We can find the network address by
Solution replacing the hostid bytes (56.7.91) with 0s. Therefore, the network address is 23.0.0.0.

29
Example 6 Given the address 132.6.17.85, find the network address.
The class is B. The first 2 bytes defines the netid. We can find the network address by
Solution replacing the hostid bytes (17.85) with 0s. Therefore, the network address is 132.6.0.0.

Example 7 Given the network address 17.0.0.0, find the class.

Solution The class is A because the netid is only 1 byte.


Class B

Sample internet

Class C
Note

A network address is different from a


netid. A network address has both netid
and hostid, with 0s for the hostid. Class A
30
Note

IP addresses are designed with two levels of hierarchy.


Table 19.1 Default masks

In Dotted-
Class In Binary Using Slash
Decimal

A 11111111 00000000 00000000 00000000 255.0.0.0 /8

B 11111111 11111111 00000000 00000000 255.255.0.0 /16

C 11111111 111111111 11111111 00000000 255.255.255.0 /24

31
Figure A network with two levels of hierarchy

Addressing without Subnets

Note
A class B “Flat Network”, more than
16
The network address can be found by 2 =65536 hosts
applying the default mask to any address How to manage?
in the block (including itself).It retains the
Performance? Too many hosts on the
netid of the block and sets the hostid to 0s. same LAN (single broadcast domain) will
slowdown the LAN performance
Solution: Subnetting

32
Figure 19.23 Subnet mask

Class B

Reduces
the routing
table
entries and
size 33
Subnetting
 Dividing the network into several smaller groups (subnets) with each
group having its own subnet IP address
 Site looks to rest of internet like single network and routers outside
the organization route the packet based on the main Network address
 Local routers route within subnetted network using subnet address
 Host portion of address partitioned into subnet number (most
significant part) and host number (least significant part)
 In this case, IP address will have 3 levels (Main network, subnet, host)
 Subnet mask is a 32-bit consists of zeros and ones that indicates
which bits of the IP address are subnet number and which are host
number
 Subnet mask when ANDed with the IP address it gives the
subnetwork address

34
Figure 19.20 A network with three levels of hierarchy
(subnetted)

Routers will use subnet mask 255.255.192.0 or /18 35


Example 8 A router outside the organization receives a packet with destination address
190.240.7.91 /16. Show how it finds the network address to route the packet.
Solution
The router follows three steps:
• The router looks at the first byte of the address to find the class. It is class B.
• The default mask for class B is 255.255.0.0. or /16 The router ANDs this mask with the address
to get 190.240.0.0.
• The router looks in its routing table to find out how to route the packet to this destination.
Later, we will see what happens if this destination does not exist.

Example 9 A router inside the organization receives the same packet with D address
190.240.33.91 /19. Show how it finds the subnetwork address to route the packet.
Solution
The router follows three steps:
The router must know the mask. Is 255.255.224.0 or /19
The router applies the mask to the address, 190.240.33.91. The subnet address is 190.240.32.0.
The router looks in its routing table to find how to route the packet to this destination. Later, we will
see what happens if this destination does not exist.

36
Obtaining Host IP Address
 Once a network administrator in an organization obtained a block of
addresses from its ISP, it can then assign individual IP addresses to
the host and router interfaces
 It can be done in two ways:
 Manual configuration: IP address is stored manually by the

administrator in a configuration file


 What about a diskless computer? Or first time booted

computer with a disk?


 What about if the computer has moved from one subnet to

another?
 Solution is using a protocol called Dynamic Host Configuration

Protocol (DHCP)
 DHCP is a client-server program

37
Dynamic Host Configuration Protocol
 Dynamic Host Configuration Protocol (DHCP)
 A protocol that provide IP address, subnet mask, IP address of a

gateway router, and IP address of DNS server dynamically to a


host or to a diskless computer
 DHCP server keeps two databases (static IP addresses and unused

temporary Addresses.)
 Static IP addresses database maps physical addresses (MAC) to

permanent IP addresses (used for diskless workstations)


 When a host requests an address DHCP will look into the static

database first.
 If no address match is found, DHCP will select the dynamic IP

database. DHCP will assign a Temporary Address: selected address


from a pool of free addresses and assign it to the host
 Leasing: DHCP server assigns an IP address for a host for a
specific period of time in order not to waste IP addresses
 After the period expires, host must return the IP address or
renew the lease.
38
Address Resolution Protocol (ARP)
 At the network level hosts and routers are recognized by
their IP address
 Packets must pass through physical networks to reach hosts
and routers.
 At the physical network, hosts and routers are recognized by their
MAC addresses which is local address.
 ARP is a network layer protocol that translates between
Internet IP address and MAC sublayer (layer-2) address

Figure Encapsulation of ARP packet

39
Four cases using ARP

40
ARP operation

Note

An ARP request is
broadcast; an ARP
reply is unicast.

41
Figure 20.5 IPv4 datagram format

+ Padding

42
IPv4 datagram fields
 Minimum Header length is 20 bytes without options.
 With options the maximum can go to 60 bytes
 Largest data that can be carried in the datagram is 65535 – 20 = 65515
 Version field: will carry the version number which is 4 = (0100)2
 Header length: the length of the header in bytes after dividing it by 4. Min is 20/4 = 5 =
(0101)2 and the max is 60/4 = 15 = (1111 )2
 Total length: total length of the packet: header + data. Max = 65535 bytes
 Identification, flags, and offset used for fragmentation and reassembly at the D
 Packet can be fragmented at any node between the source and the destination but
reassembly is done ONLY at the destination node.
 Time to Live is used to prevent lost packets from circulating between routers forever. This
field is set to certain value depending on the device operating system. Each router will
decrement this field by one and check the value. If the value is zero the packet will be
dropped.
 Protocol: contains a code for what is being carried in the data field.
 Header checksum used for checking if there is error in the header only. The checksum is
recomputed at each router between the source and the destination.

Figure Maximum transfer unit (MTU)

43
Protocol field and encapsulated data

Table Protocol values in Hex

Table MTUs for


some networks

44
Internet Control Message Protocol
 used by hosts & routers to
communicate network-level Type Code description
0 0 echo reply (ping)
information
3 0 dest. network unreachable
 error reporting: 3 1 dest host unreachable
unreachable host, network, 3 2 dest protocol unreachable
port, protocol 3 3 dest port unreachable
 echo request/reply (used by
3 6 dest network unknown
3 7 dest host unknown
ping)
4 0 source quench (congestion
 network-layer “above” IP: control - not used)
 ICMP msgs carried in IP 8 0 echo request (ping)
datagrams 9 0 route advertisement
10 0 router discovery
 ICMP message: type, code 11 0 TTL expired
plus first 8 bytes of IP 12 0 bad IP header
datagram causing error
45
Traceroute and ICMP
 source sends series of UDP segments to dest
 first set has TTL =1
 second set has TTL=2, etc.
 unlikely port number
 when nth set of datagrams arrives to nth router:
 router discards datagrams
 and sends source ICMP messages (type 11, code 0)

 ICMP messages includes name of router & IP address

 when ICMP messages arrives, source records RTTs

stopping criteria:
 UDP segment eventually arrives at destination host
 destination returns ICMP “port unreachable” message (type 3, code 3)
 source stops

3 probes 3 probes

3 probes 46
IPv6: Motivation
 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: ver pri flow label


 fixed-length 40 byte header payload len next hdr hop limit
 no fragmentation allowed
source address
(128 bits)
priority: identify priority among destination address
datagrams in flow (128 bits)
flow Label: identify datagrams in
same “flow.” data
next header: identify upper layer
protocol for data
32 bits
47
Other changes from IPv4
 checksum: removed entirely to reduce processing time at each hop
 options: allowed, but outside of header, indicated by “Next Header” field
 ICMPv6: new version of ICMP
 additional message types, e.g. “Packet Too Big”

 multicast group management functions

Transition from IPv4 to IPv6


 not all routers can be upgraded simultaneously
 no “flag days”

 how will network operate with mixed IPv4 and IPv6 routers?

 tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers
IPv4 header fields IPv6 header fields
IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
UDP/TCP payload

IPv6 datagram
IPv4 datagram
Tunneling
IPv4 tunnel
A B connecting IPv6 routers
E F
logical view: IPv6 IPv6 IPv6 IPv6

A B C D E F
physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6

flow: X flow: X
src: A src:B src:B src: A
dest: F dest: F
dest: E dest: E
Flow: X Flow: X
data Src: A data
Src: A
Dest: F Dest: F

data data

A-to-B: E-to-F:
IPv6 B-to-C: B-to-C: IPv6
IPv6 inside IPv6 inside
IPv4 IPv4
49
Interplay between routing, forwarding
routing algorithm routing algorithm determines
end-end-path through network
local forwarding table

dest address output link forwarding table determines


address-range 1 3 local forwarding at this router
address-range 2 2
address-range 3 2
address-range 4 1

IP destination address in
arriving packet’s header

1
3 2

50
Unicast Routing basics
graph: G = (N,E) 5
v 3 w
N = set of routers = { u, v, w, x, y, z } 5
2
u z
2 1
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), 3
1 x y 2
(x,y), (w,y), (w,z), (y,z) }
1
aside: graph abstraction is useful in other network contexts, e.g., P2P, where
N is set of peers and E is set of TCP connections
Graph abstraction: costs
c(x,x’) = cost of link (x,x’) e.g., c(w,z) = 5
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)
key question: what is the least-cost path between u and z ?
routing algorithm: algorithm that finds that least cost path
51
Routing algorithm classification
 Q: global or decentralized information?
 global: all routers have complete topology, link cost info “link state”
algorithms
 decentralized:
 router knows physically-connected neighbors, link costs to neighbors
 iterative process of computation, exchange of info with neighbors
 “distance vector” algorithms
 Q: static or dynamic?
 static: routes change slowly over time
 dynamic: routes change more quickly

 periodic update

 in response to link cost changes

routing algorithms are: link state, distance vector, hierarchical routing


52
routing in the Internet : RIP, OSPF, BGP
A Link-State Routing Algorithm
 Dijkstra’s algorithm
 notation:
 net topology, link costs known
 c(x,y): link cost from node
to all nodes x to y; = ∞ if not direct
 accomplished via “link state neighbors
broadcast”  D(v): current value of cost
 all nodes have same info of path from source to dest.
v
 computes least cost paths from
one node (‘source”) to all other  p(v): predecessor node
along path from source to v
nodes
 N': set of nodes whose least
 gives forwarding table for that cost path definitively known
node
 iterative: after k iterations,
know least cost path to k dest.’s

53
Dijsktra’s Algorithm D(v) D(w) D(x) D(y) D(z)
p(v) p(w) p(x) p(y) p(z)
Step N'
1 Initialization:
2 N' = {u} 0 u 7,u 3,u 5,u ∞ ∞
3 for all nodes v 1 uw 6,w 5,u 11,w ∞
4 if v adjacent to u
5 then D(v) = c(u,v) 2 uwx 6,w 11,w 14,x

6 else D(v) = ∞ 3 uwxv 10,v 14,x

7 4 uwxvy 12,y
8 Loop 5 uwxvyz
9 find w not in N' such that D(w) is a minimum
10 add w to N' x
11 update D(v) for all v adjacent to w and not in N' : 9
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known 5 7
14 shortest path cost to w plus cost from w to v */ 4
15 until all nodes in N'
8
notes:
u 3 w y z

 construct shortest path tree by tracing 2


predecessor nodes 3
 ties can exist (can be broken arbitrarily)
7 4
v
54
Dijkstra’s algorithm
algorithm complexity: n nodes
 each iteration: need to check all nodes, w, not in N
 n(n+1)/2 comparisons: O(n2)
 more efficient implementations possible: O(nlogn)
oscillations possible:
 e.g., support link cost equals amount of carried traffic:
A A A A
1 1+e 2+e 2+e
0 0 2+e 0
D B D B D B D B
0 0 1+e 1 1+e 1
0 0
0 e 0 0
C 0 1 1+e 0
C C C
1 1
e given these costs,
initially
find new routing….
resulting in new costs
55
Distance vector algorithm
Bellman-Ford equation (dynamic programming)
Let dx(y) := cost of least-cost path from x to y then
dx(y) = min {c(x,v) + dv(y) }
cost from neighbor v to destination y
cost to neighbor v

min taken over all neighbors v of x

5 clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3


v 3 w B-F equation says:
2 5
u z du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z),
2 1
3 c(u,w) + dw(z) }
1 x y 2 = min {2 + 5, 1 + 3, 5 + 3} = 4
1
node achieving minimum is next
hop in shortest path, used in forwarding table 56
Distance vector algorithm
 Dx(y) = estimate of least cost from x to y
 x maintains distance vector Dx = [Dx(y): y є N ]

 node x:

 knows cost to each neighbor v: c(x,v)

 maintains its neighbors’ distance vectors. For each neighbor v, x

maintains Dv = [Dv(y): y є N ]
key idea:
 from time-to-time, each node sends its own distance vector estimate

to neighbors
 when 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


 under minor, natural conditions, the estimate Dx(y) converge to the actual least cost dx(y)

57
Distance vector algorithm
iterative, asynchronous: each each node:
local iteration caused by:
 local link cost change
 DV update message from wait for (change in local link cost or
neighbor msg from neighbor)

distributed:
 each node notifies neighbors only recompute estimates
when its DV changes
 neighbors then notify their
neighbors if necessary
if DV to any dest has changed, notify
neighbors

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

table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3

from
from

y ∞∞ ∞ y 2 0 1

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

from

y y 2 7

from
2 0 1 0 1 y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
cost to cost to
node z cost to

table x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
from

from
from

y y 2 0 1 y 2 0 1
∞∞ ∞
z z 3 1 0 z 3 1 0
71 0
time 59
Comparison of LS and DV algorithms
message complexity robustness: what happens if router
 LS: with n nodes, E links, O(nE)
malfunctions?
msgs sent LS:
 DV: exchange between neighbors  node can advertise incorrect
only link cost
 convergence time varies
 each node computes only its

speed of convergence own table


 LS: O(n2) algorithm requires DV:
O(nE) msgs  DV node can advertise
 may have oscillations
incorrect path cost
 DV: convergence time varies
 each node’s table used by
 may be routing loops
others
 count-to-infinity problem
 error propagate thru

network
60
Hierarchical routing
scale: with 600 million destinations:
3c
 can’t store all dest’s in routing tables! 3a 2c
3b 2a
AS3 2b
 routing table exchange would swamp links! 1c
1a 1b AS1 AS2
gateway router: 1d

 at “edge” of its own AS

 has link to router in another AS Intra-AS Inter-AS


Routing Routing
algorithm algorithm
administrative autonomy
 internet = network of networks
Forwarding
table

 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

61
Inter-AS tasks
 suppose router in AS1 receives datagram destined outside of AS1:
 router should forward packet to gateway router, but which one?

AS1 must: 1.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!
 suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3

(gateway 1c), but not via AS2


 inter-AS protocol propagates reachability info to all internal routers

 router 1d determines from intra-AS routing info that its interface I is on the least

cost path to 1c
 installs forwarding table entry (x,I)
x
3c

3a
3b
AS3 2c other
1c networks
2a
other
1a 2b
networks 1b
AS1 1d AS2 62
Intra-AS Routing
 also known as interior gateway protocols (IGP)
 most common intra-AS routing protocols:
 RIP: Routing Information Protocol
 OSPF: Open Shortest Path First
 IGRP: Interior Gateway Routing Protocol(Cisco prop.)
RIP: example z

w x y
A D B

C routing table in router D


destination subnet next router # hops to dest
w A 2
y B 2
z B 7
x -- 1 63
…. …. ....
RIP ( Routing Information Protocol)
 included in BSD-UNIX distribution in 1982
 distance vector algorithm
 distance metric: # hops (max = 15 hops), each link has cost 1
 DVs exchanged with neighbors every 30 sec in response message
(aka advertisement)
 each advertisement: list of up to 25 destination subnets (in IP
addressing sense) from router A to destination subnets:
subnet hops
u v u 1
A B
w v 2
w 2
x x 3
C D
z y 3
y z 2
64
RIP: link failure, recovery
 if no advertisement heard after 180 sec -> neighbor/link declared dead
 routes via neighbor invalidated

 new 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 (infi.dist= 16 hops)

 RIP routing tables managed by application-level process called route-d


(daemon)
 advertisements sent in UDP packets, periodically repeated
routed routed

transport transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
65
physical physical
OSPF (Open Shortest Path First)
 OSPF advertisement carries one entry per neighbor
 advertisements flooded to entire AS
 carried in OSPF messages directly over IP (rather than TCP / UDP

 IS-IS routing protocol: nearly identical to OSPF


 “open”: publicly available boundary router
backbone ro
 uses link state algorithm
backbone
 LS packet dissemination
area
 topology map at each node border
routers
 route computation using
area 3
Dijkstra’s algorithm
Hierarchical OSPF internal
area 1 routers
area 2

66
OSPF “advanced” features (not in RIP)
 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 ToS; high for real time ToS)
 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.

 link-state advertisements only in area

 each nodes has detailed area topology; only know direction (shortest

path) to nets in other areas.


 area border routers: “summarize” distances to nets in own area, advertise
to other Area Border routers.
 backbone routers: run OSPF routing limited to backbone.
67
 boundary routers: connect to other AS’s.
Internet inter-AS routing: BGP
 BGP (Border Gateway Protocol): the de facto inter-domain routing
protocol - “glue that holds the Internet together”
 BGP provides each AS a means to:
 eBGP: obtain subnet reachability inform. from neighboring ASs.

 iBGP: propagate reachability inform. to all AS-internal routers.

 determine “good” routes to other networks based on reachability

information and policy.


 allows subnet to advertise its existence to rest of Internet:I am here
 BGP session: two BGP routers
3c (“peers”) exchange BGP mesg:
3a
BGP  advertising paths to different
message
3b destination network prefixes
AS3 2c other (“path vector” protocol)
other
1c 2a
2b
networks
 exchanged over semi-
1a permanent TCP connections
networks 1b
AS1 1d AS2
68
 using eBGP session between 3a and 1c, AS3 sends prefix reachability info to
AS1.
 1c can then use iBGP do distribute new prefix info to all routers in AS1

 1b can then re-advertise new reachability info to AS2 over 1b-to-2a


eBGP session
 when router learns of new prefix, it creates entry for prefix in its forwarding
table. eBGP session

 advertised prefix includes BGP attributes 3b 3a iBGP session

AS3 2c other
 prefix + attributes = “route” 1c 2a networks
other
1a 2b
networks 1b
 two important attributes: AS1 1d AS2

 AS-PATH: contains ASs through which prefix advertisement has passed:

e.g., AS 67, AS 17
 NEXT-HOP: indicates specific internal-AS router to next-hop AS. (may

be multiple links from current AS to next-hop-AS)


 gateway router receiving route advertisement uses import policy to
accept/decline
 e.g., never route through AS x

 policy-based routing 69
BGP route selection
 router may learn about more than 1 route to destination AS, selects
route based on:
 local preference value attribute: policy decision
 shortest AS-PATH
 closest NEXT-HOP router: hot potato routing
 additional criteria
BGP messages : msg exchanged between peers over TCP connection
 BGP messages:

 OPEN: opens TCP connection to peer and authenticates sender

 UPDATE: advertises new path (or withdraws old)

 KEEPALIVE: keeps connection alive in absence of UPDATES;

also ACKs OPEN request


 NOTIFICATION: reports errors in previous msg; also used to

close connection
70
Multicast Basics
goal: find a tree connecting routers having local mcast group members
 tree: not all paths between routers used, 2 types

 shared-tree: same tree used by all group members

 source-based: different tree from each sender to rcvrs

legend
group
member

not group
member

router
with a
group
member

router
shared tree source-based trees without
group
member

71
Approaches for building mcast trees
Approaches
 source-based tree: one tree per sources: source
R1 2
 shortest path trees R4
1
 reverse path forwarding
R2 5
 group-shared tree: group uses one tree 3 4 R5
 minimal spanning (Steiner) R3 6
R6 R7
 center-based trees
LEGEND
router with attached
Shortest path tree group member
 mcast forwarding tree: tree of shortest router with no attached
group member
path routes from source to all receivers i link used for forwarding,
 Dijkstra’s algorithm
i indicates order link
added by algorithm
72
Reverse path forwarding
 rely on router’s knowledge of unicast shortest path from it to sender
 each router has simple forwarding behavior:

if (mcast datagram received on incoming link on shortest path


back to center)
then flood datagram onto all outgoing links
else ignore datagram

s: source LEGEND
R1 router with attached
R4 group member
R2 router with no attached
group member
R5
datagram will be
R3 forwarded
R6 R7 datagram will not be 73
forwarded
Reverse path forwarding: pruning
 forwarding tree contains subtrees with no mcast group
members
 no need to forward datagrams down subtree

 “prune” msgs sent upstream by router with no

downstream group members

s: source
R1
R4
LEGEND
R2 P P
prune message
R5
links with multicast
R3 P forwarding
R6
R7
74
Shared-tree: steiner tree
 steiner tree: minimum cost tree connecting all
routers with attached group members
 problem is NP-complete
 excellent heuristics exists
 not used in practice:
 computational complexity

 information about entire network needed

 monolithic: rerun whenever a router needs to

join/leave

75
Center-based trees
 single delivery tree shared by all
 one router identified as “center” of tree
 to join:
 edge router sends unicast join-msg addressed to center router

 join-msg “processed” by intermediate routers & fwd towards center

 join-msg either hits existing tree branch for this center, or arrives at

center
 path taken by join-msg becomes new branch of tree for this router

suppose R6 chosen as center:

R1
3 R4
LEGEND
R2 2 1 path order in which join
R5 messages generated
R3
1 R6 76
R7
Internet Multicasting Routing: DVMRP
 DVMRP: distance vector multicast routing protocol, RFC1075
 flood and prune: reverse path forwarding, source-based tree
 RPF tree based on DVMRP’s own routing tables constructed by

communicating DVMRP routers


 no assumptions about underlying unicast

 initial datagram to mcast group flooded everywhere via RPF

 routers not wanting group: send upstream prune msgs

 soft state: DVMRP router periodically (1 min.) “forgets” branches


are pruned:
 mcast data again flows down unpruned branch

 downstream router: reprune or else continue to receive data

 routers can quickly regraft to tree - following IGMP join at leaf


 odds and ends - commonly implemented in commercial router
77
Tunneling
Q: how to connect “islands” of multicast routers in a “sea” of
unicast routers?

physical topology logical topology


 mcast datagram encapsulated inside “normal” (non-multicast-addressed) datagram
 normal IP datagram sent thru “tunnel” via regular IP unicast to receiving mcast
router (recall IPv6 inside IPv4 tunneling)
 receiving mcast router unencapsulates to get mcast datagram

78
PIM: Protocol Independent Multicast
 not dependent on any specific underlying unicast routing algorithm
(works with all)
 two different multicast distribution scenarios :
dense: sparse:
 group members densely packed, in  networks with group members small wrt
“close” proximity. interconnected networks
 bandwidth more plentiful  group members “widely dispersed”
 bandwidth not plentiful
Consequences of sparse-dense
 dense  sparse:
 group membership by routers  no membership until routers
assumed until routers explicitly prune explicitly join
 data-driven construction on mcast  receiver- driven construction of
tree (e.g., RPF) mcast tree (e.g., center-based)
 bandwidth and non-group-router  bandwidth and non-group-router
processing profligate processing conservative
79
PIM- dense mode

flood-and-prune RPF: similar to DVMRP but…


 underlying unicast protocol provides RPF info for incoming datagram
 less complicated (less efficient) downstream flood than DVMRP
reduces reliance on underlying routing algorithm
 has protocol mechanism for router to detect it is a leaf-node router

80
PIM - sparse mode
 center-based approach
 router sends join msg to rendezvous point (RP)
 intermediate routers update state and forward join

 after joining via RP, router can switch to source-specific


tree
 increased performance: less concentration, shorter paths

 sender(s):
 unicast data to RP, which distributes down RP-rooted tree
 RP can extend mcast tree upstream to source
 RP can send stop msg if no attached receivers
 “no one is listening!”

81
Questions?

82

You might also like