CN Module 4
CN Module 4
CN Module 4
▪ 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)
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
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
5. data flow begins 6. receive data
transport transport
network 4. call connected 3. accept call
1. initiate call network
data link 2. incoming call
data link
physical physical
Datagram networks
▪ no call setup at network layer
▪ routers: no state about end-to-end connections
▪ no network-level concept of “connection”
application application
transport transport
network 1. send datagrams 2. receive datagrams network
data link data link
physical physical
Datagram forwarding table
4 billion IP addresses, so
routing algorithm rather than list individual
destination address
local forwarding table
list range of addresses
dest address output (aggregate table entries)
address-range 1 3 link
address-range 2 2
address-range 3 2
address-range 4 1
IP destination address in
arriving packet’s header
1
3 2
Datagram forwarding table
Destination Address Range Link Interface
otherwise 3
physical layer:
bit-level reception
data link layer: decentralized switching:
e.g., Ethernet ▪ given datagram dest., lookup output port using
see chapter 5 forwarding table in input port memory (“match plus
action”)
▪ goal: complete input port processing at ‘line
speed’
▪ queuing: if datagrams arrive faster than
forwarding rate into switch fabric
Input port functions
▪ forwarding table is computed and updated by the routing processor
▪ a shadow copy is stored at each input port
▪ forwarding table is copied from the routing processor to the line cards over a
separate bus indicated by the dashed line
▪ With a shadow copy, forwarding decisions can be made locally, at each input
port, without invoking the centralized routing processor
Switching fabrics
transfer packet from input buffer to appropriate output buffer
switching rate: rate at which packets can be transfer from inputs
to outputs
often measured as multiple of input/output line rate
N inputs: switching rate N times line rate desirable
three types of switching fabrics
memory
4-
Switching via interconnection network
A crossbar switch is an interconnection network
consisting of 2N buses that connect N input
ports to N output port
overcome bus bandwidth limitations
banyan networks, crossbar, other
interconnection nets initially developed to
connect processors in multiprocessor
advanced design: fragmenting datagram into
fixed length cells, switch cells through the fabric.
Cisco 12000: switches 60 Gbps through the
interconnection network
Output ports
datagram
switch buffer link
fabric layer line
protocol termination
queueing (send)
buffering required when datagrams arrive from fabric faster than the transmission
rate
scheduling discipline chooses among queued datagrams for transmission
switch
switch
fabric
fabric
▪ buffering when arrival rate via switch exceeds output line speed
▪ queueing (delay) and loss due to output port buffer overflow!
How much buffering?
▪ RFC 3439 rule of thumb: average buffering equal to “typical” RTT (say 250 msec)
times link capacity C
▪ e.g., C = 10 Gpbs link: 2.5 Gbit buffer
RTT . C
N
Output port
▪ A consequence of output port queuing is :
▪ Packet scheduler at the output port must choose one packet among those queued for
transmission
▪ If there is not enough memory to buffer an incoming packet, either drop the arriving or
remove one or more already-queued packets
switch switch
fabric fabric
physical layer
IP Datagram Format
Datagram Format
▪ Network layer packet is referred as datagram
▪ Key fields in IPv4 datagram:
▪ Version Number:
▪ 4 bits specify the IP protocol version of the datagram
▪ Different versions of IP use different datagram formats
▪ Header Length:
▪ IPv4 datagram can contain a variable number of options
▪ 4 bits are needed to determine where in the IP datagram the data begins
▪ typical IP datagram has a 20-byte header
Datagram Format
▪ Type of Service:
▪ allow different types of IP datagrams
▪ datagrams requiring low delay, high throughput, or reliability
▪ Datagram Length:
▪ total length of the IP datagram (header plus data) in bytes
▪ 16 bits field
▪ minimum value 20 bytes and the maximum is 65,535 bytes
▪ Protocol:
▪ used only when an IP datagram reaches its final destination
▪ value of this field indicates the specific transport-layer protocol to which the data portion of this IP
datagram should be passed
▪ 6 indicates that the data portion is passed to TCP
▪ 17 indicates that the data is passed to UDP
▪ Data(payload):
▪ the data field of the IP datagram contains the transport-layer segment (TCP or UDP)
▪ data field can carry other types of data, such as ICMP messages
▪ When outgoing link has an MTU smaller than the size of IP datagram
▪ Fragment the data into two or three smaller datagrams
▪ Smaller datagrams are called fragments
IP fragmentation, reassembly
▪ network links have MTU
(max.transfer size) - largest
possible link-level frame
▪ different link types, different
MTUs
▪ large IP datagram divided
(“fragmented”) within net
▪ one datagram becomes
several datagrams
▪ “reassembled” only at final
destination
▪ IP header bits used to
identify, order related
fragments
IP fragmentation, reassembly
example:
4000 byte datagram
20 bytes header
3980 bytes of payload
MTU = 1500 bytes
IP addressing: Introduction
223.1.1.1
▪ IP address: 32-bit identifier
for host, router interface 223.1.2.1
▪ IP address is associated
with each interface rather
than host or router 223.1.1.1 = 11011111 00000001 00000001 00000001
containing that interface
223 1 1 1
IP addressing: Introduction
▪ IP address is 32 bits long (4 bytes)
▪ Total of 2^32 possible IP addresses
▪ Written in Dotted Decimal Notation
▪ each byte of the address is written in its decimal form and is separated by a period (dot)
from other bytes in the address
▪ the address 193.32.216.9 in binary notation is
▪ 11000001 00100000 11011000 00001001
IP addressing: Introduction
223.1.1.1
223.1.3.27
223.1.1.3
223.1.2.2
▪ What’s a subnet ?
▪ device interfaces with same
subnet part of IP address
▪ can physically reach each
other without intervening
router
▪ The subnet is also called an
IP network Subnet Addresses
Subnets
▪ IP addressing assigns an address to this subnet: 223.1.1.0/24
▪ the /24 notation is known as a subnet mask
▪ indicates that leftmost 24 bits of the 32-bit quantity define the subnet address
Subnet Addresses
Subnets
how many?
Each router has three interfaces,
one for each point-to-point link and
one for the broadcast link that directly
connects the router to a pair of hosts
Three additional subnets:
223.1.9.0/24, for the interfaces that
connect routers R1 and R2
223.1.8.0/24, for the interfaces that
connect routers R2 and R3
223.1.7.0/24, for the interfaces that
connect routers R3 and R1 Three routers interconnecting six subnets
IP addressing: CIDR
Internet’s address assignment strategy is known as Classless
Interdomain Routing (CIDR—pronounced cider) [RFC 4632]
32-bit IP address is divided into two parts
has the dotted-decimal form a.b.c.d/x, where x indicates the number of
bits in the first part of the address
x most significant bits are referred as prefix of the address
subnet host
part part
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
▪ remember (in NAT translation table) every (source IP address, port #) to (NAT
IP address, new port #) translation pair
▪ Solution:
▪ Need a large IP address space, a new IP protocol, IPv6
IPv6
▪ Important changes in IPv6:
▪ Expanded addressing capabilities:
▪ size of the IP address increased from 32 to 128 bits
▪ Introduced a new type of address
▪ Anycast : allows a datagram to be delivered to any one of a group of hosts
▪ Traffic class:
▪ 8-bit field is similar to the TOS field in
IPv4
▪ Flow label
▪ this 20-bit field is used to identify a flow
of datagrams
IPv6 : Datagram Format
▪ Payload length:
▪ This 16-bit value gives the number of bytes in the IPv6 datagram
▪ Next header:
▪ identifies the protocol to which the contents (data field) of this datagram will be delivered
(for example, to TCP or UDP)
▪ Hop limit:
▪ The contents of this field are decremented by one by each router that forwards the
datagram
▪ If the hop limit count reaches zero, the datagram is discarded.
IPv6 : Datagram Format
▪ Source and destination addresses:
▪ The various formats of the IPv6 128-bit addresses are described in RFC 4291
▪ Data:
▪ payload portion of the IPv6 datagram
▪ When the datagram reaches its destination
▪ the payload will be removed from the IP datagram
▪ passed on to the protocol specified in the next header field
IPv6
▪ Few fields in IPv4 datagram are no longer present in the IPv6 datagram
▪ Fragmentation/Reassembly:
▪ IPv6 does not allow for fragmentation and reassembly at intermediate routers; it can be
performed only by the source and destination
▪ IPv6 datagram received by a router is too large
▪ the router simply drops the datagram
▪ sends a “Packet Too Big” ICMP error message to sender
▪ Header Checksum:
▪ Transport-layer and link-layer protocols perform checksumming, so designers of IP felt
that this functionality was redundant
IPv6
▪ Options:
▪ no longer a part of the standard IP header
▪ removal of the options field results in a fixed-length, 40- byte IP header
▪ ICMP protocol is used by IP nodes to report error conditions and provide limited
information (for example, the echo reply to a ping message) to an end system
▪ New version of ICMP
▪ ICMPv6 added new types and codes required by the new IPv6 functionality
▪ include the “Packet Too Big” type, and an “unrecognized IPv6 options” error code
Transitioning from IPv4 to IPv6
▪ Already deployed IPv4-capable systems are not capable of handling IPv6
datagrams
▪ RFC 4213 describes two approaches for gradually integrating IPv6 hosts and
routers into an IPv4 world
▪ Dual-stack approach
▪ IPv6 nodes also have a complete IPv4 implementation
▪ Such nodes are referred as IPv6/IPv4 nodes
▪ has the ability to send and receive both IPv4 and IPv6 datagrams
Problem with Dual Stack Approach:
▪ Node A is IPv6-capable and wants to
send an IP datagram to Node F, which
is also IPv6-capable
▪ Node B must create an IPv4 datagram
to send to C
▪ data field of the IPv6 datagram can be
copied into the data field of the IPv4
datagram
▪ While conversion few IPv6 fields will
be lost
▪ arriving IPv4 datagram at E from D do
not contain all the fields that were in
the original IPv6 datagram sent from A
Transitioning from IPv4 to IPv6 : Tunneling
▪ Alternative to the dual-stack approach is Tunneling
▪ Basic idea
▪ Suppose two IPv6 want to interoperate using IPv6 datagrams but are connected
to each other by intervening IPv4 routers
▪ the intervening set of IPv4 routers between two IPv6 routers is a tunnel
▪ With tunneling, the IPv6 node on the sending side of the tunnel takes the entire
IPv6 datagram and puts it in the data (payload) field of an IPv4 datagram
▪ This IPv4 datagram is then addressed to the IPv6 node on the receiving side of
the tunnel
Transitioning from IPv4 to IPv6 : Tunneling
▪ Routers will be unaware that the IPv4 datagram itself contains a complete IPv6
datagram
▪ IPv6 node on the receiving side of the tunnel receives the IPv4 datagram
▪ determines that the IPv4 datagram contains an IPv6 datagram
▪ extracts the IPv6 datagram and then routes the IPv6 datagram
Transitioning from IPv4 to IPv6 : Tunneling
Routing Algorithms
▪ Forwarding function:
▪ when a packet arrives to a router, the
router indexes a forwarding table and
determines the link interface to which the
packet is to be directed
▪ Routing algorithms, operating in network
routers, exchange and compute the
information that is used to configure these
forwarding tables
▪ Routing function:
▪ determining the path, a packets takes
from sender to receiver
Routing Algorithms
▪ A host is attached directly to one router, the default router for the host also
called the first-hop router for the host
▪ the default router of the source host is the source router
▪ the default router of the destination host is the destination router
▪ Purpose of a Routing algorithm:
▪ given a set of routers with links connecting the routers, a routing algorithm finds a “good”
path from source router to destination router
▪ a good path is one that has the least cost
Routing Algorithms
▪ A graph is used to formulate routing problems
▪ Graph G = (N,E) is a set N of nodes and a collection E of edges, where each
edge is a pair of nodes from N
▪ Nodes in the graph represent routers—the points at which packet-forwarding
decisions are made
▪ Edges connecting these nodes represent the physical links between routers
Routing Algorithms
▪ Edge has a value representing its cost
▪ For any edge (x,y) in E,
▪ c(x,y) as the cost of the edge between
nodes x and y
▪ if the pair (x,y) does not belong to E, we
set c(x,y) = ∞
5
3
v w 5
2
u 2 1 z
3
1 2
x 1
y
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 (u,v)
x (u,x)
y (u,x)
w (u,x)
z (u,x)
Dijkstra’s algorithm: another example
D(v) D(w) D(x) D(y) D(z)
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
4 uwxvy 12,y
5 uwxvyz x
9
notes: 5 7
4
construct shortest path tree by
tracing predecessor nodes 8
ties can exist (can be broken 3 w y z
arbitrarily) u
2
3
7 4
v
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)
oscillations possible:
e.g., support link cost equals amount of carried traffic:
Distance Vector (DV) Routing Algorithm
▪ The distance vector (DV) algorithm is iterative, asynchronous, and distributed
▪ Distributed
▪ each node receives some information from one or more of its directly attached neighbors,
performs a calculation, and then distributes the results of its calculation back to its neighbors
▪ Iterative
▪ this process continues until no more information is exchanged between neighbors
▪ the algorithm is also self-terminating
▪ Asynchronous
▪ it does not require all of the nodes to operate in lockstep with each other.
Distance vector algorithm
let
dx(y) := cost of least-cost path from x to y
then
dx(y) = minv {c(x,v) + dv(y) }
cost from neighbor v to destination y
cost to neighbor v
5
3
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
v w 5
2
u 2 1 z B-F equation says:
3
1 2 du(z) = min { c(u,v) + dv(z),
1
x y
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 neighbor’s 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:
from
y ∞∞ ∞ y 2 0 1
from
z ∞∞ ∞ z 7 1 0
node y cost to
table x y z y
2 1
x ∞ ∞ ∞
x z
y 2 0 1 7
from
z ∞∞ ∞
node z cost to
table x y z
x ∞∞ ∞
from
y ∞∞ ∞
z 7 1 0
time
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
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
from
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
y 2 0 1 y 2 0 1 7
from
from
y 2 0 1
from
z ∞∞ ∞ z 7 1 0 z 3 1 0
y 2 0 1 y 2 0 1
from
from
y ∞∞ ∞
z 7 1 0 z 3 1 0 z 3 1 0
time
▪ In the DV algorithm
▪ a node x updates its distance-vector estimate
▪ when it either sees a cost change in one of its directly attached links or
▪ receives a distance vector update from some neighbor
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.
Distance vector: link cost changes
link cost changes: 60
node detects local link cost change y
4 1
bad news travels slow - “count to x z
infinity” problem! 50
44 iterations before algorithm
stabilizes
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?
Comparison of LS and DV algorithms
message complexity robustness: what happens if
▪ LS: with n nodes, E links, O(nE) router malfunctions?
msgs sent
LS:
▪ DV: exchange between neighbors
only ▪ node can advertise incorrect link
cost
▪ convergence time varies
▪ each node computes only its
speed of convergence
own table
▪ LS: O(n2) algorithm requires O(nE)
msgs DV:
▪ may have oscillations ▪ DV node can advertise incorrect
path cost
▪ DV: convergence time varies
▪ each node’s table used by
▪ may be routing loops others
▪ count-to-infinity problem ▪ error propagate thru network
Hierarchical routing
Our Study:
Viewed network as collection of interconnected routers
All routers execute same routing algorithm to compute routing paths
Its simplistic for 2 reasons:
forwarding table
configured by both intra-
and inter-AS routing
algorithm
intra-AS sets entries for
internal dests
inter-AS & intra-AS sets entries
for external dests
Inter-AS tasks
suppose router in AS1 AS1 must:
receives datagram
destined outside of AS1: 1. learn which dests are
reachable through
router should forward packet to
gateway router, but which one? AS2, which through
AS3
2. propagate this
reachability info to all
routers in AS1
3c
job of inter-AS routing!
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
Example: setting forwarding table in router 1d
▪ suppose AS1 learns (via inter-AS protocol) that subnet x
reachable via AS3 (gateway 1c), but not via AS2
▪ inter-AS protocol propagates reachability info to all internal routers
3c … x
3a
3b
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
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
which gateway it should forward packets towards for
dest x
▪ this is also job of inter-AS routing protocol!
3c … x …
3b
3a …
AS3 2c other
1c 2a networks
other 1a 2b
networks 1b AS2
AS1 1d
?
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!