Network Layer
Department of Computer Engineering
Tabriz Branch, Islamic Azad University
Spring, 2008
Dr. Ali Ghaffari
E-mail: A.Ghaffari@iaut.ac.ir
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Circuit Switching Data Transmission
Host A
Signaling Message
(Path Setup)
Switch S1
ACK
Routing
Routing
Switch S3
Routing
Switch S2
Switch S5
ACK
Host Y
ACK
ACK
Switch S4
Host X
Routing
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Circuit Switching Data Transmission
File
Switch S3
Host A
Host Y
Switch S1
Switch S2
Switch S5
Blocked
Switch S4
Host X
Dedicated Pipe (path)
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Circuit Switching Data Transmission
Major Properties:
Path set-up is required before data transmission starts
Data will be transferred as a continuous stream of bits
All data (all bits) follow exactly the same path
(order of bits transmitted by a sender is preserved at a receiver)
No resource sharing (a path is dedicated resource for your transmission)
Path set-up delay is always required
Once data transmission starts, no overhead (i.e., node major switching
delay) at each switch on a path (since the path is set up).
Transmission rate is guaranteed (your data will be delivered within
certain amount of time).
Highest cost data transmission (= highest quality)
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Virtual Circuit Data Transmission
Path set-up is same as Circuit-Switching
Host A
Signaling Message
(Path Setup)
Switch S1
ACK
Routing
Routing
Switch S3
Routing
Switch S2
Switch S5
ACK
Host Y
ACK
ACK
Switch S4
Host X
Routing
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Virtual Circuit Data Transmission
1
2
File
3
Switch S3
3
Host A
Host Y
2
2
1
1
1
3
Switch S1
1
Switch S2
2
2
1
3
Switch S5
3
2 1
2
Host X
Shared Pipe
Switch S4
(High priority is to
host A - but X can send data as best-effort service)
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Virtual Circuit Data Transmission
Major Properties:
Path set-up is required before data transmission starts
Data will be transferred as a collection of packets
All data (all packets) follow exactly the same path
(order of bits transmitted by a sender is preserved at a receiver)
Network resource can be shared (because data is transferred as packets)
Path set-up delay is required
After data transmission starts, some overhead (i.e., some switching delay)
at each switch on a path (error control and flow control are performed for
each packet).
Transmission rate is guaranteed (your data will be delivered within
certain amount of time).
Medium cost data transmission (= medium quality)
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
1
2
File
3
3
Host A
Switch S3
Host Y
2
1
Switch S1
Switch S2
Switch S5
Routing
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Host A
Switch S3
3
Host Y
2
1
Switch S1
Switch S2
Switch S5
Routing
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Routing
Switch S3
Host A
Host Y
3
2
Switch S1
1
Switch S2
Switch S5
Routing
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
1
Switch S3
Host A
Host Y
3
Switch S1
Switch S2
2
Switch S5
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Switch S3
3
Host A
Host Y
1
Switch S1
Switch S2
2
Switch S5
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Switch S3
Host A
Host Y
2
Switch S1
Switch S2
Switch S5
3
1
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Switch S3
Host A
Host Y
Switch S1
Switch S2
2
3
1
3
2
1
Switch S5
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
More packets than S1 can handle could arrive
3
Host A
Switch S3
Host Y
2
1
1
2
Switch S1
Switch S2
Switch S5
3
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Packet Dropped
Switches in datagram networks
are called “routers”
Switch S3
Host A
Host Y
3 3 2 2 1 1
Switch S1
Switch S2
Switch S5
NACK (Error)
Switch S4
Host X
Host B
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Major Properties:
Path set-up is NOT required before data transmission starts
Data will be transferred as a collection of packets
All packets may not follow the same path
(order of bits transmitted by a sender is NOT preserved at a receiver)
Network resource is shared
Path set-up delay is NOT required
After data transmission starts, high overhead (i.e., major switching delay)
at each switch on a path (error control and flow control are performed for
each packet plus “routing” now have to be performed for every packet).
Transmission rate is NOT guaranteed (“Best-Effort Service).
Lowest cost data transmission (= lowest quality)
Circuit-Switching, Virtual-Circuit and Datagram Data Transmissions
Datagram Data Transmission
Dropped packet
Switch S3
Host A
Host Y
3
Switch S1
Switch S2
Switch S5
NACK (Error)
Switch S4
Host X
Even a NACK message could be lost
Host B
IP Address Format, Classes
Sub-Networking and Class-less Inter Domain Routing
Networks and Data Communication
What is IP address?
• IP address is the ID for each NIC at a host computer
Internet Backbone Carrier
(long distance carrier)
ISPs
NIC
NIC
Host Y
Host X
Internet core routers
SIUE Domain
IP_Address/001
Internet
Networks and Data Communication
What is IP address?
(Two exceptions)
Every IP address must be unique
• Advantage in using IP addresses
You can use the same format of IP address no matter where your destination is.
Host Q
202.1.0.5
241.12.57.88
Host Y
Host X
32.123.72.55
Internet
SIUE Domain
146.163.146.170
IP_Address/002
Host Z
Host S
Networks and Data Communication
What is IP address?
Class-A Private IP Addresses: 10.0.0.0 - 10.255.255.255
Class-B Private IP Addresses: 172.16.0.0 - 172.31.255.255
Class-C Private IP Addresses: 192.168.0.0 - 192.168.255.255
IP_Address/004
Networks and Data Communication
IP Address Format (for IPv4)
1. General Expression
• IP Address = “xxx . xxx . xxx . xxx”
• Each “xxx” = “0” to “255”
Example
“146.163.146.170”
2. Internal Format
=
“146.163.146.170”
1
2
3
32 bits
IP_Address/008
Networks and Data Communication
IP Address Format (for IPv4)
1
2
3
32 bits
• Section 1: Class-ID Field (1 to 4 bits)
0: Class-A IP addresses
10: Class-B IP addresses
110: Class-C IP addresses
1110: Class-D IP addresses (Multicast Address)
• Section 2: Domain Address Field (7 to 21 bits)
• Section 3: Host Address Field (8 to 24 bits)
IP_Address/009
Networks and Data Communication
Domain and host addresses
Domain X
Transmitting
Host
Routing using
host address
Routing using
domain address
Domain Y
Gateway Router
in Domain Y
Gateway Router
in Domain X
Internet
IP_Address/010
Destination
Host
Networks and Data Communication
IP Address Format (for IPv4)
Bit #s:
Class-A
Bit #s:
Class-B
Bit #s:
Class-C
IP_Address/011
0 1
7 8
31
0 Domain Address
Host Address
7 bits
24 bits
0 1 2
10
Domain Address
Host Address
14 bits
16 bits
0 1 2 3
110
31
15 16
31
23 24
Domain Address
Host Address
21 bits
8 bits
Networks and Data Communication
IP Address Format (for IPv4)
One of the addresses in a domain
must be “domain broadcast” address
Class-A
• Number of hosts in a domain = up to (224 - 1) hosts/domain
• Number of domains in the Internet = up to 27 domains
Class-B
• Number of hosts in a domain = up to (216 - 1) hosts/domain
• Number of domains in the Internet = up to 214 domains
Class-C
• Number of hosts in a domain = up to (28 - 1) hosts/domain
• Number of domains in the Internet = up to 221 domains
IP_Address/012
Networks and Data Communication
Example of IP address construction
• “146.163.146.170”
What are the bit patterns for “146”, “163” and “170”?
“146”
MSB
1
2
3
4
5
6
7
8
Weight
128
64
32
16
8
4
2
1
1
0
0
1
0
0
1
0
146
- 128
18
IP_Address/013
18
- 16
2
LSB
Networks and Data Communication
Example of IP address construction
“163”
MSB
1
2
3
4
5
6
7
8
Weight
128
64
32
16
8
4
2
1
1
0
1
0
0
0
1
1
163
- 128
35
IP_Address/014
35
- 32
3
3
- 2
1
LSB
Networks and Data Communication
Example of IP address construction
“170”
MSB
1
2
3
4
5
6
7
8
Weight
128
64
32
16
8
4
2
1
1
0
1
0
1
0
1
0
170
- 128
42
IP_Address/015
42
- 32
10
10
- 8
2
LSB
Networks and Data Communication
Example of IP address construction
• “146.163.146.170”
146
163
146
170
1 0 0 1 0 0 1 0 . 1 0 1 0 0 0 1 1. 1 0 0 1 0 0 1 0.1 0 1 0 1 0 1 0
Class-ID
Domain Address
Host Address
• SIUE’s IP Class = Class-B Internet domain
• SIUE’s domain address = “146.163”
• My server’s host address
= “146.170”
IP_Address/016
It is customary to include
the class-ID as a part of
the domain address
Networks and Data Communication
Two extensions in IP address formats
1. Subnet and Subnet Masks
Purpose
• A mechanism to make managing IP addresses easier
• Partitioning a network domain within a domain
Method
2. CIDR (Class-less Inter Domain Routing)
Purpose
• A mechanism to increase the number of network domains
• Partitioning a network domain into more than one
network domain
Method
IP_Address/017
Networks and Data Communication
Subnet and Subnet Masks
The problem
Managing IP addresses in a large domain is not an easy job
• SIUE domain has more than 1,000 host computers
• IP address must be unique
You can’t assign an IP address to more than one host
Assigned
IP address
IP_Address/018
SIUE Domain (146.163.X.X)
Networks and Data Communication
Subnet and Subnet Masks
The problem
Managing IP addresses in a large domain is not an easy job
• Your job is to assign, maintain and manage all available IP addresses
in SIUE domain.
• You can not assign an IP address to more than one host (or NIC)
Assigned
IP address
IP_Address/019
SIUE Domain (146.163.X.X)
Networks and Data Communication
Subnet and Subnet Masks
Two solutions Dynamic address assignment (DHCP)
IP
Subnet working
146.163.0.1
146.163.0.2
146.163.0.3
MAC Address
146.163.0.4
DHCP Query
MAC
1ABF
NULL
NULL
NULL
1ABF DHCP Reply
DHCP Server
MAC Address
IP Address
SIUE Domain (146.163.X.X)
Problem in DHCP
IP_Address/020
Every time you starts your PC, your IP address
may be different
Networks and Data Communication
Subnet and Subnet Masks
• Partition the entire domain
• Assign a group of IP addresses to each partition
Address range:
146.163.4.1-146.163.7.255
Address range:
146.163.0.1-146.163.3.255
Address range:
146.163.8.1-146.163.12.255
SIUE Domain (146.163.X.X)
• Each partition is called “subnet”
IP_Address/021
Networks and Data Communication
CIDR (Class-less Inter-Domain Routing)
• The “3-class” design in the existing IP (IPv4) is not very efficient
Lack of flexibility in domain size
Example
• Suppose that your organization has 5,000 host computers.
- Which IP class you need?
Class-B is required
• Class-C is up to 28 = 256 hosts
• Class-B is up to 216 = 6,5536 hosts
If this is usually the case,
- What is the address space utilization?
Address space utilization =
IP_Address/022
the IPv4’s address space is
never big enough
(what you have)
= 5,000/6,5536
(what you can have)
= 7.6%
Networks and Data Communication
CIDR (Class-less Inter-Domain Routing)
• What is the cause of the problem?
Only three different address classes
• How can/should we increase “address classes”?
Restructure the IP address format
(IPv6 uses this approach)
IP address format needs to be re-defined
How long will it take?
How much will it cost?
Apply some extension to the exiting IP (IPv4)
IP_Address/023
CIDR (Class-less Inter-Domain Routing)
Networks and Data Communication
CIDR (Class-less Inter-Domain Routing)
This is the mistake in IPv4!!
How does CIDR work?
Bit #s:
Class-A
Bit #s:
Class-B
Bit #s:
Class-C
IP_Address/024
0 1
7 8
31
0 Domain Address
Host Address
7 bits
24 bits
0 1 2
10
Domain Address
Host Address
14 bits
16 bits
0 1 2 3
110
31
15 16
31
23 24
Domain Address
Host Address
21 bits
8 bits
Networks and Data Communication
CIDR (Class-less Inter-Domain Routing)
Eliminate “class IDs”
This is how it is called “class-less”.
32-bit IPv4 address
Domain Address
Host Address
? bits
? bits
Only the source and destination network domains perform CIDR
This is how it is called “inter-domain routing”.
- The gateway routers in your transmitting host and the
destination host perform CIDR
IP_Address/025
Networks and Data Communication
CIDR (Class-less Inter-Domain Routing)
“CIDR Prefix”
146.163.146.170/16
= How many bits (from the top) are “network address”
146
163
146
170
1 0 0 1 0 0 1 0 . 1 0 1 0 0 0 1 1. 1 0 0 1 0 0 1 0.1 0 1 0 1 0 1 0
Network Address Bits
Example If we need only up to 4,000 hosts?
We can come up with
(24-1) more domains
12
Since 2 = 4,096, we need only 12
for size!
host address filed.
of bits
the same
146.163.146.170/20
146
163
146
170
1 0 0 1 0 0 1 0 . 1 0 1 0 0 0 1 1. 1 0 0 1 0 0 1 0.1 0 1 0 1 0 1 0
IP_Address/026
Network Address Bits
Computer Networks
CIDR (Class-less Inter-Domain Routing)
3
25/28 = 1/2
CIDR Block PreFix # Equivalent Class-C
# of Host Addresses
/27
1/8 of a Class-C
2(32-27)
= 32
/26
1/4 of a Class-C
2(32-26)
= 64
/25
1/2 of a Class-C
2(32-25)
= 128
/24
1 Class-C
28
= 256
/17
128 Class-C
/16
2(32-17)
= 32,768
256 Class-C (Class-B) 216
= 65,536
/15
512 Class-C
217
= 131,072
/14
1024 Class-C
218
= 262,144
IP_Address/028
Computer Networks
Exception #1
172.16.0.1
172.16.0.2
172.16.0.9
• • •
172.16.0.100
Private IP addresses
241.12.57.88
• NAT
• IP Masquerade
Internet
Computer Networks
Exception #2
Multicast IP addresses (Class-D IP addresses)
• A transmitting host transmits once
• Multiple hosts receives at once
Multiple
Receiving Hosts
Transmitting
Host
Internet
Computer Networks
Exception #2
Multicast IP addresses (Class-D IP addresses)
• All the receivers should receive messages
• A sender should transmit only once
Transmitting
Host
Internet
All the receivers should
have the same multicast
IP addresses
Computer Networks
Transmitting
Host
SIUE Domain
Local-Domain
Multicast
Internet
First
Last
Categories
224.0.0.0 224.0.0.255
Global-Internet Reserved
224.0.1.0 238.255.255.255 Global-Internet Multicast
239.0.0.0 239.255.255.255 Local-Domain Multicast
Global-Internet
Multicast
We developed a UDP IP-multicast audio-streaming application
applications in CS490 (Fall 2005) (as SIUE’s local-domain multicast).
Computer Networks
146
Domain Address
Host Address
? bits
? bits
163
146
170
1 0 0 1 0 0 1 0 . 1 0 1 0 0 0 1 1. 1 0 0 1 0 0 1 0.1 0 1 0 1 0 1 0
IP Addressing
interface:
connection between host/router
and physical link
223.1.1.1
223.1.2.1
– routers typically have
multiple interfaces
– host typically has one
interface
– IP addresses associated
with each interface
223.1.1.2
223.1.1.4
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.1
223.1.3.27
223.1.3.2
NAT: Network Address Translation
rest of
Internet
local network
(e.g., home network)
10.0.0/24
10.0.0.1
10.0.0.4
10.0.0.2
138.76.29.7
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)
NAT: Network Address Translation
• Motivation: local network uses just one IP address as far as outside world is
concerned:
– can change addresses of devices in local network without notifying
outside world or inverse.
– devices inside local net not explicitly addressable, visible by outside
world (a security plus).
Implementation: NAT router must:
– outgoing datagrams: replace (source IP address, port #) of every
outgoing datagram to (NAT IP address, new port #)
. . . remote clients/servers will respond using (NAT IP address, new
port #) as destination addr.
remember (in NAT translation table) every (source IP address, port #) to
(NAT IP address, new port #) translation pair
– incoming datagrams: replace (NAT IP address, new port #) in dest
fields of every incoming datagram with corresponding (source IP
address, port #) stored in NAT table
NAT: Network Address Translation
2: NAT router
changes datagram
source addr from
10.0.0.1, 3345 to
138.76.29.7, 5001,
updates table
NAT translation table
WAN side addr
LAN side addr
1: host 10.0.0.1
sends datagram to
128.119.40.186, 80
138.76.29.7, 5001 10.0.0.1, 3345
……
……
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.1
1
2
S: 138.76.29.7, 5001
D: 128.119.40.186, 80
138.76.29.
7 80
S: 128.119.40.186,
D: 138.76.29.7, 5001
3: reply arrives
dest. address:
138.76.29.7, 5001
3
10.0.0.
4
S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4: NAT router
10.0.0.2
4
10.0.0.3
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
NAT: Network Address Translation
16-bit port-number field:
60,000 simultaneous connections with a single
LAN-side address!
NAT is controversial:
routers should only process up to layer 3
violates end-to-end argument
• NAT possibility must be taken into account by app
designers, e.g., P2P applications
address shortage should instead be solved by
IPv6
NAT traversal problem
• client wants to connect to
server with address 10.0.0.1
– server address 10.0.0.1 local to
LAN (client can’t use it as
destination addr)
– only one externally visible
NATed address: 138.76.29.7
• solution1: statically configure
NAT to forward incoming
connection requests at given
port to server
– e.g., (123.76.29.7, port 2500)
always forwarded to 10.0.0.1
port 25000
10.0.0.1
client
?
10.0.0.4
138.76.29.7
NAT
router
NAT traversal problem
• solution 2: Universal Plug and
Play (UPnP) Internet Gateway
Device (IGD) Protocol. Allows
NATed host to:
10.0.0.1
IGD
learn public IP address
(138.76.29.7)
add/remove port
mappings (with lease
times)
i.e., automate static NAT
port map configuration
NAT
router
NAT traversal problem
• solution 3: relaying (used in Skype)
– NATed client establishes connection to
relay
– external client connects to relay
– relay bridges packets between to
connections
2. connection to
relay initiated
by client
client
3. relaying
established
1. connection to
relay initiated
by NATed host
138.76.29.7
NAT
router
10.0.0.1
Internet Control Message Protocol (ICMP)
• IP companion protocol
– Handles error and control messages
FTP
HTTP
NV
TCP
UDP
IP
Ethernet
TFTP
FDDI
• Error Messages
– Host unreachable
– Reassembly failed
– IP checksum failed
– TTL exceeded (packet dropped)
– Invalid header
ICMP
ATM
Modem
• Control Messages
– Echo/ping request and reply
– Echo/ping request and reply
with timestamps
– Route redirect
Internet Control Message Protocol (ICMP)
Type Code description
0
0
echo reply (ping)
3
0
dest. network unreachable
3
1
dest host unreachable
3
2
dest protocol unreachable
3
3
dest port unreachable
3
6
dest network unknown
3
7
dest host unknown
4
0
source quench (congestion
control - not used)
8
0
echo request (ping)
9
0
route advertisement
10
0
router discovery
11
0
TTL expired
12
0
bad IP header
IP addresses: how to get one?
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”
Dynamic Host Configuration Protocol (DHCP)
• A simple way to automate configuration information
– Network administrator does not need to enter host IP address by hand
– Good for large and/or dynamic networks
• New machine sends request to DHCP server for assignment and information
• Server receives
– Directly if new machine given server’s IP address
– Through broadcast if on same physical network
– Via DHCP relay nodes that forward requests onto the server’s physical
network
• Server assigns IP address and provides other info
• Can be made secure (present signed request or just a “valid” physical address)
Dynamic Host Configuration Protocol (DHCP)
goal: allow host to dynamically obtain its IP address from network
server when it joins network
can renew its lease on address in use
allows reuse of addresses (only hold address while
connected/“on”)
support for mobile users who want to join network (more
shortly)
DHCP overview:
host broadcasts “DHCP discover” msg [optional]
DHCP server responds with “DHCP offer” msg [optional]
host requests IP address: “DHCP request” msg
DHCP server sends address: “DHCP ack” msg
Dynamic Host Configuration Protocol (DHCP)
DHCP client-server scenario
DHCP
server
223.1.1.0/24
223.1.2.1
223.1.1.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
223.1.2.0/24
223.1.3.2
223.1.3.1
223.1.3.0/24
arriving DHCP
client needs
address in this
network
Dynamic Host Configuration Protocol (DHCP)
DHCP server: 223.1.2.5
DHCP discover
src : 0.0.0.0, 68
Broadcast:
is there a
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654
DHCP offer
src: 223.1.2.5, 67
Broadcast:
I’m a DHCP
dest: 255.255.255.255,
68
yiaddrr:
223.1.2.4
server! Here’s an IP
transaction
654 use
address
youID:can
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast:
OK. I’ll take
yiaddrr: 223.1.2.4
that
IP address!
transaction
ID: 655
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
68
Broadcast:
OK. You’ve
yiaddrr: 223.1.2.4
got
that IPID:
address!
transaction
655
lifetime: 3600 secs
arriving
client
DHCP Example
• DCP server formulates
DHCP ACK containing
client’s IP address, IP
address of first-hop
router for client, name
& IP address of DNS
server
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
router with DHCP
server built into
router
encapsulation of DHCP
server, frame forwarded
to client, demuxing up to
DHCP at client
client now knows its IP
address, name and IP
address of DSN server, IP
address of its first-hop
router
DHCP Example
• DCP server formulates
DHCP ACK containing
client’s IP address, IP
address of first-hop
router for client, name
& IP address of DNS
server
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
DHCP
UDP
IP
Eth
Phy
router with DHCP
server built into
router
encapsulation of DHCP
server, frame forwarded
to client, demuxing up to
DHCP at client
client now knows its IP
address, name and IP
address of DSN server, IP
address of its first-hop
router
IP addresses: how to get one?
Q: how does network get subnet part of IP
addr?
A: gets allocated portion of its provider
ISP’s address space
ISP's block
11001000 00010111 00010000 00000000
200.23.16.0/20
Organization 0
Organization 1
Organization 2
...
11001000 00010111 00010000 00000000
11001000 00010111 00010010 00000000
11001000 00010111 00010100 00000000
…..
….
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
….
Organization 7
11001000 00010111 00011110 00000000
200.23.30.0/23
Computer Network
Internet Protocol
1. Format of IP Header
2. Options included in IP Header
3. How the options are going to work?
IP/001
IP
The format of the IP header
IP/002
IP
TCP Packet Structure
TCP Header
TCP Packet
IP/003
User Pay-Load
IP
1. Version Number
The version number of “IP” that creates this packet
- The current IP version is IP V4 (Version 4).
- The next IP is IP V6 (IP V6 is the standard IP for Windows XP)
Question Why we have “Version Number” field?
To allow routers that use different versions of IP coexist.
Without “Version Number” filed, all routers in the Internet
must be switched from IPv4 to IPv6 in one day!
IP/004
IP
2. Internet Header Length (IHL)
IHL is the header length in 32-bit double words (4 bytes)
- Minimum header length is ‘5’ (i.e., 20 bytes)
- All the IP header fields except “options” and “padding” are mandatory
- IHL is NOT packet size (only header)
Question Why is the maximum header size?
Why is “header size” a part of the IP header?
IP/005
IP
3. Type of Service
Parameters that specify how this packet should be transferred.
• Desired reliability
• Desired transmission priority
• Desired end-to-end delay
The IP running at routers
Actually ignore all these parameters
• Desired throughput
There is no implementation defined
for these parameters in IP
IP is “best-effort” transportation protocol
IP/006
Computer Network
4. Total Length
Total packet length in bytes
= (IP header) + (Payload)
- The packet length, including IP header and data user field
User Payload
IP Header
Total Length (in bytes)
Question What is the maximum IP packet?
216 bytes = 65,536 bytes = 64K bytes
IP/007
IP
6. Flag Bits
Flags that control packet fragmentation/assembly
Bit 1 = “More bit”
• More bit = 1
This packet is not the last packet in a data transmission
(destination host must concatenate all these IP packets)
• More bit = 0
This packet is the last packet in a data transmission
(destination host should concatenate all the previous IP packets)
Destination Host Computer
TCP
0
1
1
IP
IP/008
Network
1
IP
6. Flag Bits
Bit 2 = “Don’t Fragment” bit
• Don’t fragment bit = 1
This IP packet will not be fragmented
• Don’t fragment bit = 0
This IP packet can be fragmented
Question Why is this flag included in an IP header?
Bit 3 Future reserved (not currently used)
IP/009
IP
7. Fragment Offset
Offset from the beginning of the original TCP packet
(Measured in 64-bit (8-byte) unit)
Fragment Offset for the 3rd packet
IP/010
IP
Example of “Flag” bits and “Fragmentation Offset” field
The original packet is fragmented in a network with max packet size = 232 bytes
Original Packet
Total Length = 424
IHL = 6
Fragment Offset = 0
More = 0
400 bytes
IP Header
Packet 1:
Packet 2:
Total Length = 232
IHL = 6
Fragment Offset = 0
More = 1
IP/011
208 bytes
24 bytes (= 46)
Total Length = 216
IHL = 6
Fragment Offset = 26
More = 0
Assume IHL = 6 for every packet
192 bytes
IP
8. Time-To-Live (TTL)
- The hop counter that will be decreased by one at every intermediate router
- If TTL = 0, a router drops this IP packet
- Question: What is the maximum hop an IP packet can make in the Internet?
28 = 256. This means the maximum hop is 256 hops
- Question: Can we utilize TTL field for any meaningful tool?
IP/012
IP
8. Time-To-Live (TTL) (continued)
traceroute utility
TTL = N
TTL =2
TTL =1
Sender
“Reply Me” packet
Reply
Destination
Reply
Reply
Destination IP address = IP of the destination host
IP/013
IP
9. High Level Protocol
- To which protocol should IP deliver this packet
- protocols to transmit user data
- routing protocols
FTP
HTTP
Telnet
BGP
UDP OSPF RSVP IGMP
TCP
IP
IP/014
IP
10. Header Checksum
CRC Check Sum code only for only the IP header
Question Can we replace this by the CRC check sum for the entire IP packet?
IP/015
IP
11. Source/Destination IP addresses (32 bits each)
To identify who is the sender and the destination
• Both sender and destination IP addresses are specified.
Destination IP: To deliver this IP packet
Sender IP: To send ACK message (e.g., ACK for GBN flow control)
• One of the problems in IP address is that sender IP can be spoofed.
(a sender can fake its identity by spoofing its IP address)
IP/016
Computer Network
= 131.123.45.1
A IP
MAC = 1010
C
= 131.123.45.4
B IP
MAC = 1012
Broadcast “Serach” message
LAN
“ARP Search” Broadcast MAC Receiver IP Sender MAC Sender IP
“ARP Search”
0000
131.123.45.4
1010
Sender IP Sender MAC Receiver IP Receiver MAC
131.123.45.4
IP/017
1012
131.123.45.1
1010
131.123.45.1
“ARP Reply”
“ARP Reply”
Computer Network
Problems in IPv4
(1) Limited address space:
• 232 address space seemed to be large enough in early 70s’
• The 232 address space does not look enough these days
(2) Security:
• IP v4 was not designed to provide strong security
(3) No QoS (Quality of Service) support:
• In IPv4, the only possible service is “best effort” service
• No guarantee when/if/how your packet will be delivered
IP/018
Advanced Computer Network
Address Resolution Protocol (ARP)
Presentation Agenda
1. What is ARP?
2. Why ARP is needed?
3. How ARP works?
4. ARP extension to WAN/Internet
ARP/001
Address Resolution Protocol (ARP)
Address Resolution Protocol (ARP):
1. It is a mechanism that translates MAC address to IP address
IP (Internet Protocol) address e.g. “146.163.147.59”
(= software address)
32-bit address
ARP
(IP-MAC Translation)
MAC (Medium Access Control) address
(= hardware address)
e.g. “1E:32:55:FF:3B:CC”
48-bit address
ARP/002
Address Resolution Protocol (ARP)
What are the software network address and hardware network address?
Software Network Address:
1. Network address managed by a network protocol
Example:(1) IP address in Internet Protocol
(2) “computer name” in Microsoft NetBEUI
2. Network address you can change through OS
Hardware Network Address:
1. Network address “hardwired” in each NIC (assigned at a factory)
Example: Ethernet MAC address
2. Can not be changed
ARP/003
Address Resolution Protocol (ARP)
Host (a terminal computer)
Application
Presentation
• The upper 5 layers use IP address
• The lower two layers use MAC address
Session
Transport
Network
Logical Link
Physical
IP Address
MAC Address
NIC
Network
Address Resolution Protocol (ARP)
Why ARP is needed?
NIC can understand ONLY hardware network address
Application
Presentation
Session
TCP/IP (IP address)
(= software address)
Transport
Network
Logical Link
Physical
ARP
Ethernet (MAC Address)
(= hardware address)
Address Resolution Protocol (ARP)
How ARP works?
- Host A wants to send data to host B
- Host A knows IP address of B (but not MAC address of B)
How A can know MAC address of B?
= 131.123.45.1
A IP
MAC = 1010
= 131.123.45.4
B IP
MAC = 1012
Broadcast “ARP Search” message LAN
“ARP Search” Broadcast MAC Receiver IP Sender MAC Sender IP
Address Resolution Protocol (ARP)
= 131.123.45.1
A IP
MAC = 1010
C
= 131.123.45.4
B IP
MAC = 1012
Broadcast “polling” message
LAN
“ARP Search” Broadcast MAC Receiver IP Sender MAC Sender IP
“ARP Search”
0000
131.123.45.4
1010
Sender IP Sender MAC Receiver IP Receiver MAC
131.123.45.4
1012
131.123.45.1
1010
131.123.45.1
“ARP Reply”
“ARP Reply”
Address Resolution Protocol (ARP)
If a host has to broadcast ARP search message for each packet, it is not efficient
ARP entries will be cached
Host
ARP Cache
ARP
LAN
Address Resolution Protocol (ARP)
ARP spanning more than one LAN:
• Now we understand how ARP works for a LAN
• How ARP can work for a connection spanning more than one LAN?
Router
Host A
Host B
WAN/Internet
Routers do NOT forward broadcast ARP Search message
How host A can know MAC address of B?
ARP/010
Address Resolution Protocol (ARP)
Host A Host X
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
R2
Host A
MAC: FB21C
IP: 191.100.2.1
MAC: 1325C
IP: 131.241.20.5
ARP_2/001
Address Resolution Protocol (ARP)
Host A calls ARP on LAN #1 (ARP Broadcast in LAN #1)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 1004F
IP: 143.163.9.9
Broadcast reaches only within a LAN segment
R2
Host A
MAC: FB21C
IP: 191.100.2.1
I want to transmit packets to Host X!
ARP_2/002
MAC: 1325C
IP: 131.241.20.5
MAC: 15FB2
IP: 131.241.91.11
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
MAC: 2015B
IP: 143.163.147.59
Host B
R1
MAC: 1004F
IP: 143.163.9.9
Host A
Gateway Address
Specified at Host A
ARP_2/003
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
Host B
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
R2
Host A
MAC: FB21C
IP: 191.100.2.1
MAC: 1325C
IP: 131.241.20.5
Search 00000 143.163.147.59 1004F 143.163.9.9
ARP_2/004
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
Host B
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
R2
Host A
MAC: FB21C
IP: 191.100.2.1
MAC: 1325C
IP: 131.241.20.5
Reply
1004F 143.163.9.9 2015B 143.163.147.59
ARP_2/005
MAC Address of your gateway router
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
R2
Host A
MAC: FB21C
IP: 191.100.2.1
MAC: 1325C
IP: 131.241.20.5
DATA 2015B 131.241.91.11 1004F 143.163.9.9
ARP_2/006
MAC Address of your gateway router
Address Resolution Protocol (ARP)
R1 calls ARP on LAN #2 (ARP Broadcast in LAN #2)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
Host A
MAC: FB21C
IP: 191.100.2.1
R2
MAC: 1325C
IP: 131.241.20.5
DATA A3125 131.241.91.11 FB21C 143.163.9.9
ARP_2/007
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
Host A
MAC: FB21C
IP: 191.100.2.1
R2
MAC: 1325C
IP: 131.241.20.5
DATA 15FB2 131.241.91.11 1325C 143.163.9.9
ARP_2/008
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
Host A
MAC: FB21C
IP: 191.100.2.1
R2
MAC: 1325C
IP: 131.241.20.5
131.241.91.11 15FB2 143.163.9.9 1325C ACK
ARP_2/009
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
Host A
MAC: FB21C
IP: 191.100.2.1
R2
MAC: 1325C
IP: 131.241.20.5
131.241.91.11 A3125 143.163.9.9 FB21C ACK
ARP_2/010
Address Resolution Protocol (ARP)
(143.163.X.X)
LAN #1
(191.100.X.X)
LAN #2
MAC: 2015B
IP: 143.163.147.59
(131.241.X.X)
LAN #3
MAC: A3125
IP: 191.100.80.5
Host X
R1
MAC: 15FB2
IP: 131.241.91.11
MAC: 1004F
IP: 143.163.9.9
MAC: FB21C
IP: 191.100.2.1
Host A
R2
MAC: 1325C
IP: 131.241.20.5
131.241.91.11 2015B 143.163.9.9 1004F ACK
ARP_2/011
IPv6
• History:
– Next generation IP (IPng)
– Intended to extend address space and routing
– limitations of IPv4
• Requires header change
• Wish list:
– 128-bit addresses
– Multicast traffic
– Mobility
– Real-time traffic/quality of
service guarantees
–
–
Authentication and security
Auto configuration for local
IP addresses
–
–
End-to-end fragmentation
Protocol extensions
IPv6 Addresses
• 128-bit
• Classless addressing/routing (similar to CIDR)
• Address notation
– String of eight 16-bit hex values separated by colons
• 5CFA:0002:0000:0000:CF07:1234:5678:FFCD
– Set of contiguous 0’s can be elided
• 5CFA:0002::CF07:1234:5678:FFCD
Transition From IPv4 To IPv6
• Not all routers can be upgraded simultaneous
– no “flag days”
– How will the network operate with mixed IPv4 and IPv6 routers?
• Tunneling: IPv6 carried as payload in IPv4 datagram among IPv4 routers
Tunneling
Logical view:
A
B
IPv6
Physical view:
E
F
IPv6
IPv6
tunnel
IPv6
A
B
C
D
E
F
IPv6
IPv6
IPv4
IPv4
IPv6
IPv6
Flow: X
Src: A
Dest: F
data
A-to-B:
IPv6
Src:B
Dest: E
Src:B
Dest: E
Flow: X
Flow: X
Src: A
Dest: F
Src: A
Dest: F
data
data
B-to-C:
IPv6 inside
IPv4
B-to-C:
IPv6 inside
IPv4
Flow: X
Src: A
Dest: F
data
E-to-F:
IPv6
Internet Routing
Internet Routing: 3-layer routing architecture
What is “routing”?
A mechanism to find a path between sender and receiver
Application
Presentation
Session
Transport
Interior Routing
Layer 3
Network
Layer 3 Routing
Layer 2
Datalink
Layer 2 Routing
Layer 1
Physical
Layer 1 Routing
Exterior Routing
Internet Routing
1. Layer 1 Routing: by repeater or hub
(a) Repeater
(b) Hub
Repeater
Hub
Since all packets are broadcast, actually no routing
Internet Routing
2. Layer 2 Routing: bridge
(a) Local traffic a bridge does not forward it
Bridge
LAN 1
LAN 2
A bridge (transparent
bridge) will not forward
the packet to LAN2
(b) Outgoing traffic a bridge forwards it
Bridge
LAN 1
LAN 2
A bridge (transparent
bridge) will forward
the packet to LAN2
Internet Routing
3. Layer 3 Routing: Interior Routing
LAN 1
• Subnet Address
• Host Address
Hub
B
LAN 4
Host Address
Router
Subnet Address
Router
LAN 3
LAN 2
A
Bridge/Repeater
Autonomous System (AS = a network domain)
Internet Routing
4. Layer 3 Routing: Exterior Routing (routing based on network domain address)
AS 3
AS 1
Border Router (Gateway)
(= Exterior Router)
AS 4
AS 2
AS 5
Interior Router
To another AS
Same as Interior Routing but between ASes (not within an AS)
Internet Routing
4. Layer 3 Routing: Exterior Routing
Destination IP =191.66.7.8
AS 3
Domain Address
AS 1
191.66
Border Router (Gateway)
(= Exterior Router)
AS 4
AS 2
191.66
191.66
AS 5
Sender IP = 131.125.43.7
Domain Address
= a computer host
= an exterior router
To another AS
= an interior router
Internet Routing
3. Layer 3 Routing: Interior Routing
LAN 4 (Subnet #3)
Destination Host
Transmission by
MAC Address
LAN 1 (Subnet #0)
ARP
Exterior Router
Domain Address
Subnet Address
Host Address
Interior Router
LAN 3 (Subnet #2)
LAN 2 (Subnet #1)
From Internet
Autonomous System (AS = a network domain) 191.66
Internet Routing
Intermediate Summary: Internet routing = layered routing architecture
Exterior Routing (Inter-Domain Routing)
= Between network domains
Interior routing (Intra-Domain Routing)
= Within a network domain
Bridge (Transparent Bridge)
Repeater and Hub
= Between two LAN segments
= To extend LAN
Internet Routing
Terminology: routing algorithms and routing protocols
• Routing algorithms: theoretically define what kind of paths we will get?
• Routing protocols: how we implement a routing algorithm?
Internet Routing
Routing Algorithm-Protocol Collaboration
Calculate “best path”
based on a criteria
Routing Algorithm
Collect routing information
from a network.
(distributed or centralized)
Routing Protocol
Exchange routing info.
between routers
Router
Network
Internet Routing
Distance-Vector Protocols:
R2
3
2
R1
1
R4
4
2
R5
R7
R8
3
1
3
1
3
R3
2
4
2
3
3
4
5
6
7
8
9 10 11 12 13
R11
R10
4
R13
1
Vector (R2)
Vector (R1)
2
R12
3
2
R9
2
R6
1
Routing metric
(delay, hop-count,
cost …).
1
2
3
4
5
6
7
8
9 10 11 12 13
0 2 3
2 0 1 4 3
Vector (R3)
Vector (R4)
1
2
3
4
5
6
7
8
9 10 11 12 13
3 1 0 1 2
1
2
3
4
5
6
7
8
9 10 11 12 13
4 0 2 2
Internet Routing
• When R1 sends its distance vector to R2, it adds the distance to R2
1
2
3
4
5 6
7
8
9 10 11 12 13
0 2 3 Vector (R1)
1
2
3
4
5 6
7
8
9 10 11 12 13
+2 (distance from R1 to R2)
2 4 5 Vector (R1R2):
• When R2 receives the distance vector from R1, it compares it to its distance vector
1
2
3
4
5
6
7
8
9 10 11 12 13
2 4 5 Vector (R1R2):
1
2
3
4
5
6
7
8
9 10 11 12 13
2 0 1 4 3 Vector (R2)
1
2
3
4
5
6
7
8
9 10 11 12 13
+4 (distance from R2 to R4)
6 4 5 8 7 Vector (R2R4)
Internet Routing
Link-State Protocols:
R2
3
2
R1
1
R4
4
2
R5
R7
R8
3
1
3
1
3
R3
2
2
R6
3
2
R9
2
4
4
R12
3
R13
1
R10
R11
Vector (R1)
1
2
3
4
5
6
7
8
9 10 11 12 13
0 2 3
R1 broadcasts its distance vector.
Every router does the same thing.
Internet Routing
1. Exterior Distance-Vector Routing Protocols:
EGB, BGP uses only “hop count” as the routing metric
Why is it like that?
2. Exterior Link-State Routing Protocols:
Research prototypes are not used yet in the Internet
Why is it like that?
Store-and-Forward Packet Switching
The environment of the network
layer protocols.
Routing within a diagram subnet.
Routing Algorithms
•
•
•
•
•
•
•
•
•
•
The Optimality Principle
Shortest Path Routing
Flooding
Distance Vector Routing
Link State Routing
Hierarchical Routing
Broadcast Routing
Multicast Routing
Routing for Mobile Hosts
Routing in Ad Hoc Networks
Shortest Path Routing
4.5 routing algorithms
– link state
– distance vector
– hierarchical routing
4.6 routing in the Internet
– RIP
– OSPF
– BGP
Interplay between routing, forwarding
routing algorithm determines
end-end-path through network
routing algorithm
local forwarding table
dest address output link
address-range 1
address-range 2
address-range 3
address-range 4
3
2
2
1
IP destination address in
arriving packet’s header
1
3 2
forwarding table determines
local forwarding at this router
Graph abstraction
5
2
u
2
1
graph: G = (N,E)
v
x
3
w
3
1
5
z
1
y
2
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) }
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
Routing algorithm classification
Q: 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
Q: static or dynamic?
static:
routes change slowly over
time
dynamic:
routes change more
quickly
periodic update
in response to link
cost changes
A Link-State Routing Algorithm
Dijkstra’s algorithm
notation:
• net topology, link costs
known to all nodes
• c(x,y): link cost from
– 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
node x 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
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
D(v) D(w) D(x) D(y) D(z)
Step
0
1
2
3
4
5
N'
p(v)
p(w)
p(x)
u
uw
uwx
uwxv
uwxvy
uwxvyz
7,u
6,w
6,w
3,u
∞
∞
5,u
∞
5,u 11,w
11,w 14,x
10,v 14,x
12,y
p(y)
p(z)
5
notes:
construct shortest path tree by
tracing predecessor nodes
ties can exist (can be broken
arbitrarily)
x
9
7
4
8
3
u
w
y
3
4
7
v
2
z
Dijkstra’s algorithm: another 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
2
u
2
1
x
3
w
3
1
5
z
1
y
D(z),p(z)
∞
∞
4,y
4,y
4,y
5
v
D(y),p(y)
∞
2,x
2
Dijkstra’s algorithm: example (2)
resulting shortest-path tree from u:
v
w
u
z
x
y
resulting forwarding table in u:
destination
link
v
x
(u,v)
(u,x)
y
(u,x)
w
(u,x)
z
(u,x)
Dijkstra’s algorithm, discussion
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
1
D
1
B
0
0
0
1+e
C
e
2+e
A
D
1+e 1
0
1
C
0
A
0
B
0
D
B
0
0
1
2+e
C
1+e
2+e
A
D
1+e 1
0
C
0
B
0
e
initially
given these costs,
find new routing….
resulting in new costs
given these costs,
given these costs,
find new routing….
find new routing….
resulting in new4-132
costs
resulting in new costs
Network Layer
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)
+
d
(y)
}
v
v
cost from neighbor v to destination y
cost to neighbor v
min taken over all neighbors v of x
Bellman-Ford example
5
2
u
v
2
1
x
3
w
3
1
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
5
z
1
y
2
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
node achieving minimum is next
hop in shortest path, used in forwarding table
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 ]
Distance vector algorithm
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)
Distance vector algorithm
iterative,
asynchronous: each
each node:
local iteration caused by:
• local link cost change
• DV update message from
neighbor
wait for (change in local link
distributed:
recompute estimates
• each node notifies
neighbors only when its DV
changes
if DV to any dest has
changed, notify neighbors
– neighbors then notify their
neighbors if necessary
cost or msg from neighbor)
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
x y z
x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
x 0 2 3
y 2 0 1
z 7 1 0
cost to
from
from
node x
cost to
table x y z
from
node y cost to
table x y z
2
x ∞ ∞ ∞
y 2 0 1
z ∞∞ ∞
x
from
node z cost to
table x y z
x ∞∞ ∞
y ∞∞ ∞
z 7 1 0
time
y
7
1
z
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
= min{2+0 , 7+1} = 2
Dx(z) = min{c(x,y) +
Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
x y z
x y z
x 0 2 7
y ∞∞ ∞
z ∞∞ ∞
x 0 2 3
y 2 0 1
z 7 1 0
x 0 2 3
y 2 0 1
z 3 1 0
cost to
cost to
from
from
from
node x
cost to
table x y z
x y z
x y z
x ∞ ∞ ∞
y 2 0 1
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
cost to
x ∞∞ ∞
y ∞∞ ∞
z 7 1 0
x 0 2 7
y 2 0 1
z 3 1 0
cost to
x y z
from
x y z
from
node z cost to
table x y z
from
cost to
from
from
from
node y cost to
table x y z
x 0 2 3
y 2 0 1
z 3 1 0
time
2
x
y
7
1
z
Distance vector: link cost changes
link cost changes:
node detects local link cost change
bad news travels slow - “count to
infinity” problem!
44 iterations before algorithm
stabilizes: see text
60
x
4
y
1
50
poisoned reverse:
If Z routes through Y to get to X :
Z tells Y its (Z’s) distance to X is infinite (so Y won’t route
to X via Z)
will this completely solve count to infinity problem?
z
Comparison of LS and DV algorithms
message complexity
robustness: what happens if
• LS: with n nodes, E links,
O(nE) msgs sent
• DV: exchange between
neighbors only
– convergence time varies
router malfunctions?
speed of
convergence
• LS: O(n2) algorithm requires
O(nE) msgs
– may have oscillations
• DV: convergence time varies
– may be routing loops
– count-to-infinity problem
LS:
– node can advertise
incorrect link cost
– each node computes only
its own table
DV:
– DV node can advertise
incorrect path cost
– each node’s table used by
others
• error propagate thru
network
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
proprietary)
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)
u
v
A
z
C
B
w
x
D
y
from router A to destination subnets:
subnet hops
u
1
v
2
w
2
x
3
y
3
z
2
RIP: example
z
w
A
x
y
B
D
C
routing table in router D
destination subnet
next router
# hops to dest
w
y
z
x
A
B
B
--
2
2
7
1
….
….
....
RIP: example
dest
w
x
z
….
w
A
A-to-D advertisement
next hops
1
1
C
4
… ...
x
z
y
B
D
C
routing table in router D
destination subnet
next router
# hops to dest
w
y
z
x
A
B
A
B
--
2
2
5
7
1
….
….
....
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
(infinite distance = 16 hops)
OSPF (Open Shortest Path First)
“open”: publicly available
uses link state algorithm
LS packet dissemination
topology map at each node
route computation using Dijkstra’s algorithm
OSPF advertisement carries one entry per neighbor
advertisements flooded to entire AS
carried in OSPF messages directly over IP (rather than
TCP or UDP
IS-IS routing protocol: nearly identical to OSPF
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
boundary router
backbone router
backbone
area
border
routers
area 3
internal
routers
area 1
area 2
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.
• boundary routers: connect to other AS’s.
Internet inter-AS routing: BGP
BGP (Border Gateway Protocol): the de facto interdomain routing protocol
“glue that holds the Internet together”
BGP provides each AS a means to:
eBGP: obtain subnet reachability information from
neighboring ASs.
iBGP: propagate reachability information 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 basics
BGP session: two BGP routers (“peers”) exchange BGP
messages:
advertising paths to different destination network prefixes (“path vector”
protocol)
exchanged over semi-permanent TCP connections
• when AS3 advertises a prefix to AS1:
– AS3 promises it will forward datagrams towards that prefix
– AS3 can aggregate prefixes in its advertisement
3c
3b
other
networks
3a
BGP
message
AS3
2c
1c
1a
AS1
1d
2a
1b
2b
AS2
other
networks
Distance Vector Routing (2)
The count-to-infinity problem.
Link State Routing
Each router must do the following:
• Discover its neighbors, learn their network address.
• Measure the delay or cost to each of its neighbors.
• Construct a packet telling all it has just learned.
• Send this packet to all other routers.
• Compute the shortest path to every other router.
(a) A subnet. (b) The link state packets for this subnet.
Hierarchical Routing
Hierarchical routing.
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )