0% found this document useful (0 votes)
103 views18 pages

Network PDF

This document provides an overview of key concepts in the network layer, including: 1) It discusses network layer service models, forwarding versus routing, and how routers work. 2) It introduces routing, including path selection and dealing with scale. 3) It covers network layer protocols in the Internet such as IP, routing algorithms like RIP, OSPF, and BGP, and broadcast/multicast routing.

Uploaded by

saikiran
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)
103 views18 pages

Network PDF

This document provides an overview of key concepts in the network layer, including: 1) It discusses network layer service models, forwarding versus routing, and how routers work. 2) It introduces routing, including path selection and dealing with scale. 3) It covers network layer protocols in the Internet such as IP, routing algorithms like RIP, OSPF, and BGP, and broadcast/multicast routing.

Uploaded by

saikiran
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/ 18

Chapter 4: Network Layer

Chapter goals:
Network Layer • Understand principles behind network layer
services:
– network layer service models
CS 3516 – Computer Networks
– forwarding versus routing
– how a router works
– routing (path selection)
– dealing with scale
• Instantiation, implementation in the Internet

Network Layer
Chapter 4: Network Layer
• Transport segment from
application
transport

sending to receiving host


network

• •
data link

4. 1 Introduction 4.5 Routing algorithms •


physical

On sending side network network


data link data link

4.2 Virtual circuit and – Link state


network

encapsulates segments
physical physical
data link
physical

datagram networks – Distance Vector


network network

into datagrams data link data link

• •
physical physical
– Hierarchical routing
4.3 What’s inside a On rcving side,
side delivers
router • 4.6 Routing in the segments to transport
network
t k
data link
network
t k
data link
physical


physical

Internet
network

4.4 IP: Internet layer


data link
physical

– RIP

application
Protocol Network layer protocols network transport

– OSPF
data link network
network
– Datagram format in every host and router
physical data link
network data link
physical
– BGP

data link physical

– IPv4 addressing
physical
Router examines header
– ICMP • 4.7 Broadcast and
fields in all IP datagrams
– IPv6 multicast routing
passing through it

Interplay Between Routing and Forwarding


Two Key Network-Layer Functions
• forwarding: move
routing algorithm

analogy:
packets from local forwarding table

router’s input to • routing: process of header value output link


0100 3

appropriate router planning trip from 0101


0111
2
2

source to destination
1001 1

output

• routing: determine • forwarding: process value in arriving


packet’s header

route taken by of getting through 0111 1


packets from source single interchange 3 2

to destination
– routing algorithms

1
Connection Setup Network Service Model
Q: What service model for “channel” transporting
• 3rd important function in some network architectures:
datagrams from sender to receiver?
– ATM, frame relay, X.25
• Before datagrams flow, two end hosts and intervening Example services for Example services for a flow
routers establish virtual connection individual datagrams: of datagrams:
– routers get involved
l • Guaranteed delivery • In-order
In order datagram
• Network vs Transport Layer connection service: • Guaranteed delivery delivery
with less than 40 • Guaranteed minimum
– network: between two hosts (may also involve msec delay bandwidth to flow
intervening routers in case of Virtual Circuits
(VCs))
• Restrictions on changes
in inter-packet spacing
– transport: between two processes

Example Network Layer Service


Chapter 4: Network Layer
Models
Network Service
Guarantees ?
Congestion • 4. 1 Introduction • 4.5 Routing algorithms
Architecture Model Bandwidth Loss Order Timing feedback • 4.2 Virtual circuit and – Link state
datagram networks – Distance Vector

Internet best effort none no no no no (inferred – Hierarchical routing
4.3 What’s inside a
ATM CBR constant yes yes yes
via loss)
no router • 4.6 Routing in the
rate congestion • 4.4 IP: Internet Internet
ATM VBR guaranteed yes yes yes no – RIP
rate congestion
Protocol
– OSPF
ATM ABR guaranteed no yes no yes – Datagram format
– BGP
– IPv4 addressing

minimum
ATM UBR none no yes no no – ICMP 4.7 Broadcast and
– IPv6 multicast routing

Network Layer Connection and Virtual Circuits (VCs)


Connection-less Service
source-to-dest path behaves much like telephone
• Datagram network provides network-layer circuit
connectionless service – Performance-wise (predictable service)

• VC network provides network-layer – Network actions along source-to-dest path

connection service
• Call setup, teardown for each call before data can flow
• Analogous to the transport-layer services, • Each packet carries VC identifier (not destination host
but: address)

– service: host-to-host
• Every router on source-dest path maintains “state” for
each passing connection
– no choice: network provides one or the other • Link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable service)
– implementation: in network core

2
Forwarding Table
VC Implementation VC number

A VC consists of: 12 22 32

1 3
1. Path from source to destination 2

(Forwarding table in
2. VC numbers, one number for each link along interface
northwest router)
path number

3 Entries in forwarding tables in routers along


3. I
Incoming
i interface
i f Incoming
I i VC # Outgoing
O i interface
i f Outgoing
O i VC #
path

1 12 3 22
Packet belonging to VC carries VC number 2 63 1 18
(rather than dest address) 3 7 2 17


1 97 3 87
VC number can be changed on each link. … … … …
– New VC number comes from forwarding
Routers maintain connection state information!
table

Datagram Networks
Virtual Circuits: Signaling Protocols • Must do call setup at network layer

• Used to setup, maintain and teardown VC


• Routers: no state about end-to-end connections
– No network-level concept of “connection”
• Used in ATM, frame-relay, X.25
• Packets forwarded using destination host address
• Not used in today’s Internet – Packets between same source-dest pair may take
different paths

application
transport 5. Data flow begins 6. Receive data application application
3. Accept call transport application
network 4. Call connected transport
2. incoming call network transport
data link 1. Initiate call network 1. Send data 2. Receive data network
data link data link
physical
physical data link
physical
physical

Network Layer 4-16

4 billion
Forwarding Table possible entries
Longest Prefix Matching
Destination Address Range Link Interface Prefix Match Link Interface
11001000 00010111 00010000 00000000 11001000 00010111 00010 0
through 0 11001000 00010111 00011000 1
11001000 00010111 00010111 11111111 11001000 00010111 00011 2
otherwise 3
11001000 00010111 00011000 00000000
through 1 Examples
11001000 00010111 00011000 11111111
DA: 11001000 00010111 00010110 10100001 Which interface?
11001000 00010111 00011001 00000000
through 2
DA: 11001000 00010111 00011000 10101010 Which interface?
11001000 00010111 00011111 11111111

otherwise 3

3
Datagram or VC network: Why?
Chapter 4: Network Layer
Internet (datagram) ATM (VC)
• Data exchange among • Evolved from telephony • 4. 1 Introduction • 4.5 Routing algorithms
computers
• Human conversation: • 4.2 Virtual circuit and – Link state
– “Elastic” service, no datagram networks – Distance Vector
– strict timing, reliability
strict timing req.

requirements • 4.3 What’s inside a – Hierarchical routing
“Smart”
Smart end systems
(computers)
– need for guaranteed router • 4.6 Routing in the
service
– Can adapt, perform
• “Dumb” end systems • 4.4 IP: Internet Internet
control, error recovery – RIP
– telephones Protocol
– Simple inside network, – OSPF
– complexity inside – Datagram format
complexity at “edge” – BGP
network – IPv4 addressing
• Many link types
– ICMP • 4.7 Broadcast and
– Different characteristics multicast routing
– IPv6
– Uniform service difficult

Router Architecture Overview Input Port Functions


Two key router functions:
• Run routing algorithms/protocol (RIP, OSPF, BGP)
• Forwarding datagrams from incoming to outgoing link

Physical layer:
bit-level
b l l reception
Data link layer: Decentralized switching:
e.g., Ethernet • Given datagram destination, lookup
(see chapter 5) output port using forwarding table in
input port memory
• Goal: complete input port processing at
‘line speed’
• Queuing: if datagrams arrive faster than
forwarding rate into switch fabric

Output Ports Output Port Queueing

• Buffering required when datagrams arrive from


fabric faster than the transmission rate
• Scheduling discipline chooses among queued
• Buffering when arrival rate via switch exceeds
output line speed
datagrams for transmission
(More on queueing next slides…)
• Queueing (delay) and loss due to output port
buffer overflow!

4
Input Port Queuing
How Much Buffering?
• Fabric slower than input ports combined Æ queueing
may occur at input queues
• RFC 3439 rule of thumb: average buffering • Head-of-the-Line (HOL) blocking: queued datagram at
equal to “typical” RTT (say 250 msec) times front of queue prevents others in queue from moving
link capacity C (so, RTT•C) forward
– e.g.,
e g C = 10 Gps link Æ 2.5
2 5 Gbit buffer • Queueing delay and loss due to input buffer overflow!
• Recent recommendation: with N flows,
buffering equal to
RTT .C
N

The Internet Network layer


Chapter 4: Network Layer
Host, router network layer functions:

• 4. 1 Introduction • 4.5 Routing algorithms



Transport layer: TCP, UDP
4.2 Virtual circuit and – Link state
datagram networks – Distance Vector Routing protocols IP protocol

• – Hierarchical routing
•addressing conventions
4.3 What’s inside a
•path selection


•datagram format
4.6 Routing in the Network
N t k •RIP
RIP, OSPF
OSPF, BGP
router •packet handling conventions
Layer
• 4.4 IP: Internet Internet forwarding
ICMP protocol
– RIP table
Protocol •error reporting
– OSPF
•router “signaling”
– Datagram format
– BGP
– IPv4 addressing Link layer
– ICMP • 4.7 Broadcast and
Physical layer
– IPv6 multicast routing

IP Datagram Format
Chapter 4: Network Layer IP protocol version
number
32 bits
total datagram
length (bytes)
header length head. type of
ver

• •
(bytes) len service length
4. 1 Introduction 4.5 Routing algorithms
for
“type” of data fragment


flgs fragmentation/
16-bit identifier offset
4.2 Virtual circuit and – Link state max number time to upper
reassembly
header
datagram networks – Distance Vector remaining hops live layer checksum


(decremented at
– Hierarchical routing
4.3 What’s inside a each router)


32 bit source IP address

router 4.6 Routing in the 32 bit destination IP address

• Internet
upper layer protocol
4.4 IP: Internet to deliver payload to
Options (if any) E.g. timestamp,
– RIP
Protocol
record route

– OSPF How much overhead data taken, specify


– Datagram format
(variable length, list of routers
with TCP? typically a TCP
– BGP to visit.
– IPv4 addressing • 20 bytes of TCP
or UDP segment)

– ICMP • 4.7 Broadcast and • 20 bytes of IP

– IPv6 multicast routing • = 40 bytes + app


layer overhead

5
IP Fragmentation & Reassembly IP Fragmentation and Reassembly
• Network links have MTU (max. length ID fragflag offset
transfer size) - largest =4000 =x =0 =0
possible link-level frame. fragmentation: Example
in: one large datagram
– different link types, • 4000 byte datagram One large datagram becomes
out: 3 smaller
different MTUs • MTU = 1500 bytes several smaller datagrams

datagrams
large IP datagram divided
((“fragmented”)
g ) within net length ID fragflag offset
– One datagram becomes =1500 =x =1 =0
several datagrams reassembly 1480 bytes in
– “Reassembled” only at final data field length ID fragflag offset
destination =1500 =x =1 =185
offset =
– IP header bits used to
1480/8
identify, order related length ID fragflag offset
fragments =1040 =x =0 =370

IP Addressing: Introduction
Chapter 4: Network Layer
• IP address: 32-bit 223.1.1.1

• 4. 1 Introduction • 4.5 Routing algorithms identifier for host, 223.1.2.1


router interface
223.1.1.2
• 4.2 Virtual circuit and – Link state 223.1.1.4 223.1.2.9

datagram networks – Distance Vector • Interface: connection 223.1.2.2


between host/router

223.1.1.3 223.1.3.27
– Hierarchical routing
4.3 What’s inside a
router • 4.6 Routing in the and physical link
– routers typically have
• 4.4 IP: Internet Internet
multiple interfaces 223.1.3.1 223.1.3.2
– RIP
Protocol – hosts typically have
– OSPF one interface
– Datagram format
– BGP – IP addresses
– IPv4 addressing
– ICMP • 4.7 Broadcast and associated with each 223.1.1.1 = 11011111 00000001 00000001 00000001
multicast routing interface
– IPv6 223 1 1 1

Subnets Subnets 223.1.1.0/24


223.1.2.0/24

• IP address: 223.1.1.1
Recipe
– subnet part (high
• To determine subnets,
223.1.2.1
223.1.1.2
order bits) 223.1.1.4 223.1.2.9
– host part (low order detach each interface
bits) 223.1.2.2 from its host or

223.1.1.3 223.1.3.27
What’ss a subnet ?
What router,, creating
g
– device interfaces with subnet islands of isolated
same subnet part of IP 223.1.3.2 networks
• Each isolated network
223.1.3.1
address
– can physically reach
is called a subnet
223.1.3.0/24
each other without
intervening router network consisting of 3 subnets Subnet mask: /24

6
Subnets 223.1.1.2
IP addressing: CIDR
How many? 223.1.1.1 223.1.1.4

223.1.1.3 CIDR: Classless InterDomain Routing


– Subnet portion of address of arbitrary length
223.1.9.2 223.1.7.0
– Address format: a.b.c.d/x, where x is # bits
in subnet portion of address
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0

223.1.2.6 223.1.3.27 subnet host


part part
223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2 11001000 00010111 00010000 00000000
200.23.16.0/23

DHCP: Dynamic Host Configuration Protocol


IP addresses: How to Get One?
Goal: allow host to dynamically obtain its IP address from
Q: How does host get IP address? network server when it joins network
– Can renew its lease on address in use
– Allows reuse of addresses (only hold address while
• Hard-coded by system admin in a file connected/”on”)
– Support for mobile users who want to join network (more
– Windows: shortly)
control-panelÆnetworkÆconfigurationÆTCP/IPÆproperties
• DHCP overview:
– UNIX: – Host broadcasts “DHCP discover” msg [optional]
/etc/rc.config
– DHCP server responds with “DHCP offer” msg [optional]
• DHCP: Dynamic Host Configuration Protocol: – Host requests IP address: “DHCP request” msg
dynamically get address from as server – DHCP server sends address: “DHCP ack” msg
– “plug-and-play”
– (next slide)

DHCP client-server scenario


DHCP Client-Server Scenario DHCP server: 223.1.2.5 DHCP discover
arriving
client
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654
A DHCP 223.1.2.1
223.1.1.1 DHCP offer
server
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
223.1.1.2 yiaddrr: 223.1.2.4
223.1.1.4 223.1.2.9 transaction ID: 654
Lifetime: 3600 secs
B DHCP request
223.1.2.2 arriving DHCP
223.1.1.3 223.1.3.27 E src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
client needs yiaddrr: 223.1.2.4
223.1.3.1 223.1.3.2 transaction ID: 655
address in this time Lifetime: 3600 secs
network DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs

Network Layer

7
DHCP: Example
DHCP: more than IP address DHCP DHCP • Connecting laptop needs
DHCP UDP its IP address, addr of
IP
first-hop router, addr of
DHCP

DHCP can return more than just allocated IP DHCP Eth


Phy DNS server Æ use DHCP
address on subnet: DHCP
• DHCP request encapsulated in
UDP, encapsulated in IP,
– address of first-hop router for client encapsulated in 802.1 Ethernet
DHCP
– name
n m andnd IP address
ddr ss of
f DNS ssever
v r
DHCP
168.1.1.1
168 1 1 1
DHCP UDP
DHCP IP • Ethernet frame broadcast
– network mask (indicating network versus DHCP Eth router (dest: FFFFFFFFFFFF) on LAN,
host portion of address) (runs DHCP) received at router running
Phy
DHCP server

• Ethernet demux’ed to IP
demux’ed, UDP demux’ed to
DHCP

DHCP: Example DHCP: Wireshark Message type: Boot Reply (2)


Hardware type: Ethernet reply
DHCP DHCP • DCP server formulates
Output (home LAN) Hardware address length: 6
Hops: 0
Transaction ID: 0x6b3a11b7
DHCP UDP DHCP ACK containing Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
client’s IP address, IP
Message type: Boot Request (1)
DHCP IP Hardware type: Ethernet Client IP address: 192.168.1.101 (192.168.1.101)
DHCP Eth address of first-hop Hardware address length: 6 Your (client) IP address: 0.0.0.0 (0.0.0.0)

Phy router for client, name & Hops: 0 request Next server IP address: 192.168.1.1 (192.168.1.1)
Relay agent IP address: 0.0.0.0 (0.0.0.0)
IP address of DNS server
Transaction ID: 0x6b3a11b7
Seconds elapsed: 0 Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a)
Bootp flags: 0x0000 (Unicast) Server host name not given
Client IP address: 0.0.0.0 (0.0.0.0) Boot file name not given
• Encapsulation of DHCP Your (client) IP address: 0.0.0.0 (0.0.0.0) Magic cookie: (OK)
server, frame forwarded Next server IP address: 0.0.0.0 (0.0.0.0) Option: (t=53,l=1) DHCP Message Type = DHCP ACK
DHCP Relay agent IP address: 0.0.0.0 (0.0.0.0) Option: (t=54,l=4) Server Identifier = 192.168.1.1
to client,
client demux ing up to
demux’ing
DHCP
Client MAC address: Wistron_23:68:8a
Wistron 23:68:8a (00:16:d3:23:68:8a) Option: (t=1,l=4)
(t=1 l=4) Subnet Mask = 255.255.255.0
255 255 255 0
DHCP UDP
DHCP IP DHCP at client Server host name not given
Boot file name not given
Option: (t=3,l=4) Router = 192.168.1.1
Option: (6) Domain Name Server
DHCP Eth router • Client now knows its IP Magic cookie: (OK)
Option: (t=53,l=1) DHCP Message Type = DHCP Request
Length: 12; Value: 445747E2445749F244574092;
IP Address: 68.87.71.226;
Phy
(runs DHCP) address, name and IP Option: (61) Client identifier IP Address: 68.87.73.242;
address of DSN server, IP
DHCP IP Address: 68.87.64.146
Length: 7; Value: 010016D323688A;
Hardware type: Ethernet Option: (t=15,l=20) Domain Name = "hsd1.ma.comcast.net."
address of its first-hop Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a)
router Option: (t=50,l=4) Requested IP Address = 192.168.1.101
Option: (t=12,l=5) Host Name = "nomad"
Option: (55) Parameter Request List
Length: 11; Value: 010F03062C2E2F1F21F92B
1 = Subnet Mask; 15 = Domain Name
3 = Router; 6 = Domain Name Server
44 = NetBIOS over TCP/IP Name Server
……

IP Addressing: the Last Word...


NAT: Network Address Translation

rest of local network


Q: How does an ISP get block of addresses? Internet (e.g., home network)
10.0.0.1
A: ICANN: Internet Corporation for Assigned 10.0.0/24

Names and Numbers


10.0.0.4
10.0.0.2

– allocates
ll t addresses
dd 138.76.29.7

– manages DNS 10.0.0.3

– assigns domain names, resolves disputes All datagrams leaving local Datagrams with source or
network have same single source NAT destination in this network
IP address: 138.76.29.7, have 10.0.0/24 address for
different source port numbers source, destination (as usual)

8
NAT: Network Address Translation NAT: Network Address Translation
• Implementation: NAT router must:
• Motivation: local network uses just one IP
address as far as outside world is concerned: – outgoing datagrams: replace (source IP address, port #)
of every outgoing datagram to (NAT IP address, new
– Range of addresses not needed from ISP: just one port #)
IP address for all devices • (remote clients/servers will respond using (NAT IP
address new port #) as destination addr)
address,
– Can change addresses of devices in local network – remember (in NAT translation table) every (source IP
without notifying outside world address, port #) to (NAT IP address, new port #)
translation pair
– Can change ISP without changing addresses of
– incoming datagrams: replace (NAT IP address, new port
devices in local network #) in dest fields of every incoming datagram with
– Devices inside local net not explicitly addressable, corresponding (source IP address, port #) stored in
NAT table
visible by outside world (a security plus)

NAT: Network Address Translation NAT: Network Address Translation

• 16-bit port-number field:


NAT translation table
2: NAT router 1: host 10.0.0.1
WAN side addr LAN side addr
changes datagram sends datagram to
source addr from
138.76.29.7, 5001 10.0.0.1, 3345
…… ……
128.119.40.186, 80 – ~60,000 simultaneous connections with a
10.0.0.1, 3345 to
single LAN-side address!
• NAT is controversial:
138.76.29.7, 5001, S: 10.0.0.1, 3345
updates table D: 128.119.40.186, 80
10.0.0.1

2
S: 138.76.29.7, 5001
1
– Routers should only process up to layer 3
D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
– Violates “end-to-end” argument (complexity
138.76.29.7 S: 128.119.40.186, 80
4 in ends)
• NAT possibility must be taken into account by
D: 10.0.0.1, 3345
S: 128.119.40.186, 80
D: 138.76.29.7, 5001 3 10.0.0.3
4: NAT router
3: Reply arrives
dest. address:
changes datagram app designers, e.g., P2P applications
dest addr from
138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345 – Address shortage should instead be solved by
IPv6

NAT Traversal Problem NAT Traversal Problem


• Client wants to connect to • Solution 2: Universal Plug and
server with address 10.0.0.1 Play (UPnP) Internet Gateway
– Server address 10.0.0.1 local to 10.0.0.1
Device (IGD) Protocol. Allows 10.0.0.1
LAN (client can’t use it as Client Client
destination addr) ? NATted host to: ? IGD
– Only one externally visible 10.0.0.4 • Learn public IP address 10.0.0.4
NATted address
address: 138.76.29.7 (138 76 29 7)
(138.76.29.7)
• Solution 1: statically 138.76.29.7
NAT • Add/remove port 138.76.29.7
NAT
configure NAT to forward router mappings (with lease router
incoming connection requests
at given port to server times)
– e.g. (123.76.29.7, port 2500) i.e. automate static NAT
always forwarded to 10.0.0.1 port map configuration
port 25000 – Still ahead of time, but automatic
– But must be done ahead of
time!

9
NAT Traversal Problem Chapter 4: Network Layer
• Solution 3: relaying (used in Skype)
1. NATed client establishes connection to relay • 4. 1 Introduction • 4.5 Routing algorithms
2. External client connects to relay • 4.2 Virtual circuit and – Link state
datagram networks – Distance Vector
3. Relay bridges packets between to connections
• 4.3 What’s inside a – Hierarchical routing
router • 4.6 Routing in the

2. connection to
relay initiated 1. connection to 4.4 IP: Internet Internet
– RIP
Protocol
by client relay initiated
10.0.0.1
by NATted host
– OSPF
Client
3. relaying – Datagram format
established – BGP
– IPv4 addressing

138.76.29.7 NAT
router – ICMP 4.7 Broadcast and
– IPv6 multicast routing

ICMP: Internet Control Message Protocol


Traceroute and ICMP

• Used by hosts & routers to Type Code description • Source sends series of • When ICMP message
communicate network-level 0 0 echo reply (ping) UDP segments to dest arrives, source
calculates RTT
3 0 dest. network unreachable
information – First has TTL =1


3 1 dest host unreachable
– error reporting: – Second has TTL=2, etc.
3 2 dest protocol unreachable Traceroute does this 3
unreachable host, network, y port
– Unlikely p number
3 3 dest p
port unreachable
times for each router
port, protocol
– echo request/reply (used
3
3
6
7
dest network unknown
dest host unknown
• When nth datagram Stopping criterion
by ping) 4 0 source quench (congestion arrives to nth router: • UDP segment eventually
• Network-layer “above” IP: control - not used) – Router discards datagram arrives at destination host
– ICMP msgs carried in IP
8
9
0
0
echo request (ping)
route advertisement
– And sends to source ICMP
message (type 11, code 0)
• Destination returns ICMP
datagrams “host unreachable” packet

10 0 router discovery
ICMP message: type, code plus – Message includes name of
11 0 TTL expired (type 3, code 3)
router & IP address
first 8 bytes of IP datagram
causing error
12 0 bad IP header • When source gets this
ICMP, stops

Chapter 4: Network Layer IPv6


• Initial motivation: 32-bit address space soon
• 4. 1 Introduction • 4.5 Routing algorithms to be completely allocated.
• 4.2 Virtual circuit and – Link state
• Additional motivation:
datagram networks – Distance Vector
– header format helps speed
• 4.3 What’s inside a – Hierarchical routing
router • 4.6 Routing in the p
processing/forwarding
ssin /f din
• 4.4 IP: Internet Internet – header changes to facilitate QoS
Protocol – RIP
– OSPF
• IPv6 datagram format:
– Datagram format – fixed-length 40 byte header
– BGP
– IPv4 addressing
– ICMP • 4.7 Broadcast and – no fragmentation allowed
– IPv6 multicast routing

10
IPv6 Header Other Changes from IPv4
Priority: identify priority among datagrams in flow
Flow Label: identify datagrams in same “flow” • Checksum: removed entirely to reduce
(concept of “flow” not well defined). processing time at each hop
Next header: identify upper layer protocol for data • 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
• To help transition Æ Tunneling: IPv6
carried as payload in IPv4 datagram among
IPv4 routers

Interplay between Routing, Forwarding


Chapter 4: Network Layer

• •
routing algorithm
4. 1 Introduction 4.5 Routing algorithms
• 4.2 Virtual circuit and – Link state local forwarding table

datagram networks – Distance Vector header value output link


0100 3
– Hierarchical routing
4.3 What’s inside a
0101 2


0111 2

router 4.6 Routing in the 1001 1

• 4.4 IP: Internet Internet


– RIP value in arriving
Protocol packet’s header
– OSPF
– Datagram format 0111 1
– BGP
– IPv4 addressing
– ICMP • 4.7 Broadcast and
3 2

– IPv6 multicast routing


Network Layer 4-64

Graph Abstraction Graph Abstraction: Costs


• c(x,x’) = cost of link (x,x’)
5 - e.g. c(w,z) = 5
v w
v 3 w • Cost could always be 1, or
u z 2 5 inversely related to bandwidth,
u 2 1 z or inversely related to
x y 3 congestion (queuing)
1 x y 2 • Note – cost of 1 means route is
1 number of hops (common metric)
Graph: G = (N,E)
N = set of routers = {u, v, w, x, y, z}
E = set of links ={(u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z)} Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)

Remark: Graph abstraction is useful in other network Question: What’s the least-cost path between u and z ?
contexts
Example: P2P, where N is set of peers and E is set of Routing algorithm: algorithm that finds least-cost path
TCP connections

11
Routing Algorithm Classification Chapter 4: Network Layer
Global or decentralized Static or dynamic?
information? Static: • 4. 1 Introduction • 4.5 Routing algorithms
Global: • Routes change slowly over • 4.2 Virtual circuit and – Link state
• All routers have complete time
datagram networks – Distance Vector
topology, link cost info Dynamic:
• “link • Routes change more quickly • 4.3 What’s inside a – Hierarchical routing
link state
state” algorithms
Decentralized: – Periodic update router • 4.6 Routing in the
• Router knows physically- – In response to link cost • 4.4 IP: Internet Internet
connected neighbors, link – RIP
changes Protocol
costs to neighbors – OSPF
– Datagram format
• Iterative process of – IPv4 addressing
– BGP
computation, exchange of
info with neighbors – ICMP • 4.7 Broadcast and
multicast routing
• “distance vector” algorithms – IPv6

Dijkstra’s Algorithm - Output


A Link-State Routing Algorithm Example 5
v 3 w
From u, resulting shortest-path tree: 5
Dijkstra’s algorithm u
2
2 z
3 1
• Network topology (groph), link costs known to all v w 1 x
1
y 2
nodes u z
– Accomplished via “link state broadcast”
x
– All nodes have same info
y


destination link
Compute least cost paths from one node (“source”) to v (u,v)
all other nodes x (u,x)
– Gives forwarding table for that node Resulting forwarding table in u: y (u,x)
• Can be efficient (O(nlogn), n = # nodes) w
z
(u,x)
(u,x)

(See 4.5.1 for details and example)

Link State Updates via Flooding Chapter 4: Network Layer

• Send link information (cost, connection) to neighbors • 4. 1 Introduction • 4.5 Routing algorithms
• For each incoming packet, send to every outgoing link • 4.2 Virtual circuit and – Link state
datagram networks – Distance vector
– Problems?
Æ Vast numbers of duplicate packets • 4.3 What’s inside a – Hierarchical routing

• Infinite, actually, unless we stop. How? router • 4.6 Routing in the


• Hop count: decrease each hop • 4.4 IP: Internet Internet
– RIP
• Sequence number: don’t flood twice Protocol
– OSPF
• Selective flooding: send only in about the right


Datagram format
IPv4 addressing
– BGP
direction
– ICMP • 4.7 Broadcast and
– IPv6 multicast routing

12
Distance Vector Algorithm Bellman-Ford Example
Bellman-Ford equation 5 Neighbors of u:
dv(z) = 5, dx(z) = 3, dw(z) = 3
Define v 3 w
5
2
dx(y) := cost of least-cost path from x to y u 2 3 1 z B-F equation says:
1 2du(z) = min {c(u,v) + dv(z),
x y
1 c(u,x)
( ) + dx(z),
( )
Then c(u,w) + dw(z)}
= min {2 + 5,
1 + 3,
dx(y) = min {c(x,v) + dv(y)} 5 + 3} = 4 (via x)
v Node that achieves minimum is
next hop in shortest path (via x
where min{} is taken over all neighbors v of x above)
➜ that goes in forwarding table

Distance Vector Algorithm - State Distance Vector Algorithm - Idea


• From time-to-time, each node x sends its
• Dx(y) = estimate of least cost from x to y own distance vector (Dx) estimate to
• Node x knows cost to each neighbor v: neighbors
– c(x,v) – Asynchronous (next slide)
• Node x maintains distance vector • When
Wh n a node
n d x receives
i sn new DV estimate
stim t
from neighbor, it updates its own DV using
– Dx = [Dx(y): y є N ]
B-F equation:
• Node x also maintains its neighbors’ Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ‫ ג‬N
distance vectors
– For each neighbor v, x maintains • Under most conditions estimate Dx(y)
Dv = [Dv(y): y є N ]
converges to the actual least cost dx(y)

Distance Vector Algorithm - Link Cost


Distance Vector Algorithm - Updates Changes
Iterative, asynchronous: Link cost changes:
each local iteration caused Each node: • Node detects local link cost change
1
y
by: 4 1
Updates routing info, recalculates


Local link cost change wait for (change in local link distance vector
x z
• DV update message from cost or msg from neighbor)
• If DV changes, notify neighbors
50
neighbor
Distributed: At time t0, Y detects the link-cost change, updates its DV,
and informs its neighbors.

recompute estimates
Each node notifies
neighbors only when its DV “good At time t1, Z receives the update from Y and updates its table.
changes news It computes a new least cost to X and sends its neighbors its DV.
if DV to any dest has
– neighbors then notify
changed, notify neighbors
travels At time t2, Y receives Z’s update and updates its distance table.
their neighbors if fast” Y’s least costs do not change and hence Y does not send any
necessary message to Z.

13
Distance Vector Algorithm - Link Cost Comparison of LS and DV algorithms
Changes
Message complexity Robustness: what happens
Link cost changes: 60 • LS: with n nodes, E links, if router malfunctions?
y
• Good news travels fast 4 1 O(nE) msgs sent LS:
• Bad news travels
x
50
z • DV: exchange between – node can advertise
slowly neighbors only incorrect link cost
• Right, 44 iterations
Right Speed of Convergence – each node computes only
“Poisoned” reverse: its own table
before algorithm
If Z routes through Y to
• LS: O(n2) algorithm requires
• Somewhat limits damage
stabilizes (see text) •
O(nE) msgs
get to X : DV:
• “Count to infinity” – may have oscillations
Z tells Y its (Z’s) distance
• – DV node can advertise

problem! to X is infinite (so Y won’t DV: convergence time varies
incorrect path cost
route to X via Z) – may be routing loops
– Each node’s table used by
• (Will not always completely – count-to-infinity problem others
solve count to infinity
problem )
• errors propagate thru
network

Chapter 4: Network Layer Hierarchical Routing


Our routing study thus far - idealization
• 4. 1 Introduction • 4.5 Routing algorithms • all routers identical
• 4.2 Virtual circuit and – Link state • network “flat”
datagram networks – Distance Vector • … not true in practice
• 4.3 What’s inside a – Hierarchical routing
router • 4.6 Routing in the Scale: with 200 million Administrative autonomy
• 4.4 IP: Internet Internet destinations: • internet = network of
Protocol – RIP • Can’t store all dest’s in networks
– Datagram format
– OSPF routing tables! • Each network admin may
– IPv4 addressing
– BGP • Routing table exchange want to control routing in its

– ICMP • 4.7 Broadcast and would swamp links! own network

– IPv6 multicast routing

Hierarchical Routing Interconnected ASes


• Aggregate routers into
regions, “autonomous Gateway router 3c

3a 2c
systems” (AS) Direct link to router in 3b 2a

AS3 2b
Routers in same AS run another AS 1c
AS2
1a
same routingg protocol
p •
1b
1dd AS1
Forwarding table
– “intra-AS” routing configured by both
protocol
intra- and inter-AS
– Routers in different AS
can run different intra-
Intra-AS
Routing
Inter-AS
Routing routing algorithm
– intra-AS sets entries
algorithm algorithm
AS routing protocol
Forwarding for internal dests
– inter-AS & intra-AS
table

sets entries for


external dests

14
Chapter 4: Network Layer Intra-AS Routing

• 4. 1 Introduction • 4.5 Routing algorithms • Also known as Interior Gateway Protocols (IGP)
• 4.2 Virtual circuit and – Link state • Most common Intra-AS routing protocols:
datagram networks – Distance Vector
• 4.3 What’s inside a – Hierarchical routing – RIP: Routing Information Protocol
router • 4.6 Routing in the
– OSPF: Open Shortest Path First
• 4.4 IP: Internet Internet
– RIP – IGRP: Interior Gateway Routing Protocol
Protocol
– OSPF
– Datagram format (Cisco proprietary)
– BGP
– IPv4 addressing
– ICMP • 4.7 Broadcast and
– IPv6 multicast routing

Chapter 4: Network Layer RIP (Routing Information Protocol)

• 4. 1 Introduction • 4.5 Routing algorithms


• Distance vector algorithm

• 4.2 Virtual circuit and – Link state


• Included in BSD-UNIX Distribution in 1982
datagram networks – Distance Vector • Distance metric: # of hops (max = 15 hops)
• 4.3 What’s inside a – Hierarchical routing
router • 4.6 Routing in the From router A to subnets:
• 4.4 IP: Internet Internet u v destination hops
– RIP
Protocol A B w u 1
– OSPF v 2
– Datagram format
– BGP w 2
– IPv4 addressing
– ICMP • 4.7 Broadcast and
z C D
x x 3
– IPv6 multicast routing y y 3
z 2

RIP Advertisements RIP: Example


z
• Distance vectors: exchanged among w x y
neighbors every 30 sec via Response A D B
Message (also called advertisement)
• Each advertisement: list of up to 25 C
destination subnets within AS Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z B 7
x -- 1
…. …. ....

Routing/Forwarding table in D

15
RIP: Example
Dest Next hops
Advertisement
RIP: Link Failure and Recovery
w - 1
x - 1 from A to D If no advertisement heard after 180 sec
Æneighbor/link declared dead
z C 4
…. … ...
z
– routes via neighbor invalidated
w x y – new advertisements sent to neighbors
A D B
– neighbors in turn send out new advertisements
C (if tables changed)
Destination Network Next Router Num. of hops to dest. – link failure info quickly propagates to entire
w A 2 net
y B 2
– poison reverse used to prevent ping-pong loops
z BA 75
x -- 1 (infinite distance = 16 hops)
…. …. ....

RIP Table Processing Chapter 4: Network Layer

• RIP routing tables managed by application-level • 4. 1 Introduction • 4.5 Routing algorithms


process called route-d (d for daemon) • 4.2 Virtual circuit and – Link state
• Advertisements sent in UDP packets, periodically datagram networks – Distance Vector
repeated • 4.3 What’s inside a – Hierarchical routing
routed routed router • 4.6 Routing in the
• 4.4 IP: Internet Internet
Transprt Transprt – RIP
(UDP) (UDP) Protocol
– OSPF
network forwarding forwarding network – Datagram format
– BGP
– IPv4 addressing

(IP) table table (IP)
link link – ICMP 4.7 Broadcast and
physical physical – IPv6 multicast routing

OSPF (Open Shortest Path First) OSPF “Advanced” Features (not in RIP)
• “Open” means publicly available, in this context
• Uses Link State algorithm
• security: all OSPF messages authenticated (to
prevent malicious intrusion)
– LS packet dissemination
– Topology map at each node
• multiple same-cost paths allowed (only one path in
– Route computation using Dijkstra’s algorithm
RIP)
• OSPF advertisement carries one entry per neighbor • F each
For h li
link,
k multiple
lti l costt metrics
t i ffor diff
differentt
router TOS (e.g., satellite link cost set “low” for best effort;
high for real time)
• Advertisements disseminated to entire AS (via
• integrated uni- and multicast support:
flooding)
– Carried in OSPF messages directly over IP (rather than TCP • hierarchical OSPF in large domains
or UDP)

16
Chapter 4: Network Layer Internet Inter-AS routing: BGP

• 4. 1 Introduction • 4.5 Routing algorithms


• BGP (Border Gateway Protocol): the de
facto standard
• 4.2 Virtual circuit and – Link state
• BGP provides each AS means to:
datagram networks – Distance Vector
1. Obtain subnet reachability information
• 4.3 What’s inside a – Hierarchical routing
router • 4.6 Routing in the from nei
neighboring
hborin ASes
2. Propagate reachability information to all
• 4.4 IP: Internet Internet
AS-internal routers
– RIP
Protocol
– Datagram format
– OSPF 3. Determine “good” routes to subnets based
– IPv4 addressing
– BGP on reachability information and policy
– ICMP • 4.7 Broadcast and • Allows subnet to advertise its existence to
– IPv6 multicast routing rest of Internet: “I am here”

BGP Basics Distributing Reachability Info


• Pairs of routers (BGP peers) exchange routing info
• Using eBGP session between 3a and 1c, AS3 sends
over semi-permanent TCP connections: BGP sessions prefix reachability info to AS1.
– BGP sessions need not correspond to physical links. – 1c can then use iBGP do distribute new prefix info to all
• When AS2 advertises a prefix to AS1:
routers in AS1
– 1b can then re-advertise new reachability info to AS2
– AS2 promises it will forward datagrams towards over 1b-to-2a eBGP session
that prefix
• When router learns of new p prefix, it creates entry
y
for prefix in its forwarding table.

eBGP session eBGP session


3c iBGP session 3c iBGP session
3a 2c 2c
3a
3b 2a 3b 2a
AS3 2b AS3 2b
1c 1c
1a
AS2 AS2
1b 1a 1b
AS1 1d 1d
AS1

Path Attributes and BGP Routes BGP Route Selection


• Advertised prefix includes BGP attributes.
– prefix + attributes = “route”
• Router may learn about more than 1 route
to some prefix. Router must select route.
• Two important attributes:
– AS-PATH: contains ASs through which prefix • Elimination rules:
advertisement
d ti thhas passed:
d e.g, AS 67
67, AS 17 1 L
1. Locall preference
f value
l attribute:
tt ib t policy
li
– NEXT-HOP: indicates specific internal-AS decision
router to next-hop AS (may be multiple links 2. Shortest AS-PATH
from current AS to next-hop-AS)
3. Closest NEXT-HOP router: hot potato
• When gateway router receives route routing
advertisement, uses import policy to
4. Additional criteria
accept/decline

17
Why Different Intra- and Inter-AS
BGP messages Routing?
• BGP messages exchanged using TCP Policy:
• BGP messages: • Inter-AS: admin wants control over how its traffic
routed, who routes through its net
– OPEN: opens TCP connection to peer and
authenticates sender • Intra-AS: single admin, so no policy decisions needed
– UPDATE:
UPDATE advertises
d ti new path
th ((or withdraws
ithd Scale:
old) • hierarchical routing saves table size, reduces update
traffic
– KEEPALIVE keeps connection alive in absence
of UPDATES; also ACKs OPEN request Performance:
– NOTIFICATION: reports errors in previous • Intra-AS: can focus on performance
msg; also used to close connection • Inter-AS: policy may dominate over performance

Chapter 4: Network Layer

• 4. 1 Introduction • 4.5 Routing algorithms


• 4.2 Virtual circuit and – Link state
datagram networks – Distance Vector
• 4.3 What’s inside a – Hierarchical routing
router • 4.6 Routing in the
• 4.4 IP: Internet Internet
– RIP
Protocol
– OSPF
– Datagram format
– BGP
– IPv4 addressing
– ICMP • 4.7 Broadcast and
– IPv6 multicast routing

18

You might also like