Computer Communication 2ndmodule
Computer Communication 2ndmodule
encapsulates segments
data link
physical network network
into datagrams
data link data link
physical physical
layer physical
application
transport
network layer protocols
network
data link
physical
network
network
data link
value in arriving
packet’s header
0111 1
3 2
call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host
address)
every router on source-dest path maintains “state” for
each passing connection
link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable
service)
Network Layer 4-11
VC implementation
a VC consists of:
1. path from source to destination
2. VC numbers, one number for each link along path
3. entries in forwarding tables in routers along path
packet belonging to VC carries VC number
(rather than dest address)
VC number can be changed on each link.
new VC number comes from forwarding table
1 3
2
VC number
interface
forwarding table in number
northwest router:
Incoming interface Incoming VC # Outgoing interface Outgoing VC #
1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …
application application
transport 5. data flow begins 6. receive data
transport
network 4. call connected 3. accept call network
data link 1. initiate call 2. incoming call data link
physical physical
application application
transport transport
network 1. send datagrams
2. receive datagrams network
data link data link
physical physical
IP destination address in
arriving packet’s header
1
3 2
otherwise 3
otherwise 3
examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
Network Layer 4-18
Datagram or VC network: why?
Internet (datagram) ATM (VC)
data exchange among evolved from telephony
computers human conversation:
“elastic” service, no strict strict timing, reliability
timing req. requirements
need for guaranteed service
many link types “dumb” end systems
different characteristics telephones
uniform service difficult complexity inside
“smart” end systems network
(computers)
can adapt, perform control,
error recovery
simple inside network,
complexity at “edge”
IP destination address in
arriving packet’s header
1
3 2
v 3 w
2 5
u 2 z
1
3
1
x y 2
graph: G = (N,E) 1
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) }
v 3 w
2 5
u 2 z
1
3
1
x y 2
1
Network Layer 4-29
Dijkstra’s algorithm: example (2)
resulting shortest-path tree from u:
v w
u z
x y
1
A 1+e A A A
2+e 0 0 2+e 2+e 0
D 0 0 B D 1+e 1 B D B D 1+e 1 B
0 0
0 e 0 0
C 0 1 1+e 0
C C C
1 1
e given these costs, given these costs, given these costs,
initially find new routing…. find new routing…. find new routing….
resulting in new costs resulting in new costs resulting in new costs
Network Layer 4-31
Chapter 4: outline
4.1 introduction 4.5 routing algorithms
4.2 virtual circuit and link state
datagram networks distance vector
4.3 what’s inside a router hierarchical routing
4.4 IP: Internet Protocol 4.6 routing in the Internet
datagram format RIP
IPv4 addressing OSPF
ICMP BGP
IPv6 4.7 broadcast and multicast
routing
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = min
v
{c(x,v) + dv (y) }
from
from
y ∞∞ ∞ y 2 0 1
z ∞∞ ∞ z 7 1 0
node y cost to
table x y z y
2 1
x ∞ ∞ ∞
x z
from
y 2 0 1 7
z ∞∞ ∞
node z cost to
table x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
Network Layer 4-38
Dx(z) = min{c(x,y) +
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(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
table x y z x y z x y z y
2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
from
from
y 2 0 1 y 2 0 1
from
y 2 0 1 7
z ∞∞ ∞ z 7 1 0 z 3 1 0
x ∞∞ ∞ x 0 2 7 x 0 2 3
from
from
y 2 0 1 y 2 0 1
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
Network Layer 4-39
Distance vector: link cost changes
link cost changes:
1
node detects local link cost change y
4 1
updates routing info, recalculates x z
distance vector 50
if DV changes, notify neighbors
t2 : y receives z’s update, updates its distance table. y’s least costs
do not change, so y does not send a message to z.
3c
3a 2c
3b 2a
AS3 2b
1c AS2
1a 1b AS1
1d forwarding table
configured by both intra-
and inter-AS routing
Intra-AS Inter-AS algorithm
Routing Routing
algorithm algorithm intra-AS sets entries
Forwarding
for internal dests
table inter-AS & intra-AS
sets entries for
external dests
Network Layer 4-46
Inter-AS tasks
suppose router in AS1 AS1 must:
receives datagram 1. learn which dests are
destined outside of AS1: reachable through AS2,
router should forward which through AS3
packet to gateway 2. propagate this
router, but which one? reachability info to all
routers in AS1
job of inter-AS routing!
3c
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
3c
x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
Network Layer 4-49
Example: choosing among multiple ASes
now suppose AS1 learns from inter-AS protocol that subnet
x is reachable from AS3 and from AS2.
to configure forwarding table, router 1d must determine
towards which gateway it should forward packets for dest x
this is also job of inter-AS routing protocol!
hot potato routing: send packet towards closest of two
routers.
3c
BGP
3a message
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
eBGP session
3a iBGP session
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
A advertises path AW to B
B advertises path BAW to X
Should B advertise path BAW to C?
No way! B gets no “revenue” for routing CBAW since neither W nor
C are B’s customers
B wants to force C to route to w via A
B wants to route only to/from its customers!
R3 R4 R3 R4
source in-network
duplication duplication
A A
B B
c c
D D
F E F E
G G
(a) broadcast initiated at A (b) broadcast initiated at D
A A
3
B B
c c
4
2
D D
F E F E
1 5
G G
(a) stepwise construction of (b) constructed spanning
spanning tree (center: E) tree
Network Layer 4-65
Multicast routing: problem statement
goal: find a tree (or trees) connecting routers having
local mcast group members legend
tree: not all paths between routers used group
shared-tree: same tree used by all group members member
not group
source-based: different tree from each sender to rcvrs member
router
with a
group
member
router
without
group
member
s: source LEGEND
R1 2 router with attached
1 R4
group member
R2 5 router with no attached
3 4 group member
R5
i link used for forwarding,
R3 6
i indicates order link
R6 R7 added by algorithm
LEGEND
dense: sparse:
group members densely # networks with group
packed, in “close” members small wrt #
proximity. interconnected networks
bandwidth more plentiful group members “widely
dispersed”
bandwidth not plentiful
source R6
RP can send stop msg all data multicast R7
rendezvous
if no attached from rendezvous
point
point
receivers
“no one is listening!”
Header fields used in IP fragmentation. (a) Unfragmented packet; (b) fragmented packets.
Global Addresses
IP addresses Properties
globally unique
hierarchical: network + host
• Network part: identifies the network the host is attached to
• Host: identifies a unique host on that network
• Ethernet addresses, even globally unique, are flat (no structure and thus no meaning) and
can not be use for routing
Note that a router is attached to at least two networks, so it must have an IP address
on each port/interface
• Thus it is more precise to think of IP addresses as belonging to interfaces rather than to
hosts
Global Addresses
Approximately, 4 Billion IP address, half are A type, ¼ is B type, and 1/8 is C
type
For a host with only one interface and only a default router in its forwarding table, this simplifies to
The IP address of a nodes ANDed with the subnet mask give the subnet
number
IP AND subnet mask subnet number
Subnetting
ICMP-Redirect
From router to a source host
With a better route information
ARP: address resolution protocol
Question: how to determine
interface’s MAC address,
knowing its IP address? ARP table: each IP node (host,
router) on LAN has table
137.196.7.78
IP/MAC address
mappings for some LAN
1A-2F-BB-76-09-AD
nodes:
137.196.7.23
137.196.7.14 < IP address; MAC address; TTL>
TTL (Time To Live):
LAN time after which address
71-65-F7-2B-08-53 mapping will be
forgotten (typically 20
58-23-D7-FA-20-B0
min)
0C-C4-11-6F-E3-98
137.196.7.88
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP IP
Eth Eth
Phy Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B