Download as pdf or txt
Download as pdf or txt
You are on page 1of 148

Data and Computer Communications

Chapter 10 – Circuit Switching and


Packet Switching

Eighth Edition

William Stallings
Switched Network
Nodes
 a collection of nodes and connections is a
communications network
 nodes may connect to other nodes only, or to
stations and other nodes
 network is usually partially connected
 some redundant connections are desirable
 have two different switching technologies
 circuit switching
 packet switching
Circuit Switching

 uses a dedicated path between two stations


 has three phases
 establish
 transfer
 disconnect
 inefficient
 channel capacity dedicated for duration of connection
 if no data, capacity wasted
 set up (connection) takes time
 once connected, transfer is transparent
Public Circuit Switched Network
Circuit Establishment
Circuit
Switch
Elements
Packet Switching
 circuit switching was designed for voice
 packet switching was designed for data
 transmitted in small packets
 packets contains user data and control info
 user data may be part of a larger message
 control info includes routing (addressing) info
 packets are received, stored briefly (buffered) and
past on to the next node
Packet Switching
Advantages

 line efficiency
 single link shared by many packets over time
 packets queued and transmitted as fast as possible
 data rate conversion
 stations connect to local node at own speed
 nodes buffer data if required to equalize rates
 packets accepted even when network is busy
 priorities can be used
Switching Techniques
 station breaks long message into packets
 packets sent one at a time to the network
 packets can be handled in two ways
 datagram
 virtual circuit
Datagram
Diagram
Virtual
Circuit
Diagram
Virtual Circuits vs Datagram

 virtual circuits
 network can provide sequencing and error control
 packets are forwarded more quickly
 less reliable
 datagram
 no call setup phase
 more flexible
 more reliable
Circuit v Packet Switching
 performance depends on various delays
 propagation delay
 transmission time
 node delay
 range of other characteristics, including:
 transparency
 amount of overhead
Computer Networks – A Systems Approach

Chapter 4 – Internetworking

Fourth Edition

Larrie Peterson and Bruce Davie

16
Basic Internetworking (IP)
 What is internetwork
 An arbitrary collection of networks interconnected to provide some
sort of host-to-host packet delivery service

17
A Simple Internetwork

18
IP Service Model
 Packet Delivery Model
 Connectionless model for data delivery
 Best-effort delivery (unreliable service)
 packets are lost
 packets are delivered out of order
 duplicate copies of a packet are delivered
 packets can be delayed for a long time
 if something goes wrong and the packet gets lost,
corrupted, misdelivered, or in any way fails to reach its
intended destination, the network does nothing

19
Packet Format (RFC - 791)
 Version (4): currently 4
 Hlen (4): number of 32-bit words
in header
 TOS (8): type of service (not
widely used)
 Length (16): number of bytes in
this datagram
 Ident (16): used by fragmentation
 Flags/Offset (16): used by
fragmentation
 TTL (8): number of hops this
datagram has traveled
 Protocol (8): demux key (TCP=6,
UDP=17)
 Checksum (16): of the header
only
 DestAddr & SrcAddr (32)

20
Fragmentation and Reassembly
 each network technology tends to have its own idea of
how large a packet can be
 Ethernet can accept packets up to 1500 bytes long
 FDDI packets may be 4500 bytes long
 Two choices for the IP service model:
 make sure that all IP datagrams are small enough to fit inside
one packet on any network technology
 provide a means by which packets can be fragmented and
reassembled when they are too big to go over a given network
technology

21
Fragmentation and Reassembly
 Maximum Transmission Unit (MTU)
 The largest IP datagram that can be carried in a frame
 Reasonable Choice of MTU
 MTU of the network to which the host is directly attached

22
Fragmentation and Reassembly

23
Fragmentation and Reassembly

24
Cisco Certified Network Associate

IP Addressing

CCNA (Exam Code: 640-801)

Todd Lammle

25
IP Address
 A unique identifier assigned to each machine on an IP
network
 Designates the specific location of a device on a network
 A software address

26
IP Address MAC Address
 Allows a host on one  Used for finding hosts on
network to communicate a local network
with a host on other
network
 3rd layer address  2nd layer address
 Software address  Hardware address
 Geographical  Non-geographical
 Hierarchical  Flat

27
Terminologies
 Network Address
 Uniquely identifies each network
 Each machine on the same network shares that network
address as part of its IP address
 E.g. in 172.16.30.56, 172.16 is the network address
 Node / Host Address
 Uniquely identifies each machine on a network
 Each machine on the same network has a unique host address
 E.g. in 172.16.30.56, 30.56 is the host address

28
Classes of IP Addresses
 Class A:
 Format
 Network.Host.Host.Host
 Range:
 0xxx xxxx
 From:
 0000 0000 – 0111 1111
 0 -127
 Number of networks
 27 = 128
 Number of hosts
 224 -2 = 16,777,216 – 2 = 16,777,214 (All 0’s and all 1’s reserved)
 Valid Host ID’s:
 Network Address: 10.0.0.0
 Broadcast Address: 10.255.255.255
 Valid Hosts: 10.0.0.1 – 10.255.255.254

29
Classes of IP Addresses
 Class B:
 Format
 Network.Network.Host.Host
 Range:
 10xx xxxx
 From:
 1000 0000 – 1011 1111
 128 -191
 Number of networks
 214 = 16,384
 Number of hosts
 216 -2 = 65536 – 2 = 65534 (All 0’s and all 1’s reserved)
 Valid Host ID’s:
 Network Address: 172.16.0.0
 Broadcast Address:172.16.255.255
 Valid Hosts: 172.16.0.1 – 172.16.255.254

30
Classes of IP Addresses
 Class C:
 Format
 Network.Network.Network.Host
 Range:
 110x xxxx
 From:
 1100 0000 – 1101 1111
 192 - 223
 Number of networks
 221 = 2,097,152
 Number of hosts
 28 -2 = 256 – 2 = 254 (All 0’s and all 1’s reserved)
 Valid Host ID’s:
 Network Address: 192.168.100.0
 Broadcast Address: 192.168.100.255
 Valid Hosts: 192.168.100.1 – 192.168.100.254

31
Classes of IP Addresses
 Class D:
 Range
 224 – 239
 Purpose
 Multicast

 Class E:
 Range
 240 – 255
 Purpose
 Scientific

32
Private IP Addresses
 Used on a private work
 Not routable through the internet
 Advantages:
 Security
 Saves address space
 Network Address Translation (NAT)
 Takes a private IP address and converts it for use on the
Internet
 Reserved Private Addresses
 Class A: 10.0.0.0 - 10.255.255.255
 Class B: 172.16.0.0 – 172.31.255.255
 Class C: 192.168.0.0 – 192.168.255.255

33
Broadcast Address
 Layer 2 broadcasts
 Sent to all nodes on a LAN
 Broadcast (layer 3)
 Sent to all nodes on the network
 Unicast
 Sent to a single destination host
 Multicast
 Packets sent from a single host and transmitted to many
devices on different networks

34
Flavors of NAT
 Static NAT
 Allows one-to-one mapping between local and global address
 Dynamic NAT
 Maps an unregistered IP address to a registered IP address
from out of a pool of IP registered addresses
 Overloading
 Most popular type
 Maps multiple unregistered addresses to a single registered IP
address (many-to-one)

35
Subnet Mask
 Allows the machine to distinguish the network portion
and host portion of the IP address.
 Subnet Masks of Classes:
 Class A: 255.0.0.0
 Class B: 255.255.0.0
 Class C: 255.255.255.0

36
Subnetting: Example 1C:
 Subnet the following IP: 192.168.10.0/26
 Network address: 192.168.10.0
 Subnet Mask: 255.255.255.192
 No. of subnets
 22 = 4 = 4 subnets
 No. of hosts
 26-2 = 62 hosts
 Valid subnets
 256-192 = 64, 192.168.10.0/ 64/ 128/ 192
 Broadcast address for each subnet?
 Valid hosts for each subnet?
37
Subnetting: Example 1C cont …
 Subnets 0 64 128 192
 1st host 1 65 129 193
 Last host 62 126 190 254
 Broadcast 63 127 191 255

38
Subnetting: Example 1B:
 Subnet the following IP: 172.16.0.0/18
 Network address: 172.16.0.0
 Subnet Mask: 255.255.192.0
 No. of subnets
 22 = 4 = 4 subnets
 No. of hosts
 214-2 = 16382 hosts
 Valid subnets
 256-192 = 64, 172.16.0.0 / 64.0 / 128.0 / 192.0
 Broadcast address for each subnet?
 Valid hosts for each subnet?
39
Subnetting: Example 1B cont …
 Subnets 0.0 64.0 128.0 192.0
 1st host 0.1 64.1 128.1 192.1
 Last host 63.254 127.254 191.254 255.254
 Broadcast 63.255 127.255 191.255 255.255

40
Subnetting: Example 1A:
 Subnet the following IP: 10.0.0.0/16
 Network address: 10.0.0.0
 Subnet Mask: 255.255.0.0
 No. of subnets
 28 = 256 subnets
 No. of hosts
 216-2 = 65534 hosts
 Valid subnets
 256-255 = 1, 10.0.0.0 / 1.0.0 / 2.0.0 / 3.0.0, etc. up to 255.0.0
 Broadcast address for each subnet?
 Valid hosts for each subnet?
41
Subnetting: Example 1A cont …
 First two subnets:
 Subnets 10.0.0.0 10.1.0.0 …
 1st host 10.0.0.1 10.1.0.1 …
 Last host 10.0.255.254 10.1.255.254 …
 Broadcast 10.0.255.255 10.1.255.255 …

 Last two subnets:


 Subnets 10.254.0.0 10.255.0.0
 1st host 10.254.0.1 10.255.0.1
 Last host 10.254.255.254 10.255.255.254
 Broadcast 10.254.255.255 10.255.255.255

42
CIDR (Supernetting)
 Subnetting allows us to split a classful address among multiple
subnets, while CIDR allows us to coalesce several classful
addresses into one “supernet”
 This is the method used by ISPs to advertise addresses
 Suppose we assign the class C network numbers from 192.4.16
through 192.4.31
 Observe that the top 20 bits of all the addresses in this range are the
same (11000000 00000100 0001)
 This is advertised by the ISP (or AS) as 192.4.16/20
 20 represents the number of similar bits in this address range

192.4.16
Advertised as ISP
192.4.16/20
192.4.31
43 Engr. Taufeeq Liaquat
IP Addressing Ends
 Back to Chapter 4

44
Address Resolution Protocol (ARP)
 Whenever a datagram is to be sent to a host or router
on the same network, we need to translate the IP address
of the destination to a link-level address
 Techniques
 map physical address in host part of IP address
 E.g. a host with physical address 00100001 01010001 can be
allotted the IP address 128.96.33.81
 table-based
 Table could be managed by a system administrator and then
copied to each host on the network
 each host can dynamically learn the contents of the table using the
network (accomplished by ARP)

45
ARP (RFC - 826)
 Enables each host on a network to build up a table of mappings
between IP addresses and link-level addresses
 the entries are timed out periodically and removed on the order of
every 15 minutes since these mappings may change over time
 E.g. Ethernet card at host is replaced
 set of mappings currently stored in a host is known as the ARP cache
or ARP table
 If a host wants to send an IP datagram to a host (or router) that it
knows to be on the same network
 it first checks for a mapping in the cache
 If no mapping is found, broadcasts an ARP query onto the network
 query contains the IP address in question (the “target IP address”)
 Each host receives the query and checks to see if it matches its IP address
 If it does match, the host sends a response message that contains its link-layer
address back to the originator of the query
 originator adds the information contained in this response to its ARP table.

46
ARP Packet Format
 HardwareType: specifies the type
of physical network (e.g. Ethernet)
 ProtocolType field: specifies the
higher-layer protocol (e.g. IP)
 HLen (“hardware” address length):
specifies the length of the link-
layer address
 PLen (“protocol” address length):
specifies the length of the higher-
layer protocol address
 Operation: specifies whether this
is a request or a response
 the source and target hardware
(Ethernet) and protocol (IP)
addresses

47
Host Configuration (DHCP – RFC 2131)
 Ethernet addresses are configured into network by
manufacturer and they are unique
 IP addresses must be unique on a given internetwork but also
must reflect the structure of the internetwork
 Most host Operating Systems provide a way to manually
configure the IP information for the host
 Drawbacks of manual configuration
 A lot of work to configure all the hosts in a large network
 Configuration process is error-prone
 Automated Configuration Process is required

48
DHCP
 DHCP Server
 DHCP server is responsible for providing configuration information
to hosts
 There is at least one DHCP server for an administrative domain
 DHCP server maintains a pool of available addresses that it hands
out to hosts on demand

 DHCP Relay Agent


 DHCP servers require configuration so it is not desirable to have
them in every network – Use a DHCP relay agent instead

49
DHCP

 Newly booted or attached host sends


DHCPDISCOVER message to a
special IP address (255.255.255.255)
 DHCP relay agent unicasts the
message to DHCP server and waits
for the response

50
DHCP Packet Format
 Operation (1): 1 = BOOTREQUEST, 2 =
BOOTREPLY
 Htype (1): Hardware address type (e.g. 1 =
10mb Ethernet)
 Hlen (1): Hardware address length (e.g. 6 for
10mb Ethernet)
 Hops (1): Client sets to zero, optionally used
by relay agents when booting via a relay agent.
 xid (4): Transaction ID, a random number
chosen by the client, used by the client and
server to associate messages and responses
between a client and a server.
 secs (2): Filled in by client, seconds elapsed
since client began address acquisition or
renewal process.

51
DHCP Packet Format
 ciaddr (4) Client IP address; only filled in if
client is in BOUND, RENEW or REBINDING
state and can respond to ARP requests.
 yiaddr (4): 'your' (client) IP address.
 siaddr (4): IP address of next server to use in
bootstrap; returned in DHCPOFFER,
DHCPACK by server.
 giaddr (4): Relay agent IP address, used in
booting via a relay agent
 chaddr (16): Client hardware address.
 sname (64): Optional server host name, null
terminated string.
 file (128): Boot file name, null terminated string;
"generic" name or null in DHCPDISCOVER,
fully qualified directory-path name in
DHCPOFFER.
 options (var): Optional parameters field.
52
Error Reporting (ICMP)
 defines a collection of error messages that are sent back to the
source host whenever a router or host is unable to process an IP
datagram successfully
 ICMP Messages
 0 - Echo Reply
 3 - Destination Unreachable
 4 - Source Quench
 5 - Redirect
 8 - Echo
 11 - Time Exceeded
 12 - Parameter Problem
 13 - Timestamp
 14 - Timestamp Reply
 15 - Information Request
 16 - Information Reply

53
ICMP Message Formats

54
ICMP Redirect (Example of Control Message)
 Used in the following situation:
 When a router R1 receives a datagram from a router R and it knows
based on its forwarding table that R2 is a better choice for a
particular destination
 R1 sends an ICMP Redirect back to the router R
 ICMP Redirect instructs the router R to use R2 for datagrams
intended for that specific destination
 Router R adds a new route to its forwarding table

R1

R2

55
Virtual Networks and Tunnels
 Usually, different networks want to reach other networks
in a restricted way.
 However, there are many situations where more
controlled connectivity is required
 An important example of such a situation is the virtual
private network (VPN)

56
Virtual Networks and Tunnels
 Intuitively, VPN can be defined by considering first the
idea of a private network
 Corporations with many sites often build private networks by
leasing transmission lines from the phone companies and using
those lines to interconnect sites
 In such a network, communication is restricted to take place
only among the sites of that corporation, which is often
desirable for security reasons
 To make a private network virtual, the leased transmission lines
are replaced by some sort of shared network
 A virtual circuit (VC) is a very reasonable replacement for a
leased line because it still provides a logical point-to-point
connection between the corporation’s sites
57
Virtual Networks and Tunnels
 For example, if corporation X has a VC from site A to site B,
then clearly it can send packets between sites A and B
 But there is no way that corporation Y can get its packets
delivered to site B without first establishing its own virtual
circuit to site B
 The establishment of such a VC can be administratively
prevented, thus preventing unwanted connectivity between
corporation X and corporation Y

58
Virtual Networks and Tunnels

(a) two separate private networks (b) two virtual private networks sharing common switches

59
Virtual Networks and Tunnels
 A VC network (using Frame Relay or ATM, for example) is
used to provide the controlled connectivity among sites
 It is also possible to provide a similar function using an IP
network to provide connectivity
 We cannot just connect the various corporations’ sites to a
single internetwork because that would provide connectivity
between corporation X and corporation Y, which we wish to
avoid
 To solve this problem, we need to introduce a new concept,
the IP tunnel

60
IP Tunneling
 A virtual point-to-point link between a pair of nodes that
are actually separated by an arbitrary number of
networks
 The virtual link is created within the router at the entrance to
the tunnel by providing it with the IP address of the router at
the far end of the tunnel
 Whenever the router at the entrance of the tunnel wants to
send a packet over this virtual link, it encapsulates the packet
inside an IP datagram
 The destination address in the IP header
 Address of the router at the far end of the tunnel
 The source address in the IP header
 Address of the encapsulating router

61
IP Tunneling
 In the forwarding table of the router
 The virtual link looks like a normal link
 Consider the network in the figure on the next slide
 A tunnel has been configured from R1 to R2 and assigned a virtual
interface number of 0
 The consequent forwarding table in R1 is also shown
 R1 has two physical interfaces
 Interface 0 connects to network 1
 Interface 1 connects to larger internetwork
 Thus it is the default route for all traffic that doesn’t match something
more specific in the forwarding table
 R1 has a virtual interface
 Interface to the tunnel

62
IP Tunneling

63
IP Tunneling
 Suppose R1 receives a packet from network 1 that
contains an address in network 2
 The forwarding table says this packet should be sent out virtual
interface 0
 To send a packet out this interface, the router takes the packet, adds
an IP header addressed to R2, and then proceeds to forward the
packet as if it had just been received. R2’s address is 18.5.0.1
 Since the network number of this address is 18, not 1 or 2, a packet
destined for R2 will be forwarded out the default interface into the
internetwork
 Once the packet leaves R1, it looks to the rest of the world like a
normal IP packet destined to R2, and it is forwarded accordingly
 All the routers in the internetwork forward it using normal means,
until it arrives at R2

64
IP Tunneling
 When R2 receives the packet, it finds that it carries its own
address, so it removes the IP header and looks at the payload
of the packet
 R2 finds an inner IP packet whose destination address is in network 2
 R2 now processes this packet like any other IP packet it receives
 Since R2 is directly connected to network 2, it forwards the packet on
to that network
 While R2 is acting as the endpoint of the tunnel, there is nothing to
prevent it from performing the normal functions of a router
 It might receive some packets that are not tunneled, but that are addressed
to networks that it knows how to reach, and it would forward them in the
normal way

65
IP Tunneling
 Advantages
 Security
 Supplemented with encryption, a tunnel can become a very private
sort of link across a public network
 Multicast Routing
 R1 and R2 may have some capabilities that are not widely available in
the intervening networks, such as multicast routing
 Mbone (multicast backbone) is built in this way
 Processing non-IP packets
 Routers capable of handling non-IP packets may carry them in an IP
network through tunnels

66
IP Tunneling
 Disadvantages
 Increase in packet length
 Significant waste of bandwidth for short packets
 More chances of fragmentation which has its own drawbacks
 Router Performance
 Excess processing of routers involved in tunneling may affect their
performance
 Management Cost
 Price to pay by the administrative entity that sets up tunnels

67
Routing
 Forwarding versus Routing
 Forwarding
 to select an output port based on destination address and routing table
 Routing
 process by which routing table is built

 Forwarding table VS Routing table


 Forwarding table
 Used when a packet is being forwarded and so must contain enough
information to accomplish the forwarding function
 A row in the forwarding table contains the mapping from a network number
to an outgoing interface and some MAC information, such as Ethernet
Address of the next hop
 Routing table
 Built by the routing algorithm as a precursor to build the forwarding table
 Generally contains mapping from network numbers to next hops

68
Routing Table / Forwarding Table

69
Routing Protocols

Routing

Static Dynamic
Routing Routing

Intradomain Interdomain
(IGP) (EGP)

Distance Link
Vector Hybrid BGP
State

RIP IGRP OSPF EIGRP

70
Network as a Graph

 The basic problem of routing is to find the lowest-


cost path between any two nodes
 Where the cost of a path equals the sum of the costs
of all the edges that make up the path

71
Network as a Graph
 For a simple network, we can calculate all shortest paths and
load them into some nonvolatile storage on each node.
 Such a static approach has several shortcomings
 It does not deal with node or link failures
 It does not consider the addition of new nodes or links
 It implies that edge costs cannot change

 What is the solution?


 Need a distributed and dynamic protocol
 Two main classes of protocols
 Distance Vector
 Link State

72
Distance Vector
 Also known as Bellman-Ford Algorithm
 Each node constructs a one dimensional array (a vector)
containing the “distances” (costs) to all other nodes and
distributes that vector to its immediate neighbors
 Starting assumption is that each node knows the cost of the
link to each of its directly connected neighbors

73
Distance Vector

Initial distances stored at each node (global view)

74
Distance Vector

Initial routing table at node A


75
Distance Vector

Final routing table at node A


76
Distance Vector

Final distances stored at each node (global view)


77
Distance Vector
 Convergence
 The process of getting consistent routing information to all the
nodes
 Two different circumstances under which a given node decides
to send a routing update to its neighbors
 Periodic Update
 each node automatically sends an update message after some time
 serves to let the other nodes know that this node is still running
 frequency of these periodic updates varies from protocol to protocol
 Triggered Update
 node receives an update from one of its neighbors that causes it to change
one of the routes in its routing table

78
Distance Vector
 When a node detects a link failure
 F detects that link to G has failed
 F sets distance to G to infinity and sends update to A
 A sets distance to G to infinity since it uses F to reach G
 A receives periodic update from C with 2-hop path to G
 A sets distance to G to 3 and sends update to F
 F decides it can reach G in 4 hops via A

79
Count-to-infinity Problem
 Slightly different circumstances can prevent the network from
stabilizing
 Suppose the link from A to E goes down
 In the next round of updates, A advertises a distance of infinity to E,
but B advertises a distance of 2 to E
 Node A, upon hearing that E can be reached in 2 hops from B,
concludes that it can reach E in 3 hops and advertises this to B
 Node B concludes that it can reach E in 4 hops and advertises this
back to A and so on
 This cycle stops only when the distances reach some number that is
large enough to be considered infinite
 Count-to-Infinity Problem

80
Count-to-infinity Problem
 Use some relatively small number as an approximation of
infinity
 For example, the maximum number of hops to get across a certain
network is never going to be more than 16
 Split horizon
 When a node sends a routing update to its neighbors, it does not
send those routes it learned from each neighbor back to that
neighbor
 For example, if B has the route (E, 2, A) in its table, then it knows it
must have learned this route from A, and so whenever B sends a
routing update to A, it does not include the route (E, 2) in that
update
 Split horizon with poison reverse
 B actually sends that route back to A, but it puts negative information
in the route to ensure that A will not eventually use B to get to E
 For example, B sends the route (E, ∞) to A

81
RIPv1
 Features
 straightforward implementation of distance-vector routing
 Routers running RIP send their advertisements every 30 seconds
 router also sends an update message whenever an update from another router
causes it to change its routing table
 RIP takes the simplest approach, with all link costs being equal to 1
 always tries to find the minimum hop route
 Valid distances are 1 through 15, with 16 representing infinity
 limits RIP to running on fairly small networks—those with no paths longer than 15
hops
 supports multiple address families, not just IP
 network-address part of the advertisements is actually represented as a (family,
address) pair
 Versions
 RIPv1
 RIPv2

82
RIPv1 Packet Format

83
RIPv2 Packet Format
 Route Tags (2): Used for external RIP
routes (routes imported from the RIP
domain through EGP)
 Mask (4): subnet mask (to support
classless addressing)
 Next Hop (4): The immediate next hop
IP address to which packets to the
destination specified by this route entry
should be forwarded

84
Link State
 Assumptions
 Each node knows
 State of the links to its neighbors
 Cost of the links to it neighbors
 Mechanisms in Link State Routing
 Reliable dissemination of link-state information
 Achieved through reliable flooding
 calculation of routes from the sum of all the accumulated link-state
knowledge
 Dijkstra’s Algorithm

85
Link State
 Link-State Packet (LSP)
 the ID of the node that created the LSP
 a list of directly connected neighbors of that node, with the
cost of the link to each one
 a sequence number
 a time to live for this packet

 first two items are needed to enable route calculation


 last two are used to make the process of flooding the
packet to all nodes reliable

86
Link State
 Reliable Flooding
 store most recent LSP from each node
 forward LSP to all nodes but one that sent it
 generate new LSP periodically; increment SEQNO
 start SEQNO at 0 when reboot
 decrement TTL of each stored LSP; discard when TTL=0

87
Link State
 Updates
 Periodic Update
 Same as Distance Vector
 Triggered Update
 Sent only when the link state changes

 Loss of neighbor is detected by periodic ‘hello’ packets


 If a sufficiently long time passes without receipt of a “hello” from a
neighbor, the link to that neighbor will be declared down, and a new
LSP will be generated to reflect this fact

88
Link State
 Route Calculation
 how a node calculates routes from the information obtained from
LSPs?
 Dijkstra’s Shortest Path Algorithm (A well-known algorithm from
graph theory)

89
Dijkstra’s Algorithm
 SPT = {a}
 for all nodes v
 if v adjacent to a, then D(v) = cost (a, v)
 else D(v) = infinity
 Loop
 find w not in SPT, where D(w) is min
 add w in SPT
 for all v adjacent to w and not in SPT
 D(v) = min (D(v), D(w) + C(w, v))
 until all nodes are in SPT

90
Dijkstra’s Algorithm

91
OSPF
 Open
 open, nonproprietary standard created by IETF
 SPF
 alternative name for link state routing

92
OSPF Features
 Authentication of routing messages
 Some misconfigured host may decide that it can reach every host in
the universe at a cost of 0
 Every router in the surrounding neighborhood updates its
forwarding tables to point to that host
 Host receives a vast amount of data that, in reality, it has no idea
what to do with
 Such disasters can be averted in many cases by requiring routing
updates to be authenticated
 Early versions of OSPF used a simple 8-byte password for
authentication
 Not a strong enough form of authentication to prevent dedicated
malicious users
 But alleviates many problems caused by misconfiguration

93
OSPF Features
 Additional hierarchy
 OSPF introduces another layer of hierarchy
 Allows a domain to be partitioned into areas
 router within a domain does not necessarily need to know how to
reach every network within that domain
 Sufficient to know only how to get to the right area
 reduction in the amount of information that must be transmitted to
and stored in each node
 Load Balancing
 OSPF allows multiple routes to the same place to be assigned the
same cost
 will cause traffic to be distributed evenly over those routes

94
Routing Areas
 Area
 set of routers that are administratively configured to exchange link
state information with each other
 Advantage
 Makes OSPF scalable
 Backbone Area
 At least one router in all non-backbone areas must also be
connected to a special area – known as the backbone area or area 0
 Area Border Router (ABR)
 router that is a member of both the backbone area and a non-
backbone area is an area border router (ABR)

95
Routing Areas

96
OSPF Header Format
 Version (8): currently set to 2
 Type (8): may have values from 1-5
 1: hello packet
 2 Database Description
 3: Link State Request
 4: Link State Update
 5: Link State Ack
 SourceAddr (32): identifies
sender
 AreaID (32): identifies area in
which node is located
 Checksum (16): same as IP. Not
implemented on authentication
 Authentication type (16):
 0: no authentication
 1: simple password
 2: cryptographic checksum

97
OSPF Link-State Advertisement
 LS Age (16): same as TTL except that
it counts up and expires at maximum
value
 Type (8):
 Type 1: Advertise cost of link between
routers
 Type 2: Advertise networks to which
the advertising router is connected
 Other Types: support additional
hierarchy
 Link State ID (32): same as
Advertising router in type 1. Identifies
router that generates LSP
 LS Sequence Number (32): detects
old and duplicate LSA
 LS Checksum (16): same as IP. Not
implemented on LS age
 Length (16): Length in bytes of
complete LSA

98
OSPF Link-State Advertisement
 Link ID(32): ID of router at far end
 Link Data (32): differentiate between
parallel links
 Metric (16): cost of the link
 Link Type (8): length in bytes of the
complete LSA
 TOS (8):
 Allows OSPF to choose different routes
for different types of traffic
 Instead of assigning a single metric to a
link, it is possible to assign different
metrics depending on the TOS value of
the data
 if a link in our network is good for delay-
sensitive traffic, we can give it a low
metric for the TOS value representing low
delay and a high metric for everything
else.
 OSPF would then pick a different shortest
path for those packets that had their TOS
field set to that value

99
Metrics
 Preceding discussion assumes that link costs, or metrics, are
known when we execute the routing algorithm
 Now, we look at some ways to calculate link costs that have
proven effective in practice
 One Example already seen
 assign a cost of 1 to all links—the least-cost route will then be the
one with the fewest hops
 Drawbacks of the approach from different perspectives
 Latency perspective
 Capacity perspective
 Load perspective

100
Metrics
 Drawbacks
 Latency perspective
 a satellite link with 250-ms latency looks just as attractive to the routing
protocol as a terrestrial link with 1-ms latency
 Capacity perspective
 a 9.6-Kbps link look just as good as a 45-Mbps link
 Load perspective
 it impossible to route around overloaded links
 this last problem is the hardest because you are trying to capture the
complex and dynamic characteristics of a link in a single scalar cost

101
Metrics
 ARPANET was the testing ground for a number of different
approaches to link-cost calculation
 ARPANET (original) used Queue Length as a metric
 Problem with the approach
 Algorithm moves packets towards the shortest queue rather than toward the
destination
 ARPANET (second version) used Bandwidth, Latency and
Delay as a metric
 Delay was computed by the following relation
 Delay = (DepartTime - ArrivalTime) + TransmissionTime + Latency
 DepartTime: Departure time from router
 ArrivalTime:Arrival Time at router
 TransmissionTime:Time taken for the packet to be placed on the link
 Latency (Propagation Time):Time taken to traverse the link

102
Metrics
 DepartureTime – ArrivalTime:
 Time the packet was delayed in the node due to load
 Measures the reliability of the link
 More the difference, more the delay at the node, the more the chance for the
packet to get timed out and consequently, discarded
 Cost Assignment
 Derived from the average delay experienced by the packet recently sent over
the network
 Problem with the approach
 Under Light Load:
 Worked excellent under light load because two static factors of delay dominate the cost
 Under Heavy Load:
 Congested link advertises a high cost which causes traffic to move towards low cost links
 Causes all traffic to move off the link making the link idle
 The idle link then invites all traffic by advertising a low cost
 Most links spend most of the time being idle
103
Metrics
 Another Problem
 Range of link values was too large
 Heavily loaded 9.6 Kbps link could look 127 times costlier than lightly loaded
56 Kbps link
 Routing algorithm will choose 126 hops of 56 Kbps links as compared to a 1-
hop 9.6 Kbps link
 ARPANET (Third Approach)
 Called the “Revised ARPANET routing metric”
 Addressed the problems
 Major changes in this approach
 To compress the dynamic range of the metric considerably
 To account for the link type
 To smooth the variation of the metric with time

104
Metrics
 Smoothing Mechanisms
 First
 Delay measurement was transformed to a link utilization
 Current utilization is averaged with the last reported utilization to suppress sudden
changes
 Second
 There was a hard limit on how much a metric could change from one measurement cycle
to the next
 By smoothing the changes in the cost, the likelihood that all nodes would abandon a route
at once is greatly reduced.

105
Metrics
 The compression of the dynamic range was achieved by
feeding the measured utilization, the link type, and the link
speed into a function that is shown graphically

106
Metrics
 Observe the following
 A highly loaded link never shows a cost of more than three times its
cost when idle
 The most expensive link is only seven times the cost of the least
expensive
 A high-speed satellite link is more attractive than a low-speed
terrestrial link
 Cost is a function of link utilization only at moderate to high loads

107
Interdomain Routing (BGP)
 Autonomous Systems (AS)  BGP Speakers
 Intradomain and Interdomain  Border Gateways
 Routing Policies  Diagram 2
 EGP  Preventing loops
 BGP-4  Unique AS numbers
 BGP Assumption  Implementing Policy
 Diagram 1  Route Cancellation
 Traffic Types  BGP/TCP
 AS Types  Keep alive message
 Three Challenges in  How does all this help to
Interdomain Routing build a scalable network?

108
Interdomain Routing (BGP)
 Autonomous Systems
 Systems under the control of a single administrative entity
 Intradomain and Interdomain
 Within an AS / between ASs
 Routing Policies
 Each AS must determine its own policies
 Example of a routing policy
 I’ll send traffic via AS X than AS Y to connect my AS to the rest of the
Internet
 I’ll use AS Y if it is the only path
 I never want to carry traffic from AS X to AS Y and vice versa
 Each AS must be able to implement its own policy without any help
from other ASs

109
Interdomain Routing (BGP)
 EGP
 The previous interdomain routing protocol
 Forced a tree-like topology
 Single backbone and ASs connected as parents and children, not as peers
 BGP-4
 Replacement of EGP
 BGP Assumption
 Assumes that the Internet is an arbitrarily interconnected set of ASs

110
Interdomain Routing (BGP)
 Diagram 1

 Traffic Types
 Local
 Originate and terminates at the nodes
 Transit
 Passes through an AS

111
Interdomain Routing (BGP)
 AS Types
 Stub AS
 an AS that has only a single connection to one other AS; such an AS will only
carry local traffic
 E.g. Small corporation in diagram 1
 Multihomed AS
 an AS that has connections to more than one other AS but that refuses to
carry transit traffic
 E.g. Large corporation at the top of diagram 1
 Transit AS
 an AS that has connections to more than one other AS and that is designed to
carry both transit and local traffic
 E.g. the backbone providers in diagram 1

112
Interdomain Routing (BGP)
 Three Challenges in Interdomain Routing – Challenge 1
 Internet backbone router must be able to forward any packet
destined anywhere in the Internet
 That means having a routing table that will provide a match for
any valid IP address
 CIDR has helped to control the number of distinct prefixes

113
Interdomain Routing (BGP)
 Three Challenges in Interdomain Routing – Challenge 2
 arises from the autonomous nature of the domains
 each domain may run its own interior routing protocols and
use any scheme it chooses to assign metrics
 Impossible to calculate meaningful path costs for a path that
crosses multiple ASs
 interdomain routing advertises only “reachability”
 you can reach this network through this AS
 for interdomain routing to pick an optimal path is essentially
impossible

114
Interdomain Routing (BGP)
 Three Challenges in Interdomain Routing – Challenge 3
 the issue of trust
 Provider A might be unwilling to believe certain advertisements
from provider B for fear that provider B will advertise
erroneous routing information

115
Interdomain Routing (BGP)
 BGP Speakers
 spokesperson for the entire AS
 establishes BGP sessions to other BGP speakers in other ASs
 Sessions are used to exchange reachability information among
ASs
 Border Gateways
 AS has one or more border gateways
 need not be the same as the speakers
 packets enter and leave the AS through border gateways

116
Interdomain Routing (BGP)
 Diagram 2

117
Interdomain Routing (BGP)
 Preventing loops
 Consider three interconnected ASs, 1, 2, and 3
 Suppose AS 1 learns that it can reach network 10.0.1 through AS 2
 it advertises this fact to AS 3, who in turn advertises it back to AS 2
 AS 2 could now decide that AS 3 was the place to send packets destined for
10.0.1
 AS 3 sends them to AS 1; AS 1 sends them back to AS 2; and they would loop
forever
 This is prevented by carrying the complete AS path in the routing
messages
 the advertisement received by AS 2 from AS 3 would contain an AS path of AS
3, AS 1, AS 2
 AS 2 sees itself in this path, and thus concludes that this is not a useful path
for it to use

118
Interdomain Routing (BGP)
 Unique AS numbers
 AS numbers carried in BGP need to be unique
 AS numbers are 16-bit numbers assigned by a central authority to
assure uniqueness
 stub ASs do not need a unique AS numbers
 Implementing Policy
 AS will only advertise routes that it considers good enough for itself
 BGP speaker is under no obligation to advertise any route to a
destination, even if it has one
 Route Cancellation
 Previously advertised paths can be cancelled by a negative
advertisement known as withdrawn route

119
Interdomain Routing (BGP)
 BGP/TCP
 BGP is defined to run on top of TCP
 Since TCP is reliable, any info sent from one speaker to another need not be
sent again
 Keep alive message
 In case nothing changes, BGP speaker can simply send an occasional “keep
alive” message
 means,“I’m still here and nothing has changed.”
 How does all this help to build a scalable network?
 Firstly, the number of nodes participating in BGP is on the order of the
number of ASs, which is much smaller than the number of networks
 Secondly, finding a good interdomain route is only a matter of finding a path
to the right border router
 The complexity of interdomain routing is now on the order of the number
of ASs, and the complexity of intradomain routing is on the order of the
number of networks in a single AS.
120
Integrating Interdomain and Intradomain
Routing
 We have learnt how BGP speakers learn the information
 Let us see how other routers learn the routes
 CASE 1 (Stub AS)
 How a router in an AS would react to a packet destined for a node
not in its routing table? (How to get out of the AS?)
 Any network that has not been explicitly advertised in the
intradomain routing protocol is reached through border router (by
using a default route)
 CASE 2
 How the border routers inject specific routes that they have learned
from outside the AS? (How to get in the AS?)
 E.g. The border router of a provider AS learns about a network
prefix 192.4.54/24 inside the customer AS that it is connected to
 The border router could inject a route to that prefix into the
routing protocol running inside the provider AS
 “I have a link to 192.4.54/24 of cost X”
121
Integrating Interdomain and Intradomain
Routing
 CASE 3 (Backbone AS)
 backbone networks learn so much routing information from BGP
that it becomes too costly to inject it into the intradomain protocol
 the routers in a backbone network use a variant of BGP called
interior BGP (IBGP)
 At the same time, each router in the AS keeps track of how to get to
each border router using a conventional intradomain protocol with
no injected information

122
Integrating Interdomain and Intradomain
Routing

All routers run iBGP and an intradomain


BGP routing table, IGP routing table, and
routing protocol. Border routers (A, D, E) also
combined table at router B
run eBGP to other ASs
123
IPv6 Packet Format
 Version: 6
 Traffic Class & Flow Label: relate to QoS
 Payload Length: Length of data in bytes
(including the Next Header if used and
excluding the main header)
 Next Header: Used to represent the use
of options (in case they are used) and also
represents higher layer protocol (replaces
options and protocol in IPv4)
 Hop limit: Same as TTL in IPv4
 Source Address: 128 bits
 Destinations Address: 128 bits

Example of an IPv6 address:


 47CD:1234:4422:AC02:0022:1234:A456:0
124

124
Computer Networks – A Systems Approach

Chapter 5 – End-to-End Protocols

Fourth Edition

Larrie Peterson and Bruce Davie

125 Engr. Taufeeq Liaquat


End-to-End Protocols
 Common properties that a Transport protocol is
expected to exhibit
 Guarantees message delivery
 Delivers messages in the same order in which they are sent
 Delivers at least one copy of each message
 Supports arbitrary large messages
 Supports synchronization between sender and receiver
 Allows the receiver to apply flow control to the sender
 Support of multiple application processes on each host
 Independence of underlying physical network

126 Engr. Taufeeq Liaquat


End-to-End Protocols
 Limitation of lower level Networks
 Drop messages
 Reorder messages
 Deliver duplicate copies of messages
 Limit messages to some finite size
 Deliver messages after an arbitrarily long delay

127 Engr. Taufeeq Liaquat


End-to-End Protocols
 Challenge for Transport Protocols
 Develop algorithms that turn the less-than-desirable properties of
the underlying network into the high level of service required by
application programs

128 Engr. Taufeeq Liaquat


Simple Demultiplexer (UDP) (RFC-768)
 Simplest possible transport protocol
 Demultiplexer
 Processes indirectly identify each other using an abstract
locator, often called a port or mailbox
 A single OS runs in the distributed system on all hosts and
assigns each process a unique id
 The basic idea is for a source process to send a message to a
port and for the destination process to receive the message
from a port

129 Engr. Taufeeq Liaquat


Packet Format
 Source Port (16 bits)
 identifies the source port
 Destination Port (16 bits)
 identifies the destination port
 Length (16 bits)
 length in bytes (header+data)
 Checksum (16 bits)
 Same as IP
 Data
 From the Application Layer

Process recognized by the


port-host pair

130 Engr. Taufeeq Liaquat


How a process learns the port of the
destination process?
 Client process sends a message to the server process
 Server knows the client’s port (it was contained in the
message header) and can reply to it
 How the client learns the server’s port in the first place?
 common approach for the server to accept messages at a well-
known port
 Example
 mail service listens for messages at port 25
 Port Mapper
 alternative strategy
 Client sends a message to the Port Mapper’s well-known port asking
for the port it should use to talk to the “whatever” service
 the Port Mapper returns the appropriate port

131 Engr. Taufeeq Liaquat


Pseudoheader
 A pseudoheader is attached with the UDP header
 pseudoheader consists of three fields from the IP header
 Protocol number
 Source IP address
 Destination IP address
 Plus the UDP length field (Length used twice)
 UDP computes checksum over
 UDP header
 Contents of the message body
 Pseudoheader
 Checksum is optional in IPv4 and mandatory in IPv6

132 Engr. Taufeeq Liaquat


Pseudoheader

IP Source Address
IP Destination Address
0 protocol TCP/UDP length
TCP/UDP Header (Variable)
TCP/UDP DATA (Variable)

133 Engr. Taufeeq Liaquat


UDP Message Queue

134 Engr. Taufeeq Liaquat


Reliable Byte Stream (TCP)
 Basic Properties
 Offers a reliable, connection-oriented, byte-stream service
 Frees the application from having to worry about missing or
reordered data
 TCP guarantees the reliable, in-order delivery of a stream of bytes
 Includes a flow-control mechanism
 TCP supports a demultiplexing mechanism

135 Engr. Taufeeq Liaquat


End-to-End Issues
 Single Physical Link / Multiple Logical Processes
 Single link has the same two computers
 But TCP is dealing with multiple processes
 So, an explicit connection establishment phase is required and then an
explicit connection teardown phase
 Same RTT / Variable RTT
 TCP connections are likely to have widely different round-trip times
 RTT may vary due to congestion and data rate variations in the link
 No Reordering Required / Reordering Required
 No reordering required in point-to-point links
 Reordering is required in TCP (achieved through sequence numbers)
 Maximum Segment Lifetime (MSL)
 Conservative estimate that TCP makes of how long a packet might live in the
Internet
 Recommended MSL: 120 sec

136 Engr. Taufeeq Liaquat


End-to-End Issues
 Window Size Selection
 Point-to-point link connections have systems configured to support
the link
 Example
 If delay * bandwidth product is 8KB, window size will definitely be 8KB
 Systems will have the capacity to buffer 8KB of unacknowledged data
 For TCP, any kind of system can connect to the Internet
 Amount of resources dedicated to TCP can be variable
 TCP must include a mechanism to learn about the resources on the other
side
 Congestion
 Congestion is not possible in direct links because the source is
directly connected to the link and will inject data according to the
data rate
 In TCP connections, multiple links are with multiple data rates are
traversed so congestion is easily possible

137 Engr. Taufeeq Liaquat


End-to-End Issues
 Conclusion
 TCP has to provide reliable/ ordered delivery as compared to
unreliable by IP
 Assumptions
 IP is unreliable (Reliability)
 IP delivers messages out of order (Ordering)

138 Engr. Taufeeq Liaquat


How TCP manages a byte stream?

139 Engr. Taufeeq Liaquat


How TCP manages a byte stream?
 TCP is a byte-oriented protocol
 The sender writes bytes into a TCP connection and the receiver
reads bytes out of the TCP connection
 “Byte stream” describes the service TCP offers to application
processes
 TCP does not, itself, transmit individual bytes over the Internet
 TCP on the source host buffers enough bytes from the sending
process to fill a reasonably sized packet and then sends this packet to
its peer on the destination host
 TCP on the destination host then empties he contents of the packet
into a receive buffer, and the receiving process reads from this buffer
at its leisure

140 Engr. Taufeeq Liaquat


Segment Format
 SrcPort and DstPort: Same as UDP
 SequenceNum: contains the sequence
number for the first byte of data carried in
that segment
 Acknowledgment and AdvertisedWindow:
carry information about the flow of data
going in the other direction
 Flags:
 SYN: Connection establishment
 FIN: Connection termination
 RESET: signifies that the receiver has
become confused
 PUSH: sender invokes the push operation
 URG: signifies that this segment contains
urgent data
 ACK: Set any time when
Acknowledgement field is valid

141 Engr. Taufeeq Liaquat


Segment Format
 UrgPtr: When URG flag is set, UrgPtr field
indicates where the non-urgent data contained
in this segment begins
 Checksum: same as UDP
 HdrLen: Length of the Header in 32 bit words

 Detailed Description of the PUSH function:


Sometimes users need to be sure that all the
data they have submitted to the TCP has been
transmitted. For this purpose a push function is
defined. To assure that data submitted to a TCP
is actually transmitted the sending user
indicates that it should be pushed through to
the receiving user. A push causes the TCPs to
promptly forward and deliver data up to that
point to the receiver. The exact push point
might not be visible to the receiving user and
the push function does not supply a record
boundary marker.

142 Engr. Taufeeq Liaquat


Connection Establishment and Termination
 Connection Establishment
 A TCP connection begins with a client (caller) doing an active open to a
server (callee) that is assumed to have already done a passive open
 The participants begin an exchange of messages to establish a connection
 Connection setup is an asymmetric activity
 One side does an active open while the other, a passive open
 Connection Termination
 As soon as participant is done sending data, it closes one side of the
connection, which causes TCP to initiate a round of connection termination
messages
 Connection teardown is symmetric
 Each side closes the connection independently
 One side can close the connection after having done sending data but the other
side may keep the other half of the bidirectional connection open and to continue
sending data

143 Engr. Taufeeq Liaquat


Three-Way Handshake Algorithm

Fig.Timeline for three-way handshake algorithm

144 Engr. Taufeeq Liaquat


Three-Way Handshake Algorithm
 Why the client and server must exchange starting sequence
numbers with each other at connection setup time?

 TCP specification requires that each side of a connection select an


initial starting sequence number at random.
 The reason for this is to protect against two incarnations of the
same connection reusing the same sequence numbers too soon
 i.e. while there is still a chance that a segment from an earlier
incarnation of a connection might interfere with a later incarnation
of the connection.

145 Engr. Taufeeq Liaquat


Simple State Connection Diagram (Without
Ack’s)

146 Engr. Taufeeq Liaquat Data and Computer Communications,William Stallings 8e


Fig 20.3. Pg. 663.
Simple State Connection Diagram (Without
Ack’s)
 Connection Establishment
 Server invokes a passive open and TCP moves from CLOSED to
LISTEN state
 Later, client does an active open and sends a SYN segment to the
server and moves to the SYN SENT state
 When the SYN segment arrives at the server, it moves from LISTEN
to ESTABLISHED state and responds with a SYN segment
 Arrival of SYN segment causes the client to move to the
ESTABLISHED state

147 Engr. Taufeeq Liaquat


Simple State Connection Diagram (Without
Ack’s)
 Connection Termination
 Client sends a FIN segment to the server and moves from
ESTABLISHED to the FIN WAIT state (waits for a FIN from the
server)
 When the FIN segment arrives at the server, it moves from
ESTABLISHED to CLOSE WAIT state (waits for application to finish
data transfer)
 When CLOSE WAIT state is over (data transfer ends), server sends
a FIN and moves to CLOSED state

148 Engr. Taufeeq Liaquat

You might also like