0% found this document useful (0 votes)
6 views

Computer Network Ppt

Uploaded by

arindammitra2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Computer Network Ppt

Uploaded by

arindammitra2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Why study Computer Networks?

Syllabus

– To learn how computer networks work (protocols, – Physical Media: The Bandwidth Limited Signals, Maximum Data
Rate of a Channel.
architecture, and applications) – Application Layer: HTTP, SMTP, DNS etc., a little socket
programming.
– To build a foundation for courses like distributed – Transport Layer: TCP (Principles of Reliable Data Transfer : Go-
systems (grid/p2p/cloud), wireless networks, Back-N, and Selective Repeat), UDP.
– Network Layer: Addressing and Routing in the Internet.
mobile computing, network security, network –
Computer Networks: Introduction Data Link Layer: Error detection, Multiple access, etc.
programming, network management etc.) – Wireless Networks: Wi-Fi: 802.11, Cellular access.
– Mobile Networks: Mobility management, Mobile IP.
– Network Security: Overview of Cryptography, Key Exchange,
BITS Pilani Authentication, and Perimeter Security.
Hyderabad Campus Chittaranjan Hota

1 2 3

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Tutorials/Labs Uses of Computer Networks Network Components


Links Interfaces Switches/routers

• Capturing packets using Wireshark and analyzing various protocols


Fibers Ethernet card Large router
like TCP, UDP, ICMP, HTTP etc.
• Developing a Client/Server application using Unix Sockets API.
• NetSim: To investigate how a LAN performance is affected by
various parameter values.
• To design a WAN and analyze the concepts of link utilization, Quality
of Services etc.
Wireless card
• Study How TCP controls congestion in the network?
• Study how loss varies as the buffer size of Routers is increased Coaxial Cable

• Study the concept of shortest path in OSPF by varying the Link Switch
weight.

4 5 6
5
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Network Topologies Physical Layer components Link layer components

host host host host host host


Repeater

Bridge
Bus Star Tree
hub host host host host host host

hub
hub hub

7 Single ring Dual ring Mesh 8 9

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Structured Cabling Infrastructure Internet Structure Continued…
“Tier-3” ISPs and local ISPs
Tier-1 Tier 1 ISP – last hop (“access”) network (closest to end systems)
providers
interconnect
(peer) local
ISP Tier 3 local
privately local local
Tier 1 ISP Tier 1 ISP ISP ISP
ISP ISP
Local and tier- Tier-2 ISP
Tier-2 ISPs Tier-2 ISP
Patch Panels 3 ISPs are
Tier-2 ISP pays Tier-2 ISP also peer customers of Tier 1 ISP
Tier-2 ISP privately with
I/O and Faceplates tier-1 ISP for higher tier
Wire testers
connectivity to Tier 1 ISP each other. ISPs
Pigtails rest of Internet connecting
them to rest Tier 1 ISP
Tier 1 ISP Tier-2 ISP
of Internet
Tier 1 ISP local
Tier 1 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP
ISP
local local local
Tier-2 ISP Tier-2 ISP ISP ISP ISP
10 UTP connectors Patch cord Crimping tool 11 12

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Continued… Socket API


Client/Server using Socket API
• a packet passes through many networks!

local
ISP Tier 3 local
local local
ISP ISP
ISP ISP
Tier-2 ISP Tier-2 ISP
Tier 1 ISP

A socket address
Tier 1 ISP Tier 1 ISP
Tier-2 ISP
local
Tier-2 ISP Tier-2 ISP
ISP
local local local
ISP ISP ISP
13 14 15

BITS Pilani, Hyderabad Campus

Application: WWW and HTTP (Web 1.0) Browser Non-Persistent HTTP

16 17 18
Persistent HTTP HTTP Request and Response

Request Header Names


19 20 21
HTTP keep-alive, or HTTP connection reuse

An Example Cookies: keeping “state”


Response Header names client
server

ebay 8734
usual http request msg
Amazon server
cookie file usual http response creates ID
Set-cookie: 1678 1678 for user create
ebay 8734 entry
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
one week later: usual http response msg action backend
database
access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie- What cookies can bring:
spectific
 authorization
usual http response msg action
 shopping cart contents
22 23 24
11
 site preferences

HTTP Proxy Conditional GET Web 1.0, Web 2.0 and Web 3.0
client server
 Web 1.0 (what to show on the screen?)
HTTP request msg
If-modified-since:
<date> object
not
HTTP response modified
HTTP/1.0
304 Not Modified

HTTP request msg


Proxy If-modified-since:
server origin <date> object
client server modified
HTTP response
HTTP/1.0 200 OK
origin <data>
server
25 26
13 27
client
Web 2.0 : Information Sharing and Web 2.0: Dictionary Being Edited in Real- Web 2.0: Social Networks
Collaboration (Power of Networks) time by Anyone, and Blogging

90 million registered users, spanning more than 200 countries and


territories worldwide

Flickr

28 29 30

Web 2.0: RSS, Podcasts, Mashups


(Really Simple Syndication)
Web 3.0: technological change FTP: the file transfer protocol
Apple
• “The computer is generating new Information", rather
than humans.
• Web 3.0 is about meaning of data Control
connection

•A fast broadband connection to the Internet, always and


everywhere . Data
connection
•Open source techniques and free data (Data as a Service)
Web 2.0 is all about Social
change •Open identities
31 32
19 33
20

Some FTP Commands An Example


FTP Responses

34 35 36
Format of an e-mail
Electronic Mail: Common scenario

Actual FTP Session

1 9
2
8

3 7

4 5 6

37 38 39

SMTP Commands
E-mail address Protocols used in electronic mail

40 41 42

SMTP responses SMTP responses (continued)

43 44 45
POP3 Web-based e-mail, cases I and II
DNS – The Domain Name System

46 47 48

Domain names and labels


Domains Zone

49 50 51

Distributed, Hierarchical Database DNS Distributed Database


 There is one primary server for a domain,
and typically a number of secondary
Root DNS Servers
servers containing replicated databases.
bits-hyderabad DNS server
com DNS servers org DNS servers edu DNS servers in

pbs.org poly.edu umass.edu ac res


yahoo.com amazon.com
DNS servers DNS serversDNS servers bits-hyderabad
DNS servers DNS servers bits-hyderabad rpi.edu
DNS DB
rpi.edu
DNS DB DNS DB
DNS DB
iitd bits-hyderabad

Authoritative Replicas

52
39 53 Source: wiki 54
TLD and Authoritative Servers
DNS Resource Records Recursive Resolution
 Top-level domain (TLD) servers:
 responsible for com, org, net, edu, etc, and all top-level country
domains uk, fr, ca, jp, in.
 Authoritative DNS servers:
 Organization’s DNS servers, providing authoritative hostname to IP
7
mappings for organization’s servers (e.g., Web, mail).
6
 can be maintained by organization or service provider 1 4
 Local Name Server 8

 does not strictly belong to hierarchy


 each ISP (residential ISP, company, university) has one.
 also called “default name server”
 when host makes DNS query, it is sent to its local DNS server
55 56
43 57
 acts as proxy, forwards query into hierarchy

Iterative Resolution Socket Programming


Host A
Ports Host B
What is Network API?
- Provide support for message oriented communication
Process Process
- work with existing I/O services

3 Application

2 Network API Process Process


1
8 4 Protocol A Protocol B Protocol C
5
6 7 • Network APIs for TCP/IP suit: Process Process

- Sockets (Berkeley)
-Winsock
58 59 60
-Mac TCP

Sockets as means for inter-process


communication (IPC) Internet Connections (TCP/IP) UDP C/S
 Address the machine on the network
 By IP address
 Address the process
 By the “port”-number
 The pair of IP-address + port – makes up a “socket-address”
application layer application layer
Internet
Client Process Server Process Client socket address Server socket address
128.2.194.242:3479 208.216.181.15:80
Socket Socket
transport layer (TCP/UDP) transport layer (TCP/UDP)
OS network OS network
Internet Server
network layer (IP) network layer (IP) Client
stack stack Connection socket pair (port 80)
link layer (e.g. ethernet) link layer (e.g. ethernet)
Internet (128.2.194.242:3479, 208.216.181.15:80)
physical layer physical layer
Client host address Server host address
128.2.194.242 208.216.181.15
The interface that the OS provides to its networking subsystem
Note: 3479 is an Note: 80 is a well-known port
61 62 ephemeral port allocated associated with Web servers 63
Courtesy: Shukla by the kernel Courtesy: Shukla
Continued…

64 65 66

67 68 69

TCP Client-Server Continued…


UDP Client-Server: Recap
BIND
UDP Server SOCKET
LISTEN
socket()
CONNECT
2
bind() TCP three-way ACCEPT
Create
UDP Client handshake
recvfrom()
socket()
blocks until datagram
sendto() received from a client 5
data request
SEND RECEIVE Create

SEND
data reply sendto() RECEIVE
recvfrom()
CLOSE
close()
70 71 72
4. 2. 2012
Continued… Continued… Continued…

73 74 75

Continued… Continued… Continued…

76 77 78

Continued… Transport Layer Services


application
transport
network
data link
physical

Household analogy:

lo
gi
ca
5 kids sending letters to 5 kids

le
nd
-e
 processes = kids

nd
tra
 app messages = letters in

ns
po
Computer Networks: envelopes

rt
Transport Layer  hosts = houses application
transport
network
 transport protocol = Raj and data link
physical

BITS Pilani Amit


Hyderabad Campus
Chittaranjan Hota
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)  network-layer protocol =
79 80 81postal service

BITS Pilani, Hyderabad Campus


Multiplexing and
Network Vs Transport Layer Port Numbers Demultiplexing

82 83 84

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Flow Control at Transport Error Control at Transport


Layer Sliding Window
Layer

85 86 87

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Connection Oriented
Connectionless Service Service Finite State Machines

Packet 2

88 89 90

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Transport layer protocols Example Transport layer protocols:
Connection oriented stop and wait
Simple Connectionless

91 92 93

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

FSM for Stop and Wait Example Stop and Wait Efficiency of Stop & Wait:
bandwidthXdelay
It is a measure of the number of bits a sender can transmit through
the system while waiting for an acknowledgement.

Assume that, in a Stop-and-Wait system, the bandwidth of the line is


1 Mbps, and 1 bit takes 20 milliseconds to make a round trip. What
is the bandwidth-delay product? If the system data packets are 1,000
bits in length, what is the utilization percentage of the link?

What is the utilization percentage of the link in above example if we


have a protocol that can send up to 15 packets before stopping and
worrying about the acknowledgments?

Pipelining
94 95 96

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Send window for


Go-Back-N protocol Sliding the send window
Go-Back-N
Send window

Sliding direction

Receive
window

97 3.7 98 99

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Go-Back-N: Sliding the FSMs for the Go-Back-N Send window size for
protocol Go-Back-N
send window recap
Send window

Sliding direction

Go-back-N: Pipelining
Receive  Sender can have up to N unacked
packets in pipeline
window
 Rcvr only sends cumulative acks
 Doesn’t ack packet if there’s a gap
 Sender has timer for oldest unacked
packet
 If timer expires, retransmit all
100 101 unacked packets 102

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Example Go-Back-N
Example Go-Back-N with Selective Repeat protocol
when a
cumulative Ack
packet is lost

103 104 105

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Send and Receive Selective Repeat


Selective Repeat
Windows Example
interpretation
for SR
Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and
5. The sender receives an ACK with ackNo = 3. What is the
interpretation if the system is using GBN or SR?

Solution
If the system is using GBN, it means that packets 0, 1, and 2
have been received uncorrupted and the receiver is
expecting packet 3. If the system is using SR, it means that
packet 3 has been received uncorrupted; the ACK does not
say anything about other packets.
106 107 108

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Selective Repeat Window TCP Flow Control
size

Computer Networks:
Transport Layer
BITS Pilani Chittaranjan Hota
Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)

109 110 111

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Interactive TCP : Network bandwidth Nagle’s algorithm for WAN Interactive


Nagle’s Algorithm exchange

When the application produces data to send


if both the available data and the window ≥ MSS
send a full segment
else
if there is unACKed data in flight
buffer the new data until an ACK arrives
else
Interactive Exchange with Delayed
send all the new data now
Interactive Exchange
ACK
[Source: GEOFF HUSTON]
112 GEOFF HUSTON]
[Source: 113 114

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Clarks’s Solution to Silly Window TCP Flow Control:


Syndrome Bandwidth-Delay Product  Advertised Window size Congestion in the Network
Host A λout
λin : original data

• A link with 100 ms RTT, the number of bytes in such a link at λ'in : original data, plus
retransmitted data
T1 speed is finite shared output
1.544*106 * .100/8 = 19,300 bytes. link buffers

Host B
• A T3 line with 45 Mbps, Bandwidth * Delay = 562,500 bytes.

• What is the size of normal advertised window?

• Is it enough to keep a T3 link fully occupied transmitting info?

115 116 117

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Receiver Window vs. Congestion Window Slow Start: Exponential Increase Congestion avoidance: Additive Increase

• Flow control
– Keep a fast sender from overwhelming a slow receiver
• Congestion control
– Keep a set of senders from overloading the network

• Different concepts, but similar mechanisms


– TCP flow control: receiver window
– TCP congestion control: congestion window
– TCP window:
min{congestion window, receiver window}

118 119 120

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Example of Tahoe TCP Example of Reno TCP Let us work it out…

70
threshold
60 congestion
timeouts window

Congestion Window
50
fast retransmission
40

30

20
additive increase
10
slow start period
0
0 10 20 30 40 50 60
Time
121 122 123

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

TCP Throughput: AIMD TCP Fairness Why TCP is Fair?


If MSS = 10 KB (kilobytes), RTT=100 ms, what is the throughput in below figure?
Fairness goal: if K TCP sessions share same bottleneck link
bandwidth R, each should have average rate of R/K R equal bandwidth share

Connection 2 throughput
TCP connection 1
loss: decrease window by factor of 2
congestion avoidance: additive increase
loss: decrease window by factor of 2
congestion avoidance: additive increase

Bottleneck router Full bandwidth utilization line


Here, Throughput = (0.75)Wmax / RTT capacity R
TCP
Connection 1 throughput R
connection 2

124 125 126

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
TCP Timers RTO Computation Example
RTT: gaia.cs.umass.eduto fantasia.eurecom.fr

350

300

250

RTT (milliseconds)
Computer Networks: 200

Transport Layer 150

BITS Pilani Chittaranjan Hota 100


Hyderabad Campus 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE) time(seconnds)

SampleRTT Estimated RTT


127 128 129

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Exponential Backoff and User Datagram Protocol


Karn’s algo (UDP) UDP Packet Format

• “bare bones” Internet transport protocol


• “best effort” service, UDP segments may be:
– lost
Why is there a UDP?
– delivered out of order to app
• no connection establishment
 often used for streaming multimedia (which can add delay)
 loss tolerant • simple: no connection state
 rate sensitive at sender, receiver
 other UDP uses • small segment header
 DNS • no congestion control: UDP
 SNMP can blast away as fast as
 Reliable transfer over UDP:
desired
 add reliability at application layer

130 Other timers: Persistence Timer, Keep-Alive Timer, Time-wait Timer. 131 132

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

UDP Checksum Internet Transport Layer

Computer Networks:
Transport Layer
BITS Pilani Chittaranjan Hota
Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)

133 134 135

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus


Sequence Numbers TCP Sequence Number &
TCP Segments ACK Numbers
Host A Host B
Suppose a TCP connection is transferring a file
of 4,000 bytes. The first byte is numbered
User Seq=4
2, A CK=7
types 9, data
= ‘C’
10,001. ‘C’
host ACKs
receipt of
‘C’
ata = ‘C’, echoes
43, d
What are the sequence numbers for each Seq=
79 , AC K
= back ‘C’

segment if data are sent in four segments, each


host ACKs
segment has a carrying capacity of 1,000 receipt Seq=4
3,
bytes? of echoed ACK=
80
‘C’

time
simple telnet scenario
136 137 138

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Pseudo header for Connection establishment


TCP Segment Format Checksum

32

139 140 141

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Denying a connection Connection termination Half Close

142 143 144

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
TCP: Go-Back-N or Selective Repeat?
TCP State Transitions Triggering Transmissions Recap

TCP has three mechanism to trigger the transmission of a segment


1) TCP maintains a variable MSS and sends a segment as soon as
it has collected MSS bytes from the sending process
 MSS is usually set to the size of the largest segment TCP can
send without causing local IP to fragment.
 MSS: MTU of directly connected network – (TCP header + IP
header)
2) Sending process has explicitly asked TCP to send it
 TCP supports push operation
3) When a timer fires
 Resulting segment contains as many bytes as are currently
buffered for transmission

145 146 147


Normal Operation
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Continued… Continued… Continued…

148
Lost Segment 149 Fast Retransmit 150
Lost Acknowledgement
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Continued…

Network Layer
Computer Networks:
Transport Layer
BITS Pilani Chittaranjan Hota
Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)

151
Lost Acknowledgement corrected by resending a segment 152 153
[Image sources: Behrouz Forouzan, Garcia, Tanenbaum]
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Communication at the Network layer
Metropolitan Area Network Functions of Network
Organizatio layer
To Internet or n Servers
WAN

Gatewa s s
Backbon y
e R
R R
S
Department S S
R
al Server R
R

s s Interconnecting different networks (various LAN


s technologies, telephone network, satellite link, ATM
s s s s networks etc.) and making them look the same to the
s s transport layer.
154 155 156

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Functions of Network Functions of Network layer Functions of Network layer


layer

All Data link layer technologies can handle a different


packet length. The network layer must be able to fragment
transport layer PDUs into smaller units so that they can be
Unique addresses are required to define each The Protocol Data Units (PDU’s) coming from the transport transferred over various data-link layer technologies.
host/machine/device/user in the network. We cannot use layer must be placed in network-layer packets and sent to
the data link layer addresses (Ethernet, HDLC, PPP etc.)!! the data-link layer.

157 158 159

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Functions of Network layer Network layer at the Source Network layer at Router

Now that you have your network layer packet, where do


you send it ?

160 161 162

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Network layer at the Destination Network layer connection-oriented Virtual circuits: Signaling protocols
and connection-less service

• Datagram network provides network-layer


connectionless service
• Virtual Circuit network provides network-layer application
5. Data flow begins 6. Receive data application
transport
connection-oriented service network 4. Call connected 3. Accept call transport
1. Initiate call network
• Analogous to the transport-layer services, but: data link 2. incoming call
data link
physical
physical
– Service: host-to-host
– No choice: network provides one or the other
– Implementation: in the core

163 164 165

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Virtual circuit packet switched n/w Virtual circuit: Sending Request packet Virtual circuit: Sending Ack packet

166 167 168

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Virtual circuit: Data transfer Datagram networks Forwarding & Routing: Local vs Global

routing algorithm

local forwarding table


header output
value0100 3 link
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2

169 170 171

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Forwarding table Longest prefix matching Longest prefix matching

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

11001000 00010111 00011001 00000000 DA: 11001000 00010111 00011000 10101010 Which interface? DA: 11001000 00010111 00011000 10101010 Which interface?
through 2
11001000 00010111 00011111 11111111

172 otherwise 3 173 174

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

BITS Hyderabad Campus Back Bone Network Connectivity in Hostel Block - 1 Cisco Router 2821 @ BITS Hyderabad

175 176 177

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Routing at Distribution switch for


Performance Metrics Performance Metrics continued…
Staff Quarters @ BITS Hyd

• Delay, Throughput, Packet loss

178 179 180

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Effect on Performance Router Architecture Overview Continued…

Two key router functions:


• run routing algorithms/protocol (RIP, OSPF, BGP)
• forwarding datagrams from incoming to outgoing link

181 182 183

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Three types of switching fabrics Routing in a banyan switch The Internet’s Network layer

1 Gb/s bus in Cisco 1900:


sufficient speed for access
and enterprise routers (not
regional or backbone)

Cisco 12000: switches


Gb/s through the
184interconnection network 185 186

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

IP Packet Header IP Fragmentation & Reassembly Fragmentation in detail

reassembly

187 188 189

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
IP Address Classes Address Hierarchy

Computer Networks: Network


Layer
BITS Pilani Chittaranjan Hota
Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)

190 191 192

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Classless IP Address Information Extraction CIDR in Internet Protocol

Variable length Blocks:

128.192.111.202 / 29

10000000 01101111 11000000 11001010


11111111 11111111 11111111 11111000
10000000 01101111 11000000 11001000

Network ID: 128.192.111.200


Find First and Last
address.
193 194 195

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

An Example Route aggregation in CIDR More specific route


ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 0


Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
200.23.16.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
“Send me anything
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23 with addresses
Organization 2 beginning
Organization 0 200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
200.23.16.0/23 . . Internet
.
Organization 1 Organization 7 .
“Send me anything
200.23.18.0/23 200.23.30.0/23
with addresses
Organization 2 beginning “Send me anything
ISPs-R-Us
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20” with addresses
. Organization 1 beginning 199.31.0.0/16
. . Internet or 200.23.18.0/23”
14.24.74.192/28 . 200.23.18.0/23
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us with addresses
196 197 beginning 199.31.0.0/16” 198

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Network Address
Another Example Let us try… Translation: Why?

64 customers with each 256 addresses


A . Expand IP address space by deploying private

17.12.14.48 /28
. address and translating them into publicly
B
. registered addresses.
128 customers with each 128 addresses
.

17.12.14.0/27
. Not every printer / fax machine / IPod / etc. needs
.
128 customers with each 64 addresses . to be publicly accessible from the Internet.

17.12.14.32 / 28
.
. C
x.y.z.t/n
Network: 17.12.14.0/26
199 200 201

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

NAT Modes Continued… Effect of NATing on P2P

NAT translation table


WAN side addr LAN side addr
138.76.29.7, 5001 10.0.0.1, 3345
…… …… Server

S: 10.0.0.1, 3345
D: 128.119.40.186, 80 Internet
10.0.0.1
1
S: 138.76.29.7, 5001
2 10.0.0.4
D: 128.119.40.186, 80 NAT
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
4 P2P Application
D: 10.0.0.1, 3345
S: 128.119.40.186, 80
3
D: 138.76.29.7, 5001 10.0.0.3

Private IP Addresses Public IP Addresses


202 203 204

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

NAT Traversal: Static NAT Traversal: Application How to Bootstrap an End


Routes Relay host?
Application Relay • What IP address the host should use?
• What local Domain Name System server to
10.0.0.1
• client wants to connect to Client
server with address 10.0.0.1 ?
• Solution : statically configure
use?
10.0.0.4
NAT to forward incoming • ARP, DHCP
connection requests at given 138.76.29.7 NAT
Internet
port to server router

– e.g., (138.76.29.7, port 2500)


always forwarded to 10.0.0.1
port 25000
P2P
VoIP
Video game consoles
Private IP Addresses Public IP Addresses Private IP Addresses
205 206 207

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Dynamic Host Configuration
ARP Reverse ARP Protocol (DHCP)

• Client sends Discover


“Someone send me an
address”. This is a
broadcast.
• Servers Offer “Use this
address”.
• Client Requests “I’ll use
this one”. (broadcast)
• Servers Acknowledge “OK
or No Way!” (ACK/NAK)

208 209 210

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

DHCP Relay ICMP Continued…

Unreachable
Network
DHCP DHCP
Server Relay Host A
Host A
broadcasts
Host B DHCPDISCOVER
broadcasts Relay unicasts message
DHCP DHCP request Server ICMP
request to server responds msg X 3 ICMP Source Quench
with host’s
IP address 2
DHCP
Host B Other
Other Server
Network
Network 1 2
4
ss
source destination ICMP Redirect
211 212 Error Reporting 213
Path MTU Discovery
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Routing Packet forwarding An Example

• A famous quotation from RFC 791 • There’s no such thing as a free lunch
“A name indicates what we seek. An address – CIDR allows efficient use of the limited address
indicates where it is. A route indicates how we space
get there.” -- Jon Postel – But, CIDR makes packet forwarding much harder

214 215 216

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Network Layer Routing Routing algorithm
Classification
Global or decentralized? Static or dynamic?
Goal: determine “good” paths Global:
(sequences of routers) through
Static:
network from sources to destination. • all routers have complete • routes change slowly
topology, link cost info over time
Graph abstraction for the • “link state” algorithms Dynamic:
routing problem: Decentralized: • routes change more
• router knows physically- quickly Computer Networks: Network
connected neighbors – periodic update
• graph nodes are routers 5 Layer
• graph edges are physical • iterative process of
B 3 C – in response to link
links 2 5 computation, exchange of info
A 2 F with neighbors cost changes BITS Pilani Chittaranjan Hota
• links have properties: delay, 3 1 Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)
capacity, cost, policy 1 D 2 • “distance vector” algorithms
217
E 218 219
1
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Internet Routing Dijkstra’s Shortest-Path Algorithm


Concept of Link State Routing
Architecture
• Iterative algorithm
– After k iterations, know least-cost path to k nodes
Tier
Tier11ISP
Tier
Tier11ISP
ISP
ISP
• S: nodes whose least-cost path definitively known
– Initially, S = {u} where u is the source node
– Add one node to S in each iteration
Tier
Tier22 • D(v): current cost of path from source to node v
Tier
Tier22 – Initially, D(v) = c(u,v) for all nodes v adjacent to u
Tier
Tier22
Tier
Tier33
– … and D(v) = ∞ for all other nodes v
Tier 2: Regional/National
Tier 3: Local – Continually update D(v) as shorter paths are learned
220 221 222

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Dijsktra’s Algorithm Dijkstra’s algorithm: example1 Link-State Routing

1 Initialization: Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)


2 S = {u} • Each router keeps track of its incident links
0 u 2,u 5,u 1,u ∞ ∞
3 for all nodes v 1 ux 2,u 4,x 2,x ∞ – Whether the link is up or down
2 uxy 2,u 3,y 4,y
4 if v adjacent to u { 4,y – The cost on the link
3 uxyv 3,y
5 D(v) = c(u,v) 4,y • Each router broadcasts the link state
4 uxyvw
6 else D(v) = ∞ 5 uxyvwz – To give every router a complete view of the graph
7
8 Loop
Resulting forwarding table in u: • Each router runs Dijkstra’s algorithm
5
9 find w not in S with the smallest D(w)
destination link – To compute the shortest paths
3
10 add w to S 2
v w 5 v w v (u,v)
– … and construct the forwarding table
11 update D(v) for all v adjacent to w and not in S: u 2 1 z u
x (u,x)
• Example protocols
3 z
12 D(v) = min{D(v), D(w) + c(w,v)} 1
y (u,x)
x 2 – Open Shortest Path First (OSPF)
13 until all nodes in S 1
y x y w (u,x)

223 224
z (u,x) 225

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Detecting Topology Changes Broadcasting the Link State Broadcasting the Link State

• Beaconing
• Reliable flooding
– Periodic “hello” messages in both directions – Ensure all nodes receive link-state information
X A X A
– Detect a failure after a few missed “hellos” – … and that they use the latest version
C B D C B D
“hello” (a) (b)
• Challenges
– Packet loss
X A X A
– Out-of-order arrival
C B D C B D • Solutions
(c) (d)
– Acknowledgments and retransmissions
– Sequence numbers
226 227 228 – Time-to-live for each packet
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

When to Initiate Flooding Transient Disruptions Scaling Link-State Routing

• Overhead of link-state routing


• Topology change • Detection delay
– Flooding link-state packets throughout the network
– Link or node failure – A node does not detect a failed link immediately – Running Dijkstra’s shortest-path algorithm
– Link or node recovery – … and forwards data packets into a “blackhole” • Introducing hierarchy through “areas”
• Configuration change – Depends on timeout for detecting lost hellos
Area 1 Area 2
– Link cost change 2
3 1
• Periodically 1
4 area Area 0
– Refresh the link-state information 2 1 border
5
– Typically (say) 30 minutes router
4 3 Area 3 Area 4
229 230 231

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Concept of Distance Vector Routing Bellman-Ford example Distance Vector Algorithm

Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3


• Bellman-Ford algorithm
5
• Repeat
B-F equation says:
For every node x
3 du(z) = min { c(u,v) + dv(z),
2
v w 5 c(u,x) + dx(z), For every neighbor z
c(u,w) + dw(z) } For every destination y
2
u
d(x,y) ← Update(x,y,z)
1 = min {2 + 5,
3 z
1 + 3,
1
2 5 + 3} = 4 • Until converge
x 1
y

232 233 234

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Count to infinity: Two-Node Loop Instability

Solutions:

1.Defining infinity
2.Split horizon
3.Split horizon with
Poison reverse

235 236 237

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Three-node loop instability Internet Routing Protocols Routing Information Protocol (RIP)

Hop count based routing,


the infinity distance is defined as 16

238 239 240

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

RIP: Example RIP: Example Continued…

z
w x y …

A D B

C
Destination Network Next Router Num. of hops to dest.
w A 2 Computer Networks: Network
y B 2
z B 7 Layer
x -- 1
…. …. .... BITS Pilani Chittaranjan Hota
Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)
Routing/Forwarding table in D
241 242 243

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus


Open Shortest Path First (OSPF) OSPF “advanced” features (not in RIP) Hierarchical OSPF
• “open”: publicly available
• uses Link State algorithm • security: all OSPF messages authenticated (to prevent
– LS packet dissemination
malicious intrusion)
– topology map at each node • multiple same-cost paths allowed (only one path in RIP)
– route computation using Dijkstra’s algorithm • For each link, multiple cost metrics for different TOS (e.g.,
• OSPF advertisement carries one entry per neighbor router satellite link cost set “low” for best effort; high for real time)
• advertisements disseminated to entire AS (via flooding) • integrated uni- and multicast support:
– carried in OSPF messages directly over IP (rather than TCP or UDP) – Multicast OSPF (MOSPF) uses same topology data
base as OSPF
• hierarchical OSPF in large domains.

244 245 246

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Challenges for Interdomain Routing Open Shortest Path First (OSPF) OSPF “advanced” features (not in RIP)

• Scale • “open”: publicly available


• security: all OSPF messages authenticated (to prevent
– Prefixes: 150,000-200,000, and growing • uses Link State algorithm
malicious intrusion)
– ASes: 20,000 visible ones, and growing – LS packet dissemination
• multiple same-cost paths allowed (only one path in RIP)
– topology map at each node
– AS paths and routers: at least in the millions… • For each link, multiple cost metrics for different TOS (e.g.,
– route computation using Dijkstra’s algorithm
• Privacy • OSPF advertisement carries one entry per neighbor router satellite link cost set “low” for best effort; high for real time)
– ASes don’t want to divulge internal topologies • advertisements disseminated to entire AS (via flooding)
• integrated uni- and multicast support:
– … or their business relationships with neighbors – carried in OSPF messages directly over IP (rather than TCP or UDP) – Multicast OSPF (MOSPF) uses same topology data
• Policy base as OSPF
– No Internet-wide notion of a link cost metric • hierarchical OSPF in large domains.
– Need control over where you send traffic
247 – … and who can send traffic through you 248 249

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Hierarchical OSPF Challenges for Interdomain Routing Shortest-Path Routing is Restrictive

• Scale • All traffic must travel on shortest paths


– Prefixes: 150,000-200,000, and growing • All nodes need common notion of link costs
– ASes: 20,000 visible ones, and growing • Incompatible with commercial relationships
– AS paths and routers: at least in the millions…
• Privacy National National YES
– ASes don’t want to divulge internal topologies ISP1 ISP2
– … or their business relationships with neighbors NO
• Policy
Regional Regional Regional
– No Internet-wide notion of a link cost metric
ISP3 ISP2 ISP1
– Need control over where you send traffic
– … and who can send traffic through you
10 Cust3 Cust2 Cust1

250 251 252

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Path-Vector Routing Faster Loop Detection Flexible Policies

• Extension of distance-vector routing • Node can easily detect a loop


• Each node can apply local policies
– Look for its own node identifier in the path
– Support flexible routing policies – Path selection: Which path to use?
– E.g., node 1 sees itself in the path “3, 2, 1” – Path export: Which paths to advertise?
– Avoid count-to-infinity problem
• Key idea: advertise the entire path • Node can simply discard paths with loops • Examples
– Distance vector: send distance metric per dest d – E.g., node 1 simply discards the advertisement – Node 2 may prefer the path “2, 3, 1” over “2, 1”
– Node 1 may not let node 3 hear the path “1, 2”
– Path vector: send the entire path for each dest d
“d: path (2,1)” “d: path (1)” 2 3
“d: path (2,1)” “d: path (1)” 3
2 1
3
2 1

data traffic data traffic


“d: path (3,2,1)” 1
253 d 254 255

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Path Vector Routing: An example BGP: Border Gateway Routing


Protocol
Joining BGP and IGP

• BGP provides each AS a means to:


1. Obtain subnet reachability information from
neighboring ASs.
2. Propagate reachability information to all AS-
internal routers.
3. Determine “good” routes to subnets based on
reachability information and policy.

256 257 258

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

BGP Policy: Influencing decisions BGP routing policy Example Continued…

Local-pref = 90
legend: provider legend: provider
B network B network
AT&T Sprint
X X
W A W A
customer customer
Local-pref = 100 C network: C network:
Tier-2
Y Y

Tier-3 Yale • A advertises path AW to B


• A,B,C are provider networks
Import Policy: Local preference (Example: prefer customer over peer) • B advertises path BAW to X
• X,W,Y are customer (of provider networks)
• Should B advertise path BAW to C?
• X is dual-homed: attached to two networks
• No way! B gets no “revenue” for routing CBAW since neither W
UUNET AT&T Sprint • X does not want to route from B via X to C
nor C are B’s customers
• .. so X will not advertise to B a route to C
Princeton
network Export Policy: Filtering • B wants to force C to route to w via A
operator
259 128.112.0.0/16 260 261 • B wants to route only to/from its customers
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Broadcast Routing Spanning Tree Spanning Tree: Creation

• Center node
• First construct a spanning tree • Each node sends unicast join message to center node
duplicate
duplicate • Nodes forward copies only along spanning – Message forwarded until it arrives at a node already belonging to
R1 creation/transmission R1 spanning tree
duplicate tree
R2 R2 A A
A A
B B 3
R3 R4 R3 R4 c c B B
c c
source in-network D D 4
2
duplication duplication F E F E D D
F E F E
1 5
G G
G G
• source duplication: how does source determine recipient (a) Broadcast initiated at A (b) Broadcast initiated at D
(a) Stepwise construction of (b) Constructed spanning
262
addresses? 263 264
spanning tree tree

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Multicast Routing: Problem Statement Approaches for building mcast trees Shortest Path Tree

Approaches: • mcast forwarding tree: tree of shortest path


• source-based tree: one tree per source routes from source to all receivers
– Dijkstra’s algorithm
– shortest path trees
S: source
– reverse path forwarding LEGEND
R1 2
• group-shared tree: group uses one tree 1
R4 router with attached
group member

– minimal spanning (Steiner) R2 5


router with no attached
3 4
Shared tree Source-based trees
– center-based trees R5 group member

R3 6 link used for forwarding,


i
R7 i indicates order link
R6
added by algorithm
265 266 267

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Reverse Path Forwarding: example Reverse Path Forwarding: pruning

S: source
LEGEND
R1
R4 S: source LEGEND
router with attached
group member R1 router with attached
R2 R4 group member
router with no attached
R5 group member R2 router with no attached
P group member
R3 datagram will be forwarded
R5
P
prune message
Computer Networks: Quality of
R6 R7
datagram will not be R3 P links with multicast Service
forwarded R7 forwarding
R6

• result is a source-specific reverse SPT


BITS Pilani Chittaranjan Hota
– may be a bad choice with asymmetric links Hyderabad Campus

268 269 270

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus


RSVP Example
QoS Architectures for the RSVP Example continued…
Internet
Integrated Services (IntServ)
– Flow Based QoS Model (Resources are available prior to establishing
the session)
– Uses RSVP (signaling protocol) to create a flow over a connectionless
IP
Differentiated Services (DiffServ)
– Categorize traffic into different classes or priorities with high priority
value assigned to real time traffic
– Hop by hop (no assurance of end-to-end QoS)

Multiprotocol Label Switching (MPLS)


– Not primarily a QoS model, rather a Switching architecture
– Ingress to the network decides a label according to FEC
(Host 3 requests a (Additionally, it requests a (Host 5 requests a
(A network) (The multicast spanning tree (The multicast spanning tree channel to host 1) second channel, to host 2) channel to host 1)
271 272 for host 1) for host 2) 273

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Integrated Services
(IntServ) DiffServ Architecture Expedited Forwarding
Resource reservation
Edge router: • Expedited packets experience a traffic-free
r marking
– call setup, signaling (RSVP)
– traffic, QoS declaration  per-flow traffic scheduling
– per-element admission control
management network (low loss, low latency, low jitter, and
 marks packets as in-profile
b .. assured bandwidth (premium service)
and out-profile .
Core router:
request/
reply  per class traffic management
 buffering and scheduling
– QoS-sensitive based on marking at edge
scheduling (e.g.,  preference given to in-profile
packets
WFQ)
274 275 276

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Assured Forwarding Example packet classifier Integrated solution

• A possible implementation of the data flow for assured • Gold traffic


forwarding is shown below. – All traffic to/from Director office (IP address)
• AF delivers the packet with high assurance as long as its’ – All traffic to/from the port number for DNS
class does not exceed the traffic profile of the node. • Silver traffic
– All traffic to/from academic and administrative buildings
• Bronze traffic
– All traffic on the public wireless network

• Then, schedule resources accordingly


– E.g., 50% for gold, 30% for silver, and 20% for bronze
277 278 279

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Model for MPLS Network MPLS Forwarding MPLS Operation LDP:

1a. Routing protocols (e.g. OSPF-TE)


exchange reachability to destination networks
LER
LSR = Label Switched Router 1b. Label Distribution Protocol (LDP)
LSR LER = Label Edge Router establishes label mappings to destination
LSP = Label Switched Path network
4. LER at egress
removes label and
delivers packet
IP

LSP Ingress
IP
10 IP 20
IP IP
40
Egress

MPLS Domain

LSP
2. Ingress LER receives packet and
Route at edge and Switch at core “label”s packets
3. LSR forwards packets
280 281 282 using label swapping
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Maximum data rate of a Example


channel
• Depends on
We need to send 265 kbps over a noiseless (ideal) channel
• The bandwidth available
with a bandwidth of 20 kHz. How many signal levels do we
• The level of the signals we use need?
• The quality of the channel (the level of noise)

• Noiseless channel
Computer Networks: Physical
• Nyquist formula A telephone line normally has a bandwidth of 3000 Hz
layer • bitrate = 2.B.log2L assigned for data communications. The signal-to-noise ratio
• Noisy channel is usually 3162. Find out the capacity.
BITS Pilani Chittaranjan Hota
• Shannon formula
Hyderabad Campus
• capacity = B.log2(1+SNR)
283 284 285

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Digital data to Digital signal Transmission media Guided media

286 287 288

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Coaxial cable Optical fiber Continued…

289 290 291

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Unguided media Bands

Session 1
Introduction to Computer
Networks
Prof. C R Sarma
BITS Pilani WILP-BITS-Pilani
Pilani Campus

292 293 294

BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus

Important Note to Students

IMP Note to Self


➢ It is important to know that just login to the session does not guarantee the
attendance.
➢ Once you join the session, continue till the end to consider you as present in the
class.
➢ IMPORTANTLY, you need to make the class more interactive by responding to
Professors queries in the session.
• The slides presented here are obtained from the authors of the books and from
➢ Whenever Professor calls your number / name, you need to respond, various other contributors. I hereby acknowledge all the contributors for their
otherwise it will be considered as ABSENT material and inputs.
• I have added and modified a few slides to suit the requirements of the course.

295 296 297


Dr. Rama Satish K V, Visiting Professor, Wipro-WASE, 2 BITS Pilani, Pilani Campus Dr. Rama Satish K V, Visiting Professor, Wipro-WASE, 3 BITS Pilani, Pilani Campus BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Bengaluru Bengaluru
Definition Five Components of Data Communication LAN (Local Area Network)

• Interconnected collection of two or more • 10m-1km distance


autonomous computers.
• Two or more computers are said to be • Room,building,campus
connected only if they can exchange • 10Mbps-100Mbps
information (data) among themselves.
• Size-restricted
• The word data refers to information
presented in whatever form agreed upon by • Transmission technology-Cables
the parties creating and using the data. • Topology-bus,ring
• Data communications are the exchange of
data between two devices via some form of
transmission medium.
298 299 300

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

MAN (Metropolitan Area Network) WAN (Wide Area Network) Network Structure
➢ Network edge: applications
• 10km-100km distance • 100km-10000km distance and hosts.
• City • Country,continent,planet
➢ Access networks, physical
• Eg:Cable television N/W • Eg: Internet media: wired, wireless
• Traditional applications - E-mail, News, communication links
Remote login, File transfer
➢ Network core:
➢ interconnected routers
➢ network of networks
(Internet)

301 302 303

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

Connection-Oriented Service /
Network Edge Connectionless Service
➢ End systems (hosts):
run application programs at “edge • Steps – call setup, data • Each packet sent
of network” e.g. Web, email transfer, call termination independently
➢ client/server model • Adv – fixed path, order of • Routing decisions made at
client host requests, receives messages preserved, no every intermediate system
service from always-on server loss of data • Eg: email, remote login
e.g. Web browser/server; email • Reliable data transfer • Use of IP
client/server
• Receives ACK, adds on • Adv – Flexibility, robust, no
❑ peer-peer model:
overhead & delay unnecessary overhead
➢ minimal (or no) use of
dedicated servers • Eg: telephone, FTP • Unreliable, no guaranteed
e.g. Skype, Bit-Torrent delivery & order of delivery

304 305 306

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
The Network Core Network Core: Circuit Switching Message Switching

• mesh of interconnected End-end resources • Eg: Telegraph n/ws


routers reserved for “call”
• the fundamental question: • Transmit text messages over long distances
• link bandwidth, switch
how is data transferred capacity • Text message is converted to codes
through net?
• dedicated resources: no • Morse codes
– circuit switching: sharing
dedicated circuit per call:
• circuit-like (guaranteed) • Uses the concept of store-and-forward
telephone net
– packet-switching: data
performance • Header contains destination address
• call setup required
sent thru net in discrete
“chunks”

307 308 309

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

Circuit Switching Store & Forward Packet Switching Internet structure: network of networks
• Eg: Telephone n/ws • roughly hierarchical
• 2-way transmission of voice signals across a • at center: “tier-1” ISPs (e.g., Verizon, Sprint, AT&T, Cable and
network Wireless), national/international coverage
• Early days-dedicated lines – treat each other as equals
• Now-switches
Tier-1 Tier 1 ISP
providers
interconnect
(peer)
privately
• Eg: Internet Tier 1 ISP Tier 1 ISP

310 311 312

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

Internet structure: network of networks Internet structure: network of networks Internet structure: network of networks
• “Tier-2” ISPs: smaller (often regional) ISPs • “Tier-3” ISPs and local ISPs • a packet passes through many networks!
– Connect to one or more tier-1 ISPs, possibly other tier-2 ISPs – last hop (“access”) network (closest to end systems)

local local
ISP Tier 3 local ISP Tier 3 local
local local local local
Tier-2 ISPs ISP ISP ISP ISP
ISP ISP ISP ISP
Tier-2 ISP pays Tier-2 ISP also peer Local and tier- Tier-2 ISP Tier-2 ISP
Tier-2 ISP privately with Tier-2 ISP Tier-2 ISP
tier-1 ISP for 3 ISPs are
connectivity to Tier 1 ISP each other. customers of Tier 1 ISP Tier 1 ISP
rest of Internet higher tier
❑ tier-2 ISP is ISPs
customer of connecting
tier-1 provider Tier 1 ISP them to rest Tier 1 ISP Tier 1 ISP
Tier 1 ISP Tier-2 ISP Tier 1 ISP Tier-2 ISP Tier 1 ISP Tier-2 ISP
of Internet
local local
Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP Tier-2 ISP
ISP ISP
local local local local local local
313 314 ISP ISP ISP 315 ISP ISP ISP
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
Access networks Access Network: Dial Up(1) Access networks: DSL
➢ How to connect end
systems to edge router?
✓ residential access nets
✓ institutional access
networks (school,
company)
Drawback:
✓ mobile access networks
➢ up to 56Kbps direct access to router (often less)
➢ Can’t surf and phone at same time: can’t be “always on”

316 317 318

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

Access Networks / Physical Media


Access Network: Cable(1) Access Network: Ethernet
Wired(Guided)/Wireless(Unguided)
• Eg: twisted pair, coaxial  Eg: radio transmission,
cable, optical fiber infrared, microwave
• Provide point-to-point transmission, air
communication  Communication is broadcast
• Signal energy is contained in nature
& guided within a solid  Signal energy propagates in
medium the form of unguided electro-
• Installation process is magnetic signals
complicated, costly & time  Quick and cost is low
consuming (antennas)

319 320 321

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

How do loss and delay occur? Four sources of packet delay


• N/W topology is discrete  N/W topology is continuous packets queue in router buffers
• 1. nodal processing: ❑ 2. queueing
• Attenuation α d  Attenuation α log10 d • packet arrival rate to link exceeds output link capacity – check bit errors ❖ time waiting at output
• Additional transmission  Not possible to procure • packets queue, wait for turn – determine output link link for transmission
capacity can be procured additional capacity ❖ depends on congestion
by adding more wires level of router
packet being transmitted (delay)

transmission
A A propagation

B B
packets queueing (delay) nodal
processing queueing
free (available) buffers: arriving packets
322 323 dropped (loss) if no free buffers 324
Introduction 1-30 Introduction 1-31
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
Delay in packet-switched networks Caravan analogy Caravan analogy (more)

3. Transmission delay: 4. Propagation delay: 100 km 100 km 100 km 100 km


• R=link bandwidth (bps) • d = length of physical link ten-car toll toll ten-car toll toll
caravan booth booth caravan booth booth
• L=packet length (bits) • s = propagation speed in
• time to send bits into link medium (~2x108 m/sec) • cars “propagate” at • Time to “push” entire • Yes! After 7 min, 1st car at 2nd
= L/R • propagation delay = d/s 100 km/hr caravan through toll booth • Cars now “propagate” at booth and 3 cars still at 1st
• toll booth takes 12 sec to onto highway = 12*10 = 120 1000 km/hr booth.
sec
Note: s and R are very service car (transmission • Toll booth now takes 1 min • 1st bit of packet can arrive at
time) • Time for last car to
different quantities! to service a car 2nd router before packet is
transmission • car~bit; caravan ~ packet propagate from 1st to 2nd
A toll both: • Q: Will cars arrive to 2nd fully transmitted at 1st router!
propagation • Q: How long until caravan is 100km/(100km/hr)= 1 hr booth before all cars – See Ethernet applet at AWL Web
lined up before 2nd toll serviced at 1st booth? site
booth? • A: 62 minutes
B
nodal
325 queueing
processingIntroduction 326 327
1-32 Introduction 1-33 Introduction 1-34
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

Queueing delay (revisited) “Real” Internet delays and


Nodal delay
routes
d nodal = d proc + d queue + d trans + d prop • What do “real” Internet delay & loss look like?
• R=link bandwidth (bps)
• L=packet length (bits) • Traceroute program: provides delay measurement
• dproc = processing delay • a=average packet arrival from source to router along end-end Internet path
rate towards destination. For all i:
– typically a few microsecs or less
– sends three packets that will reach router i on path towards
• dqueue = queuing delay
traffic intensity = La/R destination
– depends on congestion – router i will return packets to sender
• dtrans = transmission delay – sender times interval between transmission and reply.
– = L/R, significant for low-speed links ❑ La/R ~ 0: average queueing delay small
• dprop = propagation delay ❑ La/R -> 1: delays become large 3 probes 3 probes
– a few microsecs to hundreds of msecs ❑ La/R > 1: more “work” arriving than can be 3 probes
serviced, average delay infinite!
328 1-35 329 330 1-37
Introduction Introduction 1-36 Introduction
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

“Real” Internet delays and


Packet loss Throughput
routes
traceroute: gaia.cs.umass.edu to www.eurecom.fr
Three delay measurements from • queue (aka buffer) preceding link in buffer has • throughput: rate (bits/time unit) at which
gaia.cs.umass.edu to cs-gw.cs.umass.edu bits transferred between sender/receiver
1 cs-gw (128.119.240.254) 1 ms 1 ms 2 ms finite capacity
2 border1-rt-fa5-1-0.gw.umass.edu (128.119.3.145) 1 ms 1 ms 2 ms
3 cht-vbns.gw.umass.edu (128.119.3.130) 6 ms 5 ms 5 ms
• packet arriving to full queue dropped (aka lost) – instantaneous: rate at given point in time
4 jn1-at1-0-0-19.wor.vbns.net (204.147.132.129) 16 ms 11 ms 13 ms
5 jn1-so7-0-0-0.wae.vbns.net (204.147.136.136) 21 ms 18 ms 18 ms – average: rate over longer period of time
6 abilene-vbns.abilene.ucaid.edu (198.32.11.9) 22 ms 18 ms 22 ms
7 nycm-wash.abilene.ucaid.edu (198.32.8.46) 22 ms 22 ms 22 ms trans-oceanic • lost packet may be retransmitted by previous
link
8 62.40.103.253 (62.40.103.253) 104 ms 109 ms 106 ms
9 de2-1.de1.de.geant.net (62.40.96.129) 109 ms 102 ms 104 ms
10 de.fr1.fr.geant.net (62.40.96.50) 113 ms 121 ms 114 ms
node, by sourcebuffer
end system, or not at all
11 renater-gw.fr1.fr.geant.net (62.40.103.54) 112 ms 114 ms 112 ms (waiting area) packet being transmitted
12 nio-n2.cssi.renater.fr (193.51.206.13) 111 ms 114 ms 116 ms A
13 nice.cssi.renater.fr (195.220.98.102) 123 ms 125 ms 124 ms
14 r3t2-nice.cssi.renater.fr (195.220.98.110) 126 ms 126 ms 124 ms
15 eurecom-valbonne.r3t2.ft.net (193.48.50.54) 135 ms 128 ms 133 ms server,
server sendswith link
bits pipe capacity
that can carry link that
pipe capacity
can carry
16 194.214.211.25 (194.214.211.25) 126 ms 128 ms 126 ms
file of
(fluid) F bits
into pipe Rs bits/sec
fluid at rate Rfluid
c bits/sec
at rate
17 * * *
* means no response (probe lost, router not replying) B
18 * * * packet arriving to to send to client Rs bits/sec) Rc bits/sec)
19 fantasia.eurecom.fr (193.55.113.142) 132 ms 128 ms 136 ms full buffer is lost
331 1-38 332 1-39 333 1-40
Introduction Introduction Introduction
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
Throughput (more) Protocol Hierarchies

• Rs < Rc What is average end-end throughput? • To reduce their design complexity, most n/ws are
organized as a series of layers
Rs bits/sec Rc bits/sec • The contents & functions of each layer differ from
network to network
❑ Rs > Rc What is average end-end throughput? • The entities comprising the corresponding layers on
different machines are called peers.
Rs bits/sec Rc bits/sec • It is the peers that communicate using the protocol.

bottleneck link
link on end-end path that constrains end-end throughput
334 1-41 335 336
Introduction
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

Design Issues for layers Reference Models OSI Reference Model

• Addressing – unique address for each system (How


• The OSI Reference Model
to identify senders & receivers)
• Error Control – error detection and error correction • The TCP/IP Reference Model
• Flow Control – fast sender/slow receiver • A Comparison of OSI and TCP/IP
• Multiplexing – same connection may be used for
multiple conversations
• Routing – when there are multiple paths between
source & a destination

337 338 339

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

TCP/IP Reference Model Comparision

Thank You!

340 341 342

BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
Module 2 - Application Layer Application Layer
• Principle of Network Applications • The application layer enables the user, whether human or software, to access the
• The Web and HTTP Protocol network.

• Email in the Internet • File transfer, access, and management: This application allows a user to access files
in a remote host.
• The Internet Directory Service - DNS
• Peer-to-Peer Applications • Mail services: This application provides the basis for e-mail forwarding and storage.

• Introduction to Socket Programming - with TCP and UDP • Directory services: This application provides distributed database sources and access
for global information about various objects and services.

Computer Networks • Protocol: HTTP, FTP, TELNET, DNS, RLOGIN, SMTP

Session – 2
Prof. C R Sarma
BITS Pilani WILP-BITS-Pilani
Pilani | Dubai | Goa | Hyderabad

343 344 345

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Application Layer Protocols : HTTP, FTP Application Layer Protocols : HTTP, FTP Application Layer Protocols : HTTP, FTP

• Client-server architecture server: • P2P architecture peer-peer • Sockets


• always-on host ▪arbitrary end systems directly
communicate
• permanent IP address ▪peers request service from other peers,
• data centers for scaling provide service in return to other peers
• self scalability – new peers bring
new service capacity, as well as
clients: new service demands
• communicate with server ▪peers are intermittently connected and
change IP addresses
• may be intermittently connected • complex management
• may have dynamic IP
addresses
• do not communicate directly
with each other

346 347 348

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

The Web and HTTP The Web and HTTP Overview of HTTP

• Use of internet : (until 1990) • In the early 1990s, a major new application arrived on the scene—the World • The Hyper Text Transfer Protocol (HTTP), the Web’s application-layer
Wide Web(WWW). protocol, is at the heart of the Web.
• To log in to remote hosts
• first Internet application that was used by public. • HTTP is implemented in two programs: a client program and a server
• To transfer files from local hosts to remote hosts and vice versa program.
• Used for interacting inside and outside their work environments
• To receive and send news, and
• force users to tune in when the content provider makes the content available. • The client program and server program, executing on different end systems,
• To receive and send electronic mail. talk to each other by exchanging HTTP messages
• Easy for any individual to make information available over the Web
• Used by • HTTP defines the structure of these messages and how the client and server
• Hyperlinks and search engines help us navigate through an ocean of Web exchange the messages.
• Researchers sites
• A Web page (also called a document) consists of objects.
• Academics, and • Forms, JavaScript, Java applets, and many other devices enable us to
interact with pages and sites. • An object is simply a file—such as an HTML file, a JPEG image, a Java
• University students applet, or a video clip that is addressable by URL
• Web serves as a platform for many killer applications emerging after 2003,
including YouTube, Gmail, and Facebook. • Most Web pages consist of a base HTML file and several referenced objects.
• E.g. Web page contains HTML text and five JPEG images, then the Web
349 350 351
page has six objects
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Overview of HTTP Overview of HTTP Overview of HTTP
• The base HTML file references the other objects in the page with the objects’ • When a user requests a Web page (clicks on a hyperlink), the browser sends • HTTP Client :
URLs. HTTP request messages for the objects in the page to the server.
• sends HTTP request messages into its socket interface
• Each URL has two components: • The server receives the requests and responds with HTTP response
• the hostname of the server that houses the object and messages that contain the objects. • and receives HTTP response messages from its socket
• the object’s path name.
interface.
• http://www.someSchool.edu/someDepartment/picture.gif • HTTP server:
• receives request messages from its socket interface
hostname object’s path name
• Web browsers (such as Internet Explorer and Firefox) implement the client • sends response messages into its socket interface.
side of HTTP.
• Web servers, which implement the server side of HTTP, house Web objects, • HTTP uses TCP as its underlying transport protocol.
each addressable by a URL
• The HTTP client first initiates a TCP connection with the server.
• E.g. Apache and Microsoft Internet Information Server.
• Once the connection is established, the browser and the server processes
• HTTP
352
defines how Web clients request Web pages from Web servers and 353
access TCP through their socket interfaces. 354
how servers transfer Web pages to clients
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP connections : Non-Persistent and HTTP connections : Non-Persistent


Overview of HTTP Persistent Connections Connection
• TCP provides a reliable data transfer service to HTTP • Client and server communicate for an extended period of time • Suppose user enters URL
www.someSchool.edu/someDepartment/home.index (contains
• Each HTTP request message sent by a client process • Client making a series of requests and the server responding to
text, references to 10 jpeg images)
eventually arrives intact at the server each of the requests.
1a. HTTP client initiates TCP connection to 1b. HTTP server at host
• Each HTTP response message sent by the server process • In client-server interaction is taking place over TCP, the HTTP server (process) at www.someSchool.edu waiting for TCP
connection at port 80. “accepts”
www.someSchool.edu on port 80
eventually arrives intact at the client. application developer needs to make an important decision connection, notifying client

• HTTP need not worry about lost data or the details of how TCP • Should each request/response pair be sent over a separate TCP 2. HTTP client sends HTTP request message 3. HTTP server receives request message,
(containing URL) into TCP connection forms response message containing
recovers from loss or reordering of data within the network. connection ? - non-persistent connections socket. Message indicates that client requested object, and sends message
• Should all of the requests and their corresponding responses be sent wants object into its socket
• Because an HTTP server maintains no information about the over the same TCP connection? - persistent connections
someDepartment/home.index
4. HTTP server closes TCP connection.
clients, HTTP is said to be a stateless protocol. 5. HTTP client receives response message
containing html file, displays html.
Parsing html file, finds 10 referenced jpeg
objects

6. Steps 1-5 repeated for each of 10 jpeg


objects
355 356 357

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP connections : Non-Persistent HTTP connections : Non-Persistent HTTP connections : Non-Persistent


Connections Connections Connections
• • HTTP has nothing to do with how a Web page is interpreted by • Round-Trip Time (RTT):
a client. • The time it takes for a small packet to travel from client to server
• The HTTP specifications define only the communication and then back to the client.
protocol between the client HTTP program and the server HTTP • Includes following delays
program.
• packet-propagation delays,
• Each TCP connection is closed after the server sends the object • packet queuing delays in intermediate routers and switches, and
• Each TCP connection transports exactly one request message • packet-processing delays.
and one response message.

358 359 360

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
HTTP connections : Non-Persistent HTTP connections : Non-Persistent HTTP connections : Non-Persistent
Connections Connections Connections
• • What happens when a user clicks on a hyperlink (URL)? • Non-Persistent HTTP: Response time
• Browser initiate a TCP connection between the browser and Definition of RTT: time for a
the Web server (involves three-way handshake) small packet to travel from
client to server and back.
• The client sends a small TCP segment to the server initiate TCP
Response time: connection
• The server acknowledges and responds with a small TCP RTT
one RTT to initiate TCP
segment, and,finally, the client acknowledges back to the server. request
connection file
• Step 1 and Step 2 – take One RTT one RTT for HTTP request RTT
time to
transmit
• Step 3 - the client sends a small TCP segment to the server, the and first few bytes of HTTP file
file
server acknowledges and responds with a small TCP segment, response to return received
and, finally, the client acknowledges back to the server. file transmission time
time time
• Once the request message arrives at the server, the server total = 2RTT+transmit time
361 362
sends the HTML file into the TCP connection 363

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP connections : Non-Persistent HTTP connections : Non-Persistent HTTP connections : Persistent


Connections Connections Connections
• Non-Persistent HTTP: Response time • Non-Persistent HTTP: Response time – Simulation Demo for HTTP 1.0 • Shortcomings of Non-persistent connections:

• Suppose 10 images need to be downloaded from the HTTP • New connection must be established and maintained for each requested
object.
server. The total time taken to request and download 10 images
• Each of the connection TCP buffers must be allocated and TCP variables must be kept in
in a non-persistent and persistent connection is: both the client and server.
• Non-persistent • Burden on the Web server, which may be serving requests from hundreds of different
clients simultaneously
• 2 RTT (Connection time) + 2 * 10 RTT= 22 RTT • Each object suffers a delivery delay of two RTTs— one RTT to establish the
TCP connection and one RTT to request and receive an object.

364 365 366

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP connections : Persistent HTTP connections : Persistent HTTP connections : Persistent


Connections Connections Connections
• Server leaves connection open after sending response
• Subsequent HTTP messages between same client/server sent over open
connection
• Client sends requests as soon as it encounters a referenced object
• As little as one RTT for all the referenced objects

367 368 369

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
HTTP connections : Persistent
Connections HTTP Message Format HTTP request message
• Persistent Connection and Pipelining • The HTTP specifications include the definitions of the HTTP message • two types of HTTP messages: request, response
formats.
• HTTP request message:
• There are two types of HTTP messages:
– ASCII (human-readable format) carriage return character
• HTTP request messages and
line-feed character
• HTTP response messages request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
carriage return, Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
line feed at start Keep-Alive: 115\r\n
Connection: keep-alive\r\n
of line indicates \r\n
end of header lines

370 371 372

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP request message: general format HTTP request message: general format HTTP request message: general format
• • Message is written in ordinary ASCII text • The GET method is used when the browser requests an object, with the requested object identified in the URL
field.
• The message consists of five lines, each followed by a carriage return and a • E.g. the browser is requesting the object /somedir/page.html from the URL
line feed. • The header line Host: www.someschool.edu specifies the host on which the object resides.
• The first line of an HTTP request message is called the request line. The • The User-agent: header line specifies the user agent, that is, the browser type that is making the request to
the server.
subsequent lines are called the header lines.
• the Accept language: header indicates that the user prefers to receive a French version of the object, if such
• The request line has three fields: an object exists on the server; otherwise, the server should send its default version.

• The method field, the URL field, and the HTTP version field.
• The method field can take on several different values, including GET, POST,
HEAD, PUT, and DELETE.

373 374 375

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP Method types HTTP Method types HTTP response message


• HTTP/1.0 • HTTP/1.1 • status line
• GET • DELETE (protocol
status code HTTP/1.1 200 OK
• POST • deletes file specified in the URL field Connection close
status phrase)
• HEAD • TRACE Date: Thu, 06 Aug 1998 12:00:15 GMT

Server: Apache/1.3.0 (Unix)
• asks server to leave requested object out of response Echoes request msg from server header
Last-Modified: Mon, 22 Jun 1998 …...
• OPTIONS lines
• HTTP/1.1 Content-Length: 6821
• Returns HTTP methods that the server supports Content-Type: text/html
• GET, POST, HEAD
• CONNECT
• PUT data, e.g., data data data data data ...
• TCP/IP tunnel for HTTP requested
• uploads file in entity body to path specified in URL field
HTML file

376 377 378

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
HTTP response message Example 1 Example 2
• Connection: close header line to tell the client that it is going to close the • This example retrieves a document. We use the GET method to retrieve an • This example retrieves information about a document. We use the HEAD
TCP connection after sending the message. image with the path /usr/bin/image1. The request line shows the method method to retrieve information about an HTML document (see the next
• The Date: header line indicates the time and date when the HTTP response (GET), the URL, and the HTTP version (1.1). The header has two lines that section). The request line shows the method (HEAD), URL, and HTTP
was created and sent by the server (time when the server retrieves the object show that the client can accept images in GIF and JPEG format. The request version (1.1). The header is one line showing that the client can accept the
from its file system) does not have a body. The response message contains the status line and document in any format (wild card). The request does not have a body. The
four lines of header. The header lines define the date, server, MIME version, response message contains the status line and five lines of header. The
• The Server: header line indicates that the message was generated by an and length of the document. The body of the document follows the header header lines define the date, server, MIME version, type of document, and
Apache Web server length of the document
• The Last-Modified: header line indicates the time and date when the object
was created or last modified.
• Content-Length: header line indicates the number of bytes in the object being
sent.
• The Content-Type: header line indicates that the object in the entity body is
HTML text.
379 380 381

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Wireshark Example HTTP response status codes File Transfer: FTP


• In first line in server->client response message. • Why do we need a FTP Service?
• A few sample codes: • Purpose: To Transfer files between two computers
• 200 OK • Goals of FTP Service
• request succeeded, requested object later in this message • Promote sharing of files (programs and/or data)
• 301 Moved Permanently • Encourage indirect/implicit use of remote computers
• requested object moved, new location specified later in this message (Location:) • Shield users from variations in file storage among hosts
• 400 Bad Request • Transfer data reliably and efficiently
• request message not understood by server

• 404 Not Found


• requested document not found on this server

• 505 HTTP Version Not Supported

382 383 384

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

File Transfer: FTP File Transfer: FTP FTP Client Commands (issued by user interface)

• FTP session allows user to transfer files to or from a remote host. • User interacts with FTP through an FTP user agent. Command Description
• To access user must provide a user identification and a password. • User provides the hostname of the remote host, causing the FTP client get filename Retrieve file from server
process in the local host to establish a TCP connection with the FTP server Retrieve multiple files from server*
process in the remote host mget filename*
put filename Copy local file to server
• The user then provides the user identification and password, which are sent
over the TCP connection as part of FTP commands. mput filename* Copy multiple local files to server*
• open server Begin login to server

bye / close / exit Logoff server

ls / dir List files in current remote dir on server

lcd Change local directory

cd Change remote directory

rhelp / remotehelp Lists commands the server accepts


385 386 387
* Sent to server as multiple command by User Protocol Interpreter
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
FTP Response format Example FTP Responses FTP’s 2 Connections
Reply Description
client * Non-persistent
Persistent
*Server
Insulates command
users from
data “raw”
1yz Positive preliminary reply.The action is being started but *Serveris
* Routes listening
uses
“raw” FTP oncommands
port port 21
20
expect another reply before sending another cmd. • 120 Service will be ready shortly and reply
forFTP connection
commands
connection
connection requests
2yz Positive completion reply. A new cmd can be sent. for data server’s
* Receives connectionsreplies
3yz Positive intermediate reply. The cmd has been accepted but • 200 Command OK User
another cmd must be sent. Interface
4yz Transient negative completion reply. The requested action • 230 User login OK
did not take place but can be sent later server
5yz Permanent negative completion reply. Cmd not accepted and • 331 User name OK; password is needed
should not be reissued. User Control Server
x0z Syntax errors • 421 Service not available Protocol Protocol
x1z Interpreter Connection 21 Interpreter
Information
• 530 User not logged in
x2z Connections. Replies referring to control or data connections.
• 552 Requested action aborted; exceeded storage allocation
x3z Authentication and accounting User Server
Data
Data Transfer Data Transfer
x4z Unspecified Function Connection 20 Function
388 x5z Filesystem status 389 390

FTP’s2 Connections – Establishment FTP’s 2 Connections FTP’s 2 Connections – Connection


ftp> open strauss.udel.edu Data Transfer Closing
Connected to strauss.udel.edu
220 strauss FTP server ready. bye
client client ls client.txt client
331 Password req for lucasb. -rw-r--r-- lucasb client.txt
User Password:
230 User lucasb logged in. User User
128.4.40.17:5001
128.4.40.17
Interface ftp> Interface Interface
226 (19×256)+137
Closing Data Connection 221
QUITService Closing
USER
PASS lucasb
mypass PORT
LIST
150 128.4.40.17
200 Data
Port Command 19,137
128,4,40,17,19,137
client.txt Sucessful
Connection will be open shortly
server server server

User Server User Server User Server


Protocol Control Protocol Protocol Control Protocol Protocol Control Protocol
Interpreter Connection Interpreter Interpreter Connection Interpreter Interpreter Connection Interpreter
Passive open on
Port 5001
User Data Server User Data Server User Data Server
Data Transfer Data Transfer Data Transfer Data Transfer Data Transfer Data Transfer
Function Connection Function Function Connection Function Function Connection Function

391 392 393


Establish Data Connection

Topics to Discuss Email - Simple Mail Transfer Protocol


• Application Layer • One of the most popular and utilized
• Email - Simple Mail Transfer Protocol application in Internet.
• Domain Name Systems (DNS) • Its architecture consists of several
components
• Three major components:
• User agents
• mail reader
• composing, editing, reading mail messages
Computer Networks • Mail servers
• mailbox contains incoming messages for user
Session – 3 • message queue of outgoing (to be sent) mail
messages
• SMTP protocol between mail servers to send
email messages
BITS Pilani Prof. C R Sarma • client: sending mail server
Pilani | Dubai | Goa | Hyderabad
• “server”: receiving mail server
394 395 396

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Email - Simple Mail Transfer Protocol Email - Simple Mail Transfer Protocol Email - Simple Mail Transfer Protocol
• Electronic Mail: Common scenario
1. When the sender and the receiver of an e-mail are on the Scenario-1: When the sender and the
same system,we need only two user agents. receiver of an e-mail are on the same
2. When the sender and the receiver of an e-mail are on different system, we need only two user agents.
systems, we need two UAs and a pair of MTAs (client and
server).
3. When the sender is connected to the mail server via a LAN or Scenario-3: When the sender is
a WAN, we need two UAs and two pairs of MTAs (client and connected to the mail server via a
LAN or a WAN, we need two UAs
server). and two pairs of MTAs (client and
4. When both sender and receiver are connected to the mail server).
Scenario-2: When the sender and the
server via a LAN or a WAN, we need two UAs, two pairs of receiver of an e-mail are on different
MTAs and a pair of MAAs →This is the most common systems, we need two UAs and a pair
situation today. of MTAs (client and server).

397 398 399

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Email - Simple Mail Transfer Protocol Email - Simple Mail Transfer Protocol Scenario: Alice sends message to Bob

• Uses TCP to reliably transfer email message from 1) Alice uses UA to compose 4) SMTP client sends Alice’s
client to server, port 25 message “to” message over the TCP
[email protected] connection
• Direct transfer: sending server to receiving server
2) Alice’s UA sends message to 5) Bob’s mail server places
• Three phases of transfer
her mail server; message placed the message in Bob’s
• handshaking (greeting) in message queue mailbox
• transfer of messages
3) client side of SMTP opens 6) Bob invokes his user
Scenario-4: When both sender and • closure agent to read message
TCP connection with Bob’s
receiver are connected to the mail server
via a LAN or a WAN, we need two UAs, two • Command/response interaction (like HTTP, FTP) mail server
pairs of MTAs and a pair of MAAs →This is • commands: ASCII text
the most common situation today.
• response: status code and phrase

400 401 402 Bob’s mail server

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Sample SMTP interaction Sample SMTP interaction Mail message format


• An example transcript of messages exchanged between an • HTTP transfers files (also called objects) from a Web server to • When an e-mail message is sent from one person to another, a
SMTP client (C) and an SMTP server (S). a Web client. header containing peripheral information precedes the body of
• The hostname of the client is crepes.fr and the hostname of • SMTP transfers files (that is, e-mail messages) from one mail the message itself
the server is hamburger.edu server to another mail server

• HTTP is mainly a pull protocol


• SMTP is primarily a push protocol

• SMTP requires each message, including the body of each


message, to be in 7-bit ASCII format.
• HTTP data does not impose this restriction

• HTTP encapsulates each object in its own HTTP response


message.
403 • 404
SMTP places all of the message’s objects into one message 405

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Mail message format MIME MIME header
• •

• Each header line contains readable text,


consisting of a keyword followed by a
colon followed by a value.
• Every header must have a From: header
line and a To: header line; a header may
include a Subject: header line as well as
other optional header lines

406 407 408

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

MIME header
• • •

409 410 411

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mail access protocols Mail message format POP3 protocol


• • There are currently a number of popular mail access protocols, •
including Post Office Protocol—Version 3 (POP3), Internet
Mail Access Protocol (IMAP)
• POP: Post Office Protocol [RFC 1939]:
• Protocol is so simple, and its functionality is limited
• POP begins when the user agent (the client) opens a TCP
connection to the mail server.
• POP3 progresses through three phases: authorization,
transaction, and update
• the user agent sends a username and a password (in the clear) to
authenticate the user
• transaction, the user agent retrieves messages
• update, occurs after the client has issued the quit command

412 413 414

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
POP3 protocol POP3 protocol IMAP protocol
• • • IMAP is a mail access protocol.
• An IMAP server will associate each message with a folder;
when a message first arrives at the server, it is associated with
the recipient’s INBOX folder.
• The recipient can then move the message into a new, user-
created folder, read the message, delete the message, and so
on.
• The IMAP protocol provides commands to allow users to create
folders and move messages from one folder to another.
• IMAP also provides commands that allow users to search
remote folders for messages matching specific criteria
• IMAP permit a user agent to obtain components of messages.
• For example, a user agent can obtain just the message header
of a message or just one part of a multipart MIME message.
415 416
https://www.codeproject.com/Articles/404066/Understanding-the-Insides-of-the-POP3-Mail-Protoco 417

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

IMAP protocol IMAP protocol DNS: Domain Name System


• Hosts in Internet are identified by a hostname
• Hostnames → cnn.com, www.yahoo.com, gaia.cs.umass.edu,
and cis.poly.edu
• Hostnames also provide information (if any) about the location
within the Internet of the host.
• E.g.www.eurecom.fr →The host is probably in France
• Hostnames can consist of variable length alphanumeric
characters it would be difficult for the routers to process them
• For these reasons, hosts are also identified by so-called IP
addresses

418 419 420

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Services Provided by DNS Services Provided by DNS DNS: Domain Name System
• Every hostname is associated with IP address • Consider what happens when a browser (that is, an HTTP
• A directory service that translates hostnames to IP addresses client), running on some user’s host, requests the URL
→ Main task of the Internet’s Domain Name System (DNS) www.someschool.edu/index.html
• DNS is • For the user’s host to be able to send an HTTP request
• A distributed database implemented in a hierarchy of DNS servers message to the web server www.someschool.edu, the user’s
• An application-layer protocol that allows hosts to query the distributed host must first obtain the IP address of
database. www.someschool.edu
• DNS is commonly employed by other application-layer 1. The same user machine runs the client side of the DNS application.
protocols - including HTTP, SMTP, and FTP 2. The browser extracts the hostname, www.someschool.edu, from the
URL and passes the hostname to the client side of the DNS
application.
3. The DNS client sends a query containing the hostname to a DNS
server.
4. The DNS client eventually receives a reply, which includes the IP
address for the hostname.
5. Once the browser receives the IP address from DNS, it can initiate a
TCP connection to the HTTP server process located at port 80 at that
421 422 IP address. 423

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Services Provided by DNS Services Provided by DNS Overview of how DNS works?
• Host aliasing • Load distribution • A simple design for DNS would have one DNS server that
• A host with a complicated hostname can have one or more alias names • DNS is also used to perform load distribution among replicated servers, contains all the mappings
• www. relay1.west-coast.enterprise.com could have, say, two aliases such as replicated Web servers. • Clients simply direct all queries to the single DNS server, and
such as enterprise.com and www.enterprise.com • Busy sites are replicated over multiple servers, with each server running the DNS server responds directly to the querying clients.
on a different end system and each having a different IP address
(amazon.com, irctc.co.in) • A centralized database in a single DNS server simply doesn’t
• For replicated Web servers, a set of scale and hence the DNS is distributed by design.
• IP addresses is thus associated with one canonical hostname.
• The DNS database contains this set of IP addresses. When clients
make a DNS query for a name mapped to a set of addresses.
• Mail server aliasing
• DNS can be invoked by a mail application to obtain the canonical
hostname for a supplied alias hostname as well as the IP address of the
host.

424 425 426

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Overview of how DNS works? Overview of how DNS works? Overview of how DNS works?
• The mappings are distributed across the DNS servers. • Top-level domain (TLD) DNS servers
• There are three classes of DNS servers • responsible for com, org, net, edu, aero, jobs, museums, and all top-
level country domains, e.g.: uk, fr, ca, jp
• Root DNS servers
• Network Solutions maintains servers for .com TLD
• contacts authoritative name server if name mapping not known
• Educause for .edu TLD
• gets mapping
• returns mapping to local name server • Authoritative DNS servers
• organization’s own DNS server(s), providing authoritative hostname to
IP mappings for organization’s named hosts
• can be maintained by organization or service provider

13 root name
“servers”
worldwide

427 428 429

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS Lookup Process DNS Lookup Process DNS Lookup Process


• • •

430 431 432

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Local DNS name server DNS: caching, updating records DNS records
• does not strictly belong to hierarchy • once (any) name server learns mapping, it caches mapping DNS: distributed db storing resource records (RR)
• each ISP (residential ISP, company, university) has one • cache entries timeout (disappear) after some time (TTL)
• also called “default name server” • TLD servers typically cached in local name servers
• thus root name servers not often visited
• when host makes DNS query, query is sent to its local DNS
server • cached entries may be out-of-date (best effort name-to-address
• has local cache of recent name-to-address translation pairs (but may be translation!)
out of date!) • if name host changes IP address, may not be known Internet-wide until
• acts as proxy, forwards query into hierarchy all TTLs expire

433 434 435

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956 BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS protocol, messages DNS protocol, messages Inserting records into DNS

• query and reply messages, both with same message • example: new startup “Network Utopia”
format 2 bytes 2 bytes 2 bytes 2 bytes
• register name networkuptopia.com at DNS registrar (e.g.,
Network Solutions)
msg header identification flags identification flags • provide names, IP addresses of authoritative name server (primary and
secondary)
❖ identification: 16 bit # for # questions # answer RRs # questions # answer RRs • registrar inserts two RRs into .com TLD server:
query, reply to query uses (networkutopia.com, dns1.networkutopia.com, NS)
# authority RRs # additional RRs # authority RRs # additional RRs
same # (dns1.networkutopia.com, 212.212.212.1, A)
❖ flags: name, type fields • create authoritative server type A record for
questions (variable # of questions) questions (variable # of questions)
for a query www.networkuptopia.com; type MX record for
▪ query or reply
RRs in response networkutopia.com
▪ recursion desired answers (variable # of RRs) answers (variable # of RRs)
to query
▪ recursion available
records for
▪ reply is authoritative authority (variable # of RRs)
authoritative servers
authority (variable # of RRs)

additional info (variable # of RRs) additional “helpful” additional info (variable # of RRs)
info that may be used
436 437 438

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Attacking DNS
• BITS Pilani
DDoS attacks Redirect attacks Pilani Campus

❖ Bombard root servers ❖ Man-in-middle


with traffic ▪ Intercept queries
▪ Not successful to date ❖ DNS poisoning
▪ Traffic Filtering ▪ Send bogus relies to
▪ Local DNS servers DNS server, which
cache IPs of TLD caches
servers, allowing root Computer Networks
server bypass
Exploit DNS for DDoS Computer Networks CS4
Prof. C R Sarma
❖ Send queries with BITS Pilani
❖ Bombard TLD servers WILP.BITS-PILANI
spoofed source
Pilani Campus

▪ Potentially more
dangerous address: target IP 440 441

❖ Requires amplification
439

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Agenda Socket programming
Socket-programming using TCP
Goal: learn how to build client/server application that Socket: a door between application process and end-end-
1. Socket Programming with TCP / UDP communicate using sockets transport protocol (UCP or TCP)
2. Multiplexing TCP service: reliable transfer of bytes from one process to
3. Sliding window Socket API socket another
• introduced in BSD4.1 UNIX, 1981 a host-local,
• explicitly created, used, released application-created,
by apps OS-controlled interface controlled by
controlled by
• client/server paradigm (a “door”) into which process process application
application developer
application process can developer socket
• two types of transport service via socket
both send and TCP with controlled by
socket API: controlled by TCP with
receive messages to/from operating buffers, buffers, operating
• unreliable datagram internet variables system
another application system variables
• reliable, byte stream-oriented
process
host or host or
server server
442 443 444
2: Application Layer 4 2: Application Layer 5
BITS Pilani, Pilani Campus

Socket programming with TCP Client/server socket interaction: TCP Stream jargon
Client must contact server • When contacted by client, server Server (running on hostid) Client keyboard monitor

• server process must first be TCP creates new socket for server
process to communicate with create socket, • A stream is a sequence of characters that flow
running port=x, for into or out of a process.

inFromUser
client incoming request: input
• server must have created socket • allows server to talk with welcomeSocket = • An input stream is attached to some input
stream

(door) that welcomes client’s ServerSocket() Client


multiple clients source for the process, e.g., keyboard or Process
contact TCP socket. process
• source port numbers used to wait for incoming create socket,
Client contacts server by: distinguish clients (more in connection request connection setup connect to hostid, port=x
• An output stream is attached to an output
connectionSocket = clientSocket =
• creating client-local TCP socket Chap 3) welcomeSocket.accept() Socket() source, e.g., monitor or socket.
• specifying IP address, port

inFromServer
outToServer
send request using
output input
read request from
number of server process clientSocket
application viewpoint
stream stream
connectionSocket
• When client creates socket:
TCP provides reliable, in-order write reply to client TCP
client TCP establishes
transfer of bytes (“pipe”)
clientSocket

connection to server TCP


connectionSocket read reply from socket TCP

between client and server close


clientSocket socket

close to network from network


connectionSocket
445 446 clientSocket 447
2: Application Layer 6 2: Application Layer 7 2: Application Layer 8

Socket programming with TCP Example: Java client (TCP) Example: Java client (TCP), cont.
Example client-server app: import java.io.*;
1) client reads line from standard
import java.net.*; Create BufferedReader inFromServer =
input (inFromUser stream) ,
class TCPClient { input stream new BufferedReader(new
sends to server via socket attached to socket InputStreamReader(clientSocket.getInputStream()));
public static void main(String argv[]) throws Exception
(outToServer stream)
{ sentence = inFromUser.readLine();
2) server reads line from socket String sentence;
Send line
String modifiedSentence;
3) server converts line to uppercase, to server outToServer.writeBytes(sentence + '\n');
sends back to client Create
input stream BufferedReader inFromUser =
4) client reads, prints modified line Read line modifiedSentence = inFromServer.readLine();
new BufferedReader(new InputStreamReader(System.in));
from server
from socket (inFromServer Create System.out.println("FROM SERVER: " + modifiedSentence);
stream) client socket, Socket clientSocket = new Socket("hostname", 6789);
connect to server clientSocket.close();
Create DataOutputStream outToServer =
output stream new DataOutputStream(clientSocket.getOutputStream()); }
attached to socket }
448 449 450
2: Application Layer 9 2: Application Layer 10 2: Application Layer 11
Example: Java server (TCP) Example: Java server (TCP), cont Chapter 2: Application layer
import java.io.*;
import java.net.*;
Create output • 2.6 P2P applications
class TCPServer { stream, attached
• 2.1 Principles of network applications
DataOutputStream outToClient = • 2.7 Socket programming with
to socket • 2.2 Web and HTTP
public static void main(String argv[]) throws Exception new DataOutputStream(connectionSocket.getOutputStream()); TCP
{ Read in line • 2.3 FTP • 2.8 Socket programming with
String clientSentence;
from socket clientSentence = inFromClient.readLine();
Create String capitalizedSentence; • 2.4 Electronic Mail UDP
welcoming socket capitalizedSentence = clientSentence.toUpperCase() + '\n'; • SMTP, POP3, IMAP
ServerSocket welcomeSocket = new ServerSocket(6789);
at port 6789 Write out line
outToClient.writeBytes(capitalizedSentence); • 2.5 DNS
Wait, on welcoming while(true) { to socket
}
socket for contact Socket connectionSocket = welcomeSocket.accept(); }
by client } End of while loop,
BufferedReader inFromClient = loop back and wait for
Create input new BufferedReader(new another client connection
stream, attached InputStreamReader(connectionSocket.getInputStream()));
to socket
451 452 453
2: Application Layer 12 2: Application Layer 13 2: Application Layer 14

Socket programming with UDP Client/server socket interaction: UDP Example: Java client (UDP)
Server (running on hostid)
keyboard monitor

Client
UDP: no “connection” between client and server

inFromUser
input
create socket,
• no handshaking create socket,
clientSocket =
stream
port= x.
• sender explicitly attaches IP address and port DatagramSocket() Client
application viewpoint serverSocket =
DatagramSocket()
Process
process Input: receives
of destination to each packet
packet (recall
UDP provides unreliable transfer Create datagram with server IP and
• server must extract IP address, port of sender Output: sends thatTCP received
from received packet of groups of bytes (“datagrams”) port=x; send datagram via
“byte stream”)
between client and server
read datagram from clientSocket
packet (recall

receivePacket
sendPacket
UDP: transmitted data may be received out of
serverSocket
that TCP sent UDP UDP

“byte stream”)
packet packet
order, or lost write reply to
serverSocket
read datagram from client UDP
clientSocket
specifying
client address,
clientSocket socket UDP
socket
port number close
to network from network
clientSocket

454 455 456


2: Application Layer 15 2: Application Layer 16 2: Application Layer 17

Example: Java client (UDP) Example: Java client (UDP), cont. Example: Java server (UDP)
Create datagram import java.io.*;
import java.io.*;
import java.net.*; with data-to-send, DatagramPacket sendPacket = import java.net.*;
length, IP addr, port new DatagramPacket(sendData, sendData.length, IPAddress, 9876);
class UDPClient { class UDPServer {
public static void main(String args[]) throws Exception Send datagram clientSocket.send(sendPacket); public static void main(String args[]) throws Exception
{ to server Create {
Create DatagramPacket receivePacket =
datagram socket
input stream new DatagramPacket(receiveData, receiveData.length); DatagramSocket serverSocket = new DatagramSocket(9876);
BufferedReader inFromUser = at port 9876
Create new BufferedReader(new InputStreamReader(System.in)); Read datagram
clientSocket.receive(receivePacket);
client socket from server byte[] receiveData = new byte[1024];
DatagramSocket clientSocket = new DatagramSocket(); byte[] sendData = new byte[1024];
String modifiedSentence =
Translate new String(receivePacket.getData());
InetAddress IPAddress = InetAddress.getByName("hostname"); while(true)
hostname to IP {
address using DNS System.out.println("FROM SERVER:" + modifiedSentence);
byte[] sendData = new byte[1024]; Create space for
clientSocket.close(); DatagramPacket receivePacket =
byte[] receiveData = new byte[1024];
}
received datagram
new DatagramPacket(receiveData, receiveData.length);
String sentence = inFromUser.readLine(); } Receive serverSocket.receive(receivePacket);
457
sendData = sentence.getBytes();
458 459
datagram
2: Application Layer 18 2: Application Layer 19 2: Application Layer 20
Transport services and protocols Port numbers for Internet model
Example: Java server (UDP), cont application
transport
String sentence = new String(receivePacket.getData()); • provide logical communication network

between app processes running on data link 16 bit numbers ( between 0 and 65,535)
Get IP addr physical
InetAddress IPAddress = receivePacket.getAddress(); different hosts
port #, of
sender • transport protocols run in end
int port = receivePacket.getPort(); Client Program - ephemeral port - chosen randomly - transport layer software
systems
String capitalizedSentence = sentence.toUpperCase(); • send side: breaks app
running on the client host
sendData = capitalizedSentence.getBytes();
messages into segments,
passes to network layer
Create datagram Server program - well known port numbers- Universal port numbers
DatagramPacket sendPacket = • rcv side: reassembles
to send to client application
new DatagramPacket(sendData, sendData.length, IPAddress, segments into messages, transport
port); network
Write out
passes to app layer data link
physical
datagram serverSocket.send(sendPacket); • more than one transport protocol
to socket } available to apps
} • Internet: TCP and UDP
} End of while loop,
loop back and wait for
460 another datagram 461 462
2: Application Layer 21 Transport Layer 3-22
BITS Pilani, Pilani Campus

Port numbers IP addresses versus port numbers


Multiplexing/demultiplexing
Demultiplexing at rcv host: Multiplexing at send host:
gathering data from multiple
delivering received segments
sockets, enveloping data with
to correct socket
header (later used for
demultiplexing)
= socket = process

application P3 P1
P1
application P2 P4 application

transport transport transport

network network network

link link link

physical physical physical

host 2 host 3
host 1
463 464 465
Transport Layer 3-26
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus

How demultiplexing works


• host receives IP datagrams
Connectionless demultiplexing Connectionless demux (cont)
• each datagram has source IP • When host receives UDP
address, destination IP address 32 bits • Create sockets with port DatagramSocket serverSocket = new DatagramSocket(6428);
numbers: segment:
• each datagram carries 1 source port # dest port #
transport-layer segment • checks destination port P1
DatagramSocket mySocket1 = new P2 P3 P1
• each segment has source, number in segment
DatagramSocket(12534);
destination port number
other header fields • directs UDP segment to socket
DatagramSocket mySocket2 = new with that port number
• host uses IP addresses & port DatagramSocket(12535);
numbers to direct segment to
• IP datagrams with different SP: 6428 SP: 6428
appropriate socket • UDP socket identified by two- DP: 9157 DP: 5775
source IP addresses and/or
application tuple:
data
source port numbers directed
(dest IP address, dest port number) to same socket SP: 9157 SP: 5775
(message) DP: 6428 DP: 6428
client server Client
IP: A IP: C IP:B

TCP/UDP segment format


SP provides “return address”
466 467 468
Transport Layer 3-27 Transport Layer 3-28 Transport Layer 3-29
Connection-oriented demux: Threaded Web
Connection-oriented demux Connection-oriented demux (cont)
Server
• TCP socket identified by 4- • Server host may support
tuple: many simultaneous TCP
• source IP address sockets: P1 P4 P5 P6 P2 P1P3 P1 P4 P2 P1P3
• source port number • each socket identified by its
own 4-tuple SP: 5775 SP: 5775
• dest IP address
DP: 80 DP: 80
• dest port number • Web servers have different S-IP: B S-IP: B
• recv host uses all four values sockets for each connecting D-IP:C D-IP:C
to direct segment to client
appropriate socket • non-persistent HTTP will have SP: 9157 SP: 9157 SP: 9157 SP: 9157
different socket for each client DP: 80 DP: 80 Client client DP: 80 DP: 80 Client
request server server
IP: A S-IP: A
IP: C S-IP: B IP:B IP: A S-IP: A
IP: C S-IP: B IP:B
D-IP:C D-IP:C D-IP:C D-IP:C

469 470 471


Transport Layer 3-30 Transport Layer 3-31 Transport Layer 3-32

UDP: User Datagram Protocol [RFC 768] UDP: more


Chapter 3 outline
• “no frills,” “bare bones” Internet • often used for streaming
• 3.5 Connection-oriented transport protocol multimedia apps 32 bits
• 3.1 Transport-layer services transport: TCP Why is there a UDP?
• “best effort” service, UDP • loss tolerant source port # dest port #
• 3.2 Multiplexing and demultiplexing • segment structure • no connection establishment Length, in
segments may be: (which can add delay) • rate sensitive bytes of UDP length checksum
• 3.3 Connectionless transport: UDP • reliable data transfer • lost segment,
• simple: no connection state at • other UDP uses
• flow control • delivered out of order to including
• 3.4 Principles of reliable data transfer • connection management app
sender, receiver • DNS
header
• small segment header • SNMP
• 3.6 Principles of congestion • connectionless:
• reliable transfer over UDP: add
control • no handshaking between • no congestion control: UDP can Application
UDP sender, receiver blast away as fast as desired reliability at application layer data
• 3.7 TCP congestion control • each UDP segment handled
• application-specific error (message)
recovery!
independently of others

UDP segment format

472 473 474


Transport Layer 3-33 Transport Layer 3-34 Transport Layer 3-35

Internet Checksum Example


UDP checksum • Note
Chapter 3 outline
Goal: detect “errors” (e.g., flipped bits) in transmitted • When adding numbers, a carryout from the most • 3.5 Connection-oriented
segment significant bit needs to be added to the result • 3.1 Transport-layer services transport: TCP
• Example: add two 16-bit integers • 3.2 Multiplexing and demultiplexing • segment structure
Sender: Receiver: • reliable data transfer
• 3.3 Connectionless transport: UDP
• treat segment contents as • compute checksum of received • flow control
sequence of 16-bit integers segment • 3.4 Principles of reliable data transfer • connection management
• checksum: addition (1’s • check if computed checksum • 3.6 Principles of congestion
complement sum) of segment equals checksum field value: 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 control
contents • NO - error detected 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
• sender puts checksum value • YES - no error detected. But • 3.7 TCP congestion control
into UDP checksum field maybe errors nonetheless? wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
More later ….
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
475 476 477
Transport Layer 3-36 Transport Layer 3-37 Transport Layer 3-38
Principles of Reliable data transfer Principles of Reliable data transfer Principles of Reliable data transfer
• important in app., transport, link layers • important in app., transport, link layers • important in app., transport, link layers
• top-10 list of important networking topics! • top-10 list of important networking topics! • top-10 list of important networking topics!

• characteristics of unreliable channel will determine complexity of reliable data • characteristics of unreliable channel will determine complexity of reliable data • characteristics of unreliable channel will determine complexity of reliable data
transfer protocol (rdt) transfer protocol (rdt) transfer protocol (rdt)

478 479 480


Transport Layer 3-39 Transport Layer 3-40 Transport Layer 3-41

Rdt1.0: reliable transfer over a reliable channel


Reliable data transfer: getting started Reliable data transfer: getting started
rdt_send(): called from above, deliver_data(): called by
We’ll: • underlying channel perfectly reliable
(e.g., by app.). Passed data to rdt to deliver data to upper • incrementally develop sender, receiver sides of reliable • no bit errors
deliver to receiver upper layer data transfer protocol (rdt) • no loss of packets

• consider only unidirectional data transfer • separate FSMs for sender, receiver:
• but control info will flow on both directions! • sender sends data into underlying channel
send receive • receiver read data from underlying channel
• use finite state machines (FSM) to specify sender,
side side receiver
event causing state transition
actions taken on state transition Wait for rdt_send(data) Wait for rdt_rcv(packet)
call from call from
state: when in this extract (packet,data)
“state” next state state state
above packet = make_pkt(data)
udt_send(packet)
below deliver_data(data)
1 event
udt_send(): called by rdt, rdt_rcv(): called when packet uniquely determined 2
by next event actions
to transfer packet over arrives on rcv-side of channel sender receiver
unreliable channel to receiver
481 482 483
Transport Layer 3-42 Transport Layer 3-43 Transport Layer 3-44

Rdt2.0: channel with bit errors


rdt2.0: FSM specification rdt2.0: operation with no errors
rdt_send(data) rdt_send(data)
• underlying channel may flip bits in packet snkpkt = make_pkt(data, checksum) receiver snkpkt = make_pkt(data, checksum)
• checksum to detect bit errors udt_send(sndpkt) udt_send(sndpkt)
rdt_rcv(rcvpkt) && rdt_rcv(rcvpkt) &&
• the question: how to recover from errors: Wait for Wait for
isNAK(rcvpkt)
Wait for Wait for
isNAK(rcvpkt)
rdt_rcv(rcvpkt) && rdt_rcv(rcvpkt) &&
• acknowledgements (ACKs): receiver explicitly tells sender that pkt call from ACK or udt_send(sndpkt) corrupt(rcvpkt) call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
received OK above NAK above NAK
udt_send(NAK) udt_send(NAK)
• negative acknowledgements (NAKs): receiver explicitly tells sender
that pkt had errors rdt_rcv(rcvpkt) && isACK(rcvpkt) rdt_rcv(rcvpkt) && isACK(rcvpkt)
• sender retransmits pkt on receipt of NAK Wait for Wait for
L L
call from call from
• new mechanisms in rdt2.0 (beyond rdt1.0): sender below below

• error detection
rdt_rcv(rcvpkt) && rdt_rcv(rcvpkt) &&
• receiver feedback: control msgs (ACK,NAK) rcvr->sender
notcorrupt(rcvpkt) notcorrupt(rcvpkt)
extract(rcvpkt,data) extract(rcvpkt,data)
deliver_data(data) deliver_data(data)
udt_send(ACK) udt_send(ACK)
484 485 486
Transport Layer 3-45 Transport Layer 3-46 Transport Layer 3-47
rdt2.1: sender, handles garbled ACK/NAKs
rdt2.0: error scenario
rdt_send(data)
rdt2.0 has a fatal flaw!
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt) Handling duplicates: sndpkt = make_pkt(0, data, checksum)
rdt_rcv(rcvpkt) && What happens if ACK/NAK corrupted? udt_send(sndpkt) rdt_rcv(rcvpkt) &&
isNAK(rcvpkt) • sender retransmits current pkt if ( corrupt(rcvpkt) ||
Wait for Wait for rdt_rcv(rcvpkt) && • sender doesn’t know what happened at ACK/NAK garbled Wait for Wait for
isNAK(rcvpkt) )
call from ACK or udt_send(sndpkt) corrupt(rcvpkt) receiver! call 0 from ACK or
above NAK • sender adds sequence number above NAK 0 udt_send(sndpkt)
udt_send(NAK) • can’t just retransmit: possible duplicate to each pkt rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
rdt_rcv(rcvpkt) && isACK(rcvpkt) • receiver discards (doesn’t && isACK(rcvpkt) && notcorrupt(rcvpkt)
Wait for deliver up) duplicate pkt && isACK(rcvpkt)
L call from L
L
below Wait for Wait for
stop and wait
ACK or call 1 from
rdt_rcv(rcvpkt) && NAK 1 above
rdt_rcv(rcvpkt) && Sender sends one packet, ( corrupt(rcvpkt) ||
notcorrupt(rcvpkt) rdt_send(data)
then waits for receiver isNAK(rcvpkt) )
extract(rcvpkt,data)
deliver_data(data) response udt_send(sndpkt) sndpkt = make_pkt(1, data, checksum)
udt_send(sndpkt)
udt_send(ACK)
487 488 489
Transport Layer 3-48 Transport Layer 3-49 Transport Layer 3-50

rdt2.1: receiver, handles garbled ACK/NAKs


rdt2.1: discussion rdt2.2: a NAK-free protocol
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq0(rcvpkt)
• same functionality as rdt2.1, using ACKs only
extract(rcvpkt,data)
Sender: Receiver:
deliver_data(data) • instead of NAK, receiver sends ACK for last pkt received OK
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
• seq # added to pkt • must check if received packet is • receiver must explicitly include seq # of pkt being ACKed
rdt_rcv(rcvpkt) && (corrupt(rcvpkt) rdt_rcv(rcvpkt) && (corrupt(rcvpkt)
• two seq. #’s (0,1) will suffice. Why? duplicate
sndpkt = make_pkt(NAK, chksum) sndpkt = make_pkt(NAK, chksum) • state indicates whether 0 or 1 is expected
• duplicate ACK at sender results in same action as NAK:
udt_send(sndpkt)
Wait for
udt_send(sndpkt)
• must check if received ACK/NAK pkt seq # retransmit current pkt
Wait for
0 from corrupted
rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) && below
1 from
below
rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) &&
• note: receiver can not know if its last
has_seq1(rcvpkt) has_seq0(rcvpkt) • twice as many states ACK/NAK received OK at sender
sndpkt = make_pkt(ACK, chksum) sndpkt = make_pkt(ACK, chksum) • state must “remember” whether
udt_send(sndpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
udt_send(sndpkt) “current” pkt has 0 or 1 seq. #
&& has_seq1(rcvpkt)

extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
490 491 492
Transport Layer 3-51 Transport Layer 3-52 Transport Layer 3-53

RDT 1.0 Reliable Channel RDT 2.0 unreliable Channel use ACK & NAK
rdt2.2: sender, receiver fragments
rdt3.0: channels with errors and loss
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
Approach: sender waits
rdt_rcv(rcvpkt) && New assumption: underlying channel “reasonable” amount of time
( corrupt(rcvpkt) || can also lose packets (data or ACKs)
Wait for Wait for
ACK isACK(rcvpkt,1) ) for ACK
call 0 from • checksum, seq. #, ACKs, retransmissions
above 0 udt_send(sndpkt)
will be of help, but not enough • retransmits if no ACK received in
sender FSM RDT 2.1 this time
fragment rdt_rcv(rcvpkt) RDT 2.2
&& notcorrupt(rcvpkt) • if pkt (or ACK) just delayed (not
&& isACK(rcvpkt,0) lost):
rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) || L • retransmission will be
has_seq1(rcvpkt)) Wait for receiver FSM duplicate, but use of seq. #’s
0 from already handles this
udt_send(sndpkt) below fragment
• receiver must specify seq # of
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) pkt being ACKed
&& has_seq1(rcvpkt)
extract(rcvpkt,data) • requires countdown timer
deliver_data(data)
493 sndpkt = make_pkt(ACK1, chksum) 494 495
Transport Layer
udt_send(sndpkt) 3-54 Transport Layer 3-56
rdt3.0 sender
rdt_send(data)
rdt3.0 in action rdt3.0 in action
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(0, data, checksum) ( corrupt(rcvpkt) ||
udt_send(sndpkt) isACK(rcvpkt,1) )
rdt_rcv(rcvpkt) start_timer L
L Wait for Wait
for timeout
call 0from
ACK0 udt_send(sndpkt)
above
start_timer
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
timeout for call 1 from
udt_send(sndpkt) ACK1 above
start_timer rdt_rcv(rcvpkt)
rdt_send(data) L
rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) || sndpkt = make_pkt(1, data, checksum)
isACK(rcvpkt,0) ) udt_send(sndpkt)
start_timer
L
496 497 498
Transport Layer 3-57 Transport Layer 3-58 Transport Layer 3-59

Performance of rdt3.0 rdt3.0: stop-and-wait operation Pipelined protocols


sender receiver Pipelining: sender allows multiple, “in-flight”, yet-to-be-
• rdt3.0 works, but performance stinks first packet bit transmitted, t = 0
acknowledged pkts
• ex: 1 Gbps link, 15 ms prop. delay, 8000 bit packet: last packet bit transmitted, t = L / R • range of sequence numbers must be increased
• buffering at sender and/or receiver
L 8000bits first packet bit arrives
d trans    8 microseconds RTT last packet bit arrives, send ACK
R 109 bps
 U sender: utilization – fraction of time sender busy sending ACK arrives, send next
packet, t = RTT + L / R

U L/R .008
sender
= = = 0.00027
RTT + L / R 30.008 microsec
onds
 1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link L/R .008
U = = = 0.00027
 network protocol limits use of physical resources! sender
RTT + L / R 30.008 microsec
• Two generic forms of pipelined protocols: go-Back-N, selective
onds repeat
499 500 501
Transport Layer 3-60 Transport Layer 3-61 Transport Layer 3-62

Pipelining: increased utilization Pipelining Protocols Selective repeat: big picture


sender receiver
first packet bit transmitted, t = 0
last bit transmitted, t = L / R Go-back-N: big picture: Selective Repeat: big pic • Sender can have up to N unacked packets in pipeline
• Sender can have up to N unacked • Sender can have up to N unacked • Rcvr acks individual packets
first packet bit arrives
RTT packets in pipeline packets in pipeline
last packet bit arrives, send ACK
last bit of 2nd packet arrives, send ACK • Rcvr only sends cumulative acks • Rcvr acks individual packets
• Sender maintains timer for each unacked packet
last bit of 3rd packet arrives, send ACK
• Doesn’t ack packet if there’s a gap • When timer expires, retransmit only unack packet
ACK arrives, send next • Sender maintains timer for each
packet, t = RTT + L / R
• Sender has timer for oldest unacked unacked packet
packet • When timer expires, retransmit only
Increase utilization • If timer expires, retransmit all unacked unack packet
by a factor of 3! packets
U 3*L/R .024
sender
= = = 0.0008
RTT + L / R 30.008 microsecon
ds
502 503 504
Transport Layer 3-63 Transport Layer 3-64 Transport Layer 3-65
Go-Back-N
GBN: sender extended FSM
Sender: GBN: receiver extended FSM
rdt_send(data)
• k-bit seq # in pkt header default
if (nextseqnum < base+N) {
• “window” of up to N, consecutive unack’ed pkts allowed sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt)
&& notcurrupt(rcvpkt)
• send_base: oldest unacked packet udt_send(sndpkt[nextseqnum])
if (base == nextseqnum) L && hasseqnum(rcvpkt,expectedseqnum)
• nextseqnum: smallest unused seqnum start_timer expectedseqnum=1 Wait extract(rcvpkt,data)
nextseqnum++ sndpkt = deliver_data(data)
} make_pkt(expectedseqnum,ACK,chksum) sndpkt = make_pkt(expectedseqnum,ACK,chksum)
L else udt_send(sndpkt)
refuse_data(data) expectedseqnum++
base=1
nextseqnum=1
timeout
start_timer
ACK-only: always send ACK for correctly-received pkt with
Wait
udt_send(sndpkt[base]) highest in-order seq #
≤Sender Window Size (SWS=N) rdt_rcv(rcvpkt) udt_send(sndpkt[base+1])
 nextseqnum - send_base && corrupt(rcvpkt) … • may generate duplicate ACKs
 ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”
udt_send(sndpkt[nextseqnum-1]) • need only remember expectedseqnum
L rdt_rcv(rcvpkt) &&
 may receive duplicate ACKs (see receiver) notcorrupt(rcvpkt) • out-of-order pkt:
 timer for each in-flight pkt
base = getacknum(rcvpkt)+1 • discard (don’t buffer) -> no receiver buffering!
If (base == nextseqnum)
• Is it bad?
 timeout(n): retransmit pkt n and all higher seq # pkts in window stop_timer
505 506
else
507 • Re-ACK pkt with highest in-order seq #
Transport Layer 3-66 Transport Layer
restart_timer 3-67 Transport Layer 3-68

GBN in Selective repeat: sender, receiver windows


Selective Repeat
action
• receiver individually acknowledges all correctly received
pkts
• buffers pkts, as needed, for eventual in-order delivery to upper
layer
• sender only resends pkts for which ACK not received
• sender timer for each unACKed pkt
• sender window
• N consecutive seq #’s
• again limits seq #s of sent, unACKed pkts

508 509 510


Transport Layer 3-69 Transport Layer 3-70 Transport Layer 3-71

Selective repeat Selective repeat in action Selective repeat:


sender receiver
dilemma
pkt n in [rcvbase, rcvbase+N-1] Example:
data from above : • seq #’s: 0, 1, 2, 3
 send ACK(n)
• if next available seq # in window, send pkt  out-of-order: buffer • window size=3
timeout(n):  in-order: deliver (also
• resend pkt n, restart timer deliver buffered, in-order
• receiver sees no difference
pkts), advance window to
ACK(n) in [sendbase,sendbase+N]: in two scenarios!
next not-yet-received pkt
• mark pkt n as received • incorrectly passes duplicate
pkt n in [rcvbase-N,rcvbase-1] data as new in (a)
• if n smallest unACKed pkt, advance window  ACK(n), why?
base to next unACKed seq #
otherwise: Q: what relationship between
 ignore seq # size and window size?

511 512 513


Transport Layer 3-72 Transport Layer 3-73 Transport Layer 3-74
Relationship b/w seq# & window sizes BITS Pilani
Pilani|Dubai|Goa|Hyderabad

• LAF – LFR <= RWS


where LAF: Largest Acceptable frame
LFR: recv_base – 1: Last Frame Received
IP address
• RWS=1 for Go-Back-N protocol port numbers
mac address
• RWS <= SWS for Selective Repeat proto hardware address
• When RWS=1, SWS <= N -1 (N=size of seq# space= 2^k for k-bit seq no field)
• When RWS=SWS, SWS <= N/2 Contact Session 9
Network Layer
SW protocol alternates b/w two halves of seq# space
It also continually slides b/w two halves rather than discretely alternating b/w them Prof. C R Sarma
514
Transport Layer 3-75
515 516 WILP.BITS-PILANI
BITS Pilani, Pilani Campus

Position of IP in TCP/IP protocol suite


Position of network layer The Internet Network layer
Host, router network layer functions:

Transport layer: TCP, UDP

IP Protocol
Routing protocols
• Addressing Conventions
• Path selection
• Datagram Format
• RIP, OSPF, BGP
• Packet Handling Conventions
Network
layer
forwarding
table ICMP protocol
• Error reporting
• Router “signaling”

Link layer

517 518 519


physical layer

Description of the network layer Internetworking Network layer in an internetwork


• The network layer is concerned with getting packets from the source all the
way to the destination.
• To achieve its goals, the network layer must know about the topology of the
communication subnet and choose appropriate paths through it.
• It must also take care to choose routes to avoid overloading some of the
communication lines and routers while leaving others idle.

• A host with a packet to send transmits it to the nearest router, either on its own
LAN or over a point-to-point link to the carrier.
• The packet is stored there until it has fully arrived so the checksum can be
verified.
• Then it is forwarded to the next router along the path until it reaches the
destination host, where it is delivered.

520 This mechanism is store-and-forward packet switching, 521 522
Network layer at the source Network layer at a router Network layer at the destination

523 524 525

• Two different organizations are possible, depending on the type of


• The routers' job is moving packets around and nothing service offered.
else. • If connectionless service is offered, packets are injected into the subnet
• In their view , the subnet is inherently unreliable, no individually and routed independently of each other.
matter how it is designed. • No advance setup is needed.
• Therefore, the hosts should accept the fact that the Virtual Circuits vs Datagram Networks • In this context, the packets are frequently called datagrams and the
network is unreliable and do error control (i.e., error subnet is called a datagram subnet.
detection and correction) and flow control themselves.
• If connection-oriented service is used, a path from the source router to
• So the network service should be connectionless. the destination router must be established before any data packets can
be sent.
• This connection is called a VC (virtual circuit) and the subnet is called a
The Internet offers connectionless network-layer service
virtual circuit subnet.
526 527 528

Virtual circuit packet switched n/w • For connection-oriented service, we need a virtual-circuit subnet. Virtual circuit: Sending Request packet
• The idea behind virtual circuits is to avoid having to choose a new route for
every packet sent.
• Instead, when a connection is established, a route from the source machine
to the destination machine is chosen as part of the connection setup and
stored in tables inside the routers.

• That route is used for all traffic flowing over the connection, exactly the
same way that the telephone system works.
• When the connection is released, the virtual circuit is also terminated.
• With connection-oriented service, each packet carries an identifier telling
which virtual circuit it belongs to.
529 530 531
Virtual circuit: Sending Ack packet Virtual circuit: Data transfer Comparison of Virtual-Circuit and Datagram Subnets

5-4

532 533 534

Performance Metrics Effect on Performance


Delay, Throughput, Packet loss

Inside the Router

535 536 537

Router Architecture Overview


Continued… Router architecture
Two Key Router Functions: High-level view of generic router architecture:
Routing Information Protocol
• Run Routing Algorithms/Protocol (RIP, OSPF, BGP) Open Shortest Path First. Routing, management
Border Gateway Protocol Routing Control plane (software)
• Forwarding Datagrams From Incoming To Outgoing Link Processor Operates in millisecond
Time frame
Forwarding data plane
(hardware) operates in
nanosecond timeframe

High-speed
Switching
Fabric

Router input ports Router output ports


538 539 540
Input port functions Switching fabrics Three types of switching fabrics
 Switching fabric is a combination of hardware and software that controls traffic to and from a
network node with the use of multiple switches.
 Transfer packet from input link to appropriate output link
lookup,
link Forwarding  Switching rate: rate at which packets can be transfer from inputs to outputs
layer Switch
line
protocol • Often measured as multiple of input/output line rate
termination Fabric
(receive) • N inputs: switching rate N times line rate desirable
queueing
1 Gb/s bus in Cisco 1900:
sufficient speed for access and
Physical layer: Decentralized Switching: enterprise routers (not regional or
Bit-level reception  Using Header Field Values, Lookup Output Port Using
backbone)
R (rate: NR, R
Forwarding Table In Input Port Memory (“Match Plus ideally)
Link layer: Action”)

...
...
 Goal: Complete Input Port Processing At ‘Line Speed’ N input ports N output ports
E.G., Ethernet high-speed
 Input Port Queuing: If Datagrams Arrive Faster Than switching
fabric
Forwarding Rate Into Switch Fabric
Cisco 12000: switches
 Destination-based Forwarding: Forward Based Only R R
Gb/s through the
On Destination IP Address (Traditional)
541 542 543 interconnection network
 Generalized Forwarding: Forward Based On Any Set Of
Header Field Values

Switching via memory Switching via a bus Switching via interconnection network
First generation routers:  Crossbar, close networks, other interconnection
 Datagram from input port memory nets initially developed to connect processors in
• Traditional computers with switching under direct control of CPU
To output port memory via a shared bus multiprocessor
• Packet copied to system’s memory
• Speed limited by memory bandwidth (2 bus crossings per  Bus contention: switching speed limited by bus bandwidth  Multistage switch: nxn switch from
datagram)  32 GBPS bus, cisco 5600: sufficient speed for access routers multiple stages of smaller switches 3x3 crossbar

Input Output
 Advanced switch design:
Port
(E.G., memory
Port
(E.G.,
– Fragment datagram into fixed length cells on
Ethernet) Ethernet) entry
– Switch cells through the fabric, reassemble
datagram at exit
8x8 multistage switch
544 system bus 545 546 built from smaller-sized switches
Network Layer: 4-30

Switching via interconnection network Input port queuing Output port queuing
• If switch fabric slower than input ports combined -> queueing may occur
 Scaling, using multiple switching “planes” in parallel datagram
at input queues switch buffer
link
fabric layer line
 Cisco CRS router: – queueing delay and loss due to input buffer overflow! queueing
protocol
(send)
termination

 Basic unit: 8 switching fabric plane 0


fabric plane 1
planes fabric plane 2
Head-of-the-Line (HOL) blocking: queued datagram at front of queue
. . .. . .
. . .. . .

 Each plane: 3-stage fabric plane 3 prevents others in queue from moving forward
 Buffering required when datagrams
fabric plane 4
interconnection network
. . .. . .
. . .. . .

fabric plane 5 arrive from fabric faster than the Datagram (packets) can be lost
 Up to 100’s TBPS fabric plane 6
transmission rate due to congestion, lack of
. . .. . .
. . .. . .

fabric plane 7
switching capacity switch switch buffers
fabric fabric
 Scheduling discipline chooses
. . .. . .
. . .. . .

among queued datagrams for Priority scheduling – who


Output port contention: only one red datagram can be One packet time later: green packet transmission gets best performance,
547 548
transferred. Lower red packet is blocked experiences HOL blocking
549
network neutrality
Network Layer: 4-32
Output port queuing How much buffering?
• RFC 3439 rule of thumb: average buffering equal to “typical” RTT (say
switch 250 msec) times link capacity C • What is the transmission time of a packet sent by a station if
switch
fabric
fabric
– e.g., C = 10 Gbps link: 2.5 Gbit buffer the length of the channel 2 million bytes and the bandwidth is
 more recent recommendation: with N flows, buffering equal to 300 kbps?
at t, packets more one packet time later RTT. C • Ans: Transmission time = (packet l = 2million bytes / 300kbps =
from input to output
N 2000000 bytes / 300000 bps =6.67 s
 But too much buffering can increase delays (particularly in home
Buffering when arrival rate via switch exceeds output line speed routers)
• Recall delay-based congestion control: “keep bottleneck link just full
Queueing (delay) and loss due to output port buffer overflow! enough (busy) but no fuller”
• Long RTTS: sluggish TCP response, poor performance for real time apps
550 551 552
Network Layer: 4-35

DHCP: Dynamic Host Configuration Protocol DHCP client-server scenario


A DHCP 223.1.2.1
Goal: allow host to dynamically obtain its IP address from network 223.1.1.1
server
server when it joins network
Can renew its lease on address in use 223.1.1.2

DHCP , NAT , ARP Allows reuse of addresses (only hold address while connected an “on”) 223.1.1.4 223.1.2.9

B
223.1.2.2 arriving DHCP
DHCP overview: 223.1.1.3 223.1.3.27 E client needs
address in this
– Host broadcasts “DHCP discover” msg network
223.1.3.1 223.1.3.2
– DHCP server responds with “DHCP offer” msg
– Host requests IP address: “DHCP request” msg
– DHCP server sends address: “DHCP ack” msg
553 554 555

DHCP client-server scenario


DHCP server: 223.1.2.5 DHCP discover
arriving
DHCP server and client communication Network Address Translation (NAT)
client
src : 0.0.0.0, 68
• The first step is when the client broadcasts the DHCPDISCOVER message over the network channel
• Network Address Translation (NAT) is a process in which
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654 to establish a network connection with the DHCP server.
DHCP offer • This message indicates that the client device wants to connect to the internet through the DHCP one or more local IP address is translated into one or more
server.
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
• The second step is when the DHCP server receives the DHCPDISCOVER message. According to the Global IP address and vice versa in order to provide Internet
access to the local hosts.
yiaddrr: 223.1.2.4
transaction ID: 654 message, the DHCP server reserves an IP address for the connecting client and other network
Lifetime: 3600 secs
configuration settings, including subnet-mask default gateway, preferred DNS server, and shares
• Also, it does the translation of port numbers i.e. masks the
DHCP request
src: 0.0.0.0, 68
it with the client device through the DHCPOFFER message.
• In the third step, the client responds to the DHCP server’s DHCPOFFER through a DHCPREQUEST
port number of the host with another port number, in the
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655 message requesting the offered IP address and relevant network configuration sent by the DHCP
time Lifetime: 3600 secs server for the system. packet that will be routed to the destination. It then makes
• In the last step, the server acknowledges the DHCPREQUEST broadcast from the client device and
the corresponding entries of IP address and port number in
DHCP ACK
src: 223.1.2.5, 67 sends the DHCPACK packet to the DHCP client, which comprises the required network configuration
for the client device.
the NAT table. NAT generally operates on a router or firewall.
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs

556 557 558


Network Address Translation (NAT) working NAT: Network Address Translation NAT: Network Address Translation
– • Motivation: local network uses just one IP address as far as outside world
is concerned:
• Generally, the border router is configured for NAT i.e the rest of
Internet
local network
(e.g., home network)
router which has one interface in the local (inside) 10.0.0/24 10.0.0.1 – No need to be allocated range of addresses from ISP: - just
network and one interface in the global (outside) network. 10.0.0.4
10.0.0.2
one IP address is used for all devices
When a packet traverse outside the local (inside) network, 138.76.29.7 – Can change addresses of devices in local network without
then NAT converts that local (private) IP address to a 10.0.0.3 notifying outside world
global (public) IP address. When a packet enters the local – Can change ISP without changing addresses of devices in local
All datagrams leaving local Datagrams with source or
network, the global (public) IP address is converted to a network have same single source NAT IP destination in this network network
local (private) IP address. address: 138.76.29.7, have 10.0.0/24 address for
different source port numbers source, destination (as usual) – Devices inside local net not explicitly addressable, visible by
outside world (a security plus).
559 560 561

NAT: Network Address Translation NAT: Network Address Translation NAT: Network Address Translation

Implementation: NAT router must: • 16-bit port-number field:


– Outgoing datagrams: replace (source IP address, port #) of 2: NAT router
NAT translation table
WAN side addr LAN side addr
1: host 10.0.0.1 – 60,000 simultaneous connections with a single LAN-side
sends datagram to
every outgoing datagram to (NAT IP address, new port #) changes datagram
138.76.29.7, 5001 10.0.0.1, 3345 128.119.40.80 address!
source addr from
. . . remote clients/servers will respond using (NAT IP address, new …… ……
port #) as destination addr.
10.0.0.1, 3345 to
138.76.29.7, 5001, S: 10.0.0.1, 3345
• NAT is controversial:
updates table D: 128.119.40.186, 80

1
10.0.0.1 – routers should only process up to layer 3
– Remember (in NAT translation table) every (source IP address,
– violates end-to-end argument
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
port #) to (NAT IP address, new port #) translation pair 10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4 • NAT possibility must be taken into account by app designers, eg,
– Incoming datagrams: replace (NAT IP address, new port #) in P2P applications
S: 128.119.40.186, 80
D: 138.76.29.7, 5001 3 10.0.0.3
4: NAT router
3: Reply arrives
dest fields of every incoming datagram with corresponding dest. address:
changes datagram
– address shortage should instead be solved by IPv6
dest addr from
(source IP address, port #) stored in NAT table 138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345
562 563 564

Address Translation with ARP Address Translation with ARP ARP Packet Format
ARP Request:
ARP Reply:
Argon broadcasts an ARP request to all stations on the Ethernet II header

Router 137 responds with an ARP Reply which contains the


network: “What is the hardware address of Router137?” Destination
address
Source
address
Type
0x8060
ARP Request or ARP Reply Padding CRC

hardware address 6 6 2 28 10 4
Argon Router137
128.143.137.144 128.143.137.1 Argon Router137
00:a0:24:71:e4:44 128.143.137.144 128.143.137.1
00:e0:f9:23:a8:20
00:a0:24:71:e4:44 00:e0:f9:23:a8:20 Hardware type (2 bytes) Protocol type (2 bytes)

ARP Request: Hardware address Protocol address


Operation code (2 bytes)
What is the MAC address ARP Reply: length (1 byte) length (1 byte)
of 128.143.71.1? The MAC address of 128.143.71.1
Source hardware address*
is 00:e0:f9:23:a8:20
Source protocol address*

Target hardware address*

Target protocol address*

* Note: The length of the address fields is determined by the corresponding address length fields
565 566 567
Contact Session - 10
Proxy ARP Things to know about ARP
• Proxy ARP: Host or router responds to ARP Request that arrives
from one of its connected networks for a host that is on another • What happens if an ARP Request is made for a non-existing host?
Several ARP requests are made with increasing time
of its connected networks. intervals between requests. Eventually, ARP gives up.

• On some systems (including Linux) a host periodically sends ARP


Requests for all addresses listed in the ARP cache. This refreshes
the ARP cache content, but also introduces traffic. Forwarding and Addressing in the
Internet
• Gratuitous ARP Requests: A host sends an ARP request for its own Prof. C R Sarma
IP address: WILP.BITS-Pilani
– Useful for detecting if an IP address has already been assigned. BITS Pilani

568 569 570

IP datagram format The Internet network layer IP fragmentation, reassembly


IP protocol version 32 bits
number Total datagram
Length (bytes) Host, router network layer functions:
Header length
ver head. type of length Network links have MTU
(Bytes) len service
“Type” of data fragment
For
Transport layer: TCP, UDP
(max.Transfer size) - largest
16-bit identifier flgs Fragmentation/
offset Reassembly possible link-level frame Fragmentation:


Max number time to upper header
IP protocol § Different link types, different mtus In: one large datagram
Remaining hops live layer checksum Routing protocols Out: 3 smaller datagrams
(Decremented at • Path selection • Addressing conventions
32 bit source IP address • RIP, OSPF, BGP • Datagram format
Each router) Network • Packet handling conventions Large IP datagram divided
32 bit destination IP address
Upper layer protocol Layer Forwarding (“fragmented”) within net
To deliver payload to options (if any) E.G. Timestamp, Table
ICMP protocol § One datagram becomes several Reassembly
Record route • Error reporting
• Router
datagrams
How much overhead? data Taken, specify
“signaling” § “Reassembled” only at final
(variable length, List of routers
 20 bytes of tcp Link layer destination
typically a TCP To visit.
20 bytes of IP § IP header bits used to identify, order



or UDP segment) related fragments
 = 40 bytes + app Physical layer
layer overhead
571 2 572 3 573 4

BITS Pilani BITS Pilani BITS Pilani

IP fragmentation, reassembly IP Addressing: Introduction Subnets


length ID fragflag offset
IP address: 32-bit identifier for host,
223.1.1.1
IP address:
example: =4000 =x =0 =0 223.1.1.1

 4000 byte datagram router interface 223.1.2.1


• Subnet part - high order bits
 MTU = 1500 bytes one large datagram becomes 223.1.1.2
223.1.1.4 223.1.2.9 • Host part - low order bits 223.1.1.2 223.1.2.1
several smaller datagrams
Interface: connection between 223.1.1.4 223.1.2.9

host/router and physical link


what’s a subnet ?
223.1.3.27
1480 bytes in 223.1.1.3 223.1.2.2
length ID fragflag offset
• Router’s typically have multiple 223.1.2.2
223.1.1.3 223.1.3.27
• Device interfaces with same
data field =1500 =x =1 =0
interfaces
subnet part of IP address
subnet
offset = length ID fragflag offset • Host typically has one or two 223.1.3.1 223.1.3.2
1480/8 =1500 =x =1 =185 interfaces (e.G., Wired • Can physically reach each 223.1.3.2
ethernet, wireless 802.11) other without intervening
223.1.3.1

length ID
=1040 =x
fragflag
=0
offset
=370
223.1.1.1 = 11011111 00000001 00000001 00000001
router
IP addresses associated with each 223 1 1 1
network consisting of 3 subnets
574 5 575 interface 576
7
BITS Pilani 6 BITS Pilani BITS Pilani
Subnets
223.1.1.0/24
Recipe 223.1.2.0/24 limitations of classful IP addressing that CIDR overcomes? benefits of CIDR?
223.1.1.1 With Classless Inter-Domain Routing (CIDR), your organization has more
 To determine the subnets, Before Classless Inter-Domain Routing (CIDR), IP addresses were
flexibility in assigning IP addresses and routing data between devices.
detach each interface from its 223.1.1.2 223.1.2.1 classful and created inefficiencies.
Reduce IP address wastage
host or router, creating islands
223.1.1.4 223.1.2.9
Inflexible IP addressing CIDR provides flexibility when you determine the network and host identifier
of isolated networks 223.1.2.2 In a classful addressing system, each class supported a fixed assignments on an IP address. You can use CIDR to provision the required
223.1.1.3 223.1.3.27
number of devices: number of IP addresses for a particular network and reduce wastage.
subnet • Class A supported 16,777,214 hosts Besides, CIDR reduces routing table entries and simplifies data packet
routing.
 Each isolated network is called a 223.1.3.2 • Class B supported 65,534 hosts Transmit data quickly
subnet
223.1.3.1
• Class C supported 254 hosts CIDR allows routers to organize IP addresses into multiple subnets more
efficiently. A subnet is a smaller network that exists within a network. For
223.1.3.0/24 example, all devices connected to a router are on the same subnet and have
the same IP address prefix.
577 subnet
8 mask: /24 578 9 579 10

BITS Pilani BITS Pilani BITS Pilani

IP addressing: CIDR IP addresses: how to get one?


With CIDR, your organization can create and consolidate multiple subnets. This allows data to
reach the destination address without taking unnecessary paths. CIDR: classless interdomain routing
Q: how does network get subnet part of IP addr?
Create a Virtual Private Cloud  Subnet portion of address of arbitrary length
A: gets allocated portion of its provider ISP’s address space
A virtual private cloud (VPC) is a private digital space hosted within the cloud. It allows your
organization to provision workloads in an isolated and secure environment. A VPC uses
 Address format: A.B.C.D/x, where x is # bits in subnet portion of
CIDR IP addresses when it transfers data packets between connected devices. address
Create supernets flexibly ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20
A supernet is a group of subnets with similar network prefixes. CIDR allows flexibility in creating
supernets, which isn’t possible in conventional masking architecture. For example, your
organization can combine IP addresses into a single network block using a notation like this: subnet host Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23
part part
• 192.168.1 /23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
• 192.168.0 /23 11001000 00010111 0001000 0 00000000 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
This notation applies a subnet mask of 255.255.254.0 to the IP address, which returns the first
200.23.16.0/23 ... ….. …. ….
23 bits as the network address. The router needs only one routing table entry to manage
data packets between devices on the subnets. Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

580 11 581 12 582 13

BITS Pilani BITS Pilani BITS Pilani

Hierarchical addressing: more specific routes IP addressing: the last word...


Hierarchical Addressing: Route Aggregation
Hierarchical addressing allows efficient advertisement of routing ISPs-R-Us has a more specific route to Organization 1
information: Q: How does an ISP get block of addresses?
Organization 0
Organization 0
200.23.16.0/23
A: ICANN: Internet Corporation For Assigned Names And Numbers
200.23.16.0/23 http://www.ICANN.Org/
“Send me anything
Organization 1
200.23.18.0/23
“Send me anything with addresses  Allocates addresses
 Manages DNS
with addresses Organization 2 beginning
beginning
...
Organization 2
200.23.16.0/20” 200.23.20.0/23 Fly-By-Night-ISP 200.23.16.0/20”
 Assigns domain names, resolves disputes
.
...
200.23.20.0/23 . Fly-By-Night-ISP
.
Internet
. Organization 7
. Internet
Organization 7 .
200.23.30.0/23
200.23.30.0/23
“Send me anything
ISPs-R-Us
“Send me anything with addresses
ISPs-R-Us with addresses Organization 1 beginning 199.31.0.0/16
beginning or 200.23.18.0/23”
583 199.31.0.0/16”
14
584 200.23.18.0/23 15 585 16

BITS Pilani BITS Pilani BITS Pilani


IPv6: motivation IPv6 datagram format Transition from IPv4 to IPv6
Initial motivation: 32-bit address space soon to be completely Priority: identify priority among datagrams in flow Not all routers can be upgraded simultaneously
• No “flag days”
allocated. Flow label: identify datagrams in same “flow.” • How will network operate with mixed IPV4 and IPV6 routers?
Additional motivation: (Concept of“flow” not well defined).
• Header format helps speed processing/forwarding Next header: identify upper layer protocol for data Tunneling: IPV6 datagram carried as payload in IPV4 datagram among IPV4
routers
• Header changes to facilitate QOS Ver Pri Flow label
IPv4 header fields IPv6 header fields
Payload len Next hdr Hop limit IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
Source address
IPV6 datagram format: (128 bits) UDP/TCP payload

• Fixed-length 40 byte header Destination address


(128 bits)
• No fragmentation allowed
Data
IPv6 datagram
586 17 587 32 bits 18 588 IPv4 datagram 19

BITS Pilani BITS Pilani BITS Pilani

Interplay between routing, forwarding


Tunneling Graph Abstraction: Costs
A B IPv4 tunnel
connecting IPv6 routers E F Routing algorithm determines
routing algorithm 5
End-end-path through network C(x,x’) = cost of link (x,x’)
3 E.G., C(w,z) = 5
Logical view: Forwarding table determines v w 5
local forwarding table 2
Local forwarding at this router Cost could always be 1, or
dest address output link u
address-range 1 3
2
3
1 z Inversely related to bandwidth,
IPv6 IPv6 IPv6
address-range 2 2 1 2 Or inversely related to
IPv6 address-range 3
address-range 4
2
1
x 1
y
Congestion

A B C D E F IP destination address in

Physical view:
arriving packet’s header cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
1
3 2
Key question: what is the least-cost path between u and z ?
Routing algorithm: algorithm that finds that least cost path
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6

589 20 590 21 591 22

BITS Pilani BITS Pilani BITS Pilani

Routing Algorithm Classification A Link-State Routing Algorithm Dijsktra’s Algorithm


Q: global or decentralized
information?
Q: static or dynamic? Dijkstra’s algorithm
Net topology, link costs known to
notation: 1 Initialization:
Global:  c(x,y): link cost from node x to y;
2 N' = {u}
• All routers have complete Static: all nodes = ∞ if not direct neighbors
3 for all nodes v
• Accomplished via “link state 4 if v adjacent to u
topology, link cost info  Routes change slowly over broadcast”  D(v): current value of cost of path 5 then D(v) = c(u,v)
• “Link state” algorithms time • All nodes have same info from source to dest. v 6 else D(v) = ∞
 p(v): predecessor node along path 7
Dynamic: Computes least cost paths from
from source to v 8 Loop
Decentralized: one node (‘source”) to all other
 Routes change more quickly
9 find w not in N' such that D(w) is a minimum
• Router knows physically- nodes  N': set of nodes whose least cost 10 add w to N'
path definitively known
connected neighbors, link costs to Periodic update • Gives forwarding table for that 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) )
neighbors node
• Iterative process of computation, In response to link cost Iterative: after k iterations, know
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 */
exchange of info with neighbors changes least cost path to k dest.’S 15 until all nodes in N'
• 592“Distance vector” algorithms 23 593 24 594 25

BITS Pilani BITS Pilani BITS Pilani


Dijkstra’s algorithm: example Dijkstra’s algorithm, discussion Distance vector algorithm
D(v) D(w) D(x) D(y) D(z) Algorithm complexity: N nodes
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞ Each iteration: need to check all nodes, W, not in N Bellman-Ford equation (dynamic programming)

1
2
uw
uwx
6,w
6,w
5,u 11,w
11,w 14,x
N(n+1)/2 comparisons: o(n2) let
3 uwxv 10,v 14,x More efficient implementations possible: o(nlogn) dx(y) := cost of least-cost path from x to y
then
4 uwxvy 12,y
5 uwxvyz x Oscillations possible: dx(y) = min {c(x,v) + dv(y) }
9
E.G., Support link cost equals amount of carried traffic:
Notes: 5 7
4 v
 Construct shortest path tree by tracing 8
1
A 1+e 2+e
A
0 0
A 2+e 2+e
A
0
predecessor nodes D B D B D B D B
3 w z
0 0 1+e 1 0 0 1+e 1
cost from neighbor v to destination y
 Ties can exist (can be broken u y
2
0
C
e 0 0 1 0 0
arbitrarily) 1 1
C C 1+e C cost to neighbor v
3
e
7 4 given these costs, given these costs, given these costs,
initially find new routing…. find new routing…. find new routing…. min taken over all neighbors v of x
595 v 26 596 resulting in new costs resulting in new costs resulting
27 in new costs 597 28

BITS Pilani BITS Pilani BITS Pilani

Bellman-Ford example Distance vector algorithm Distance vector algorithm


5 Key idea:
Dx(y) = estimate of least cost from x to y
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3  From time-to-time, each node sends its own distance vector estimate to
v 3 w 5
• x maintains distance vector Dx = [Dx(y): y є N ]
2 neighbors
u 2 1 z B-F equation says:  When x receives new DV estimate from neighbor, it updates its own DV using
3
1 2 du(z) = min { c(u,v) + dv(z), node x: B-F equation:
x y
• Knows cost to each neighbor v: c(x,v)
1 c(u,x) + dx(z),
c(u,w) + dw(z) } • Maintains its neighbors’ distance vectors. For each neighbor v, x
= min {2 + 5, maintains Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
1 + 3, Dv = [Dv(y): y є N ]
 Under minor, natural conditions, the estimate dx(y) converge to the actual
5 + 3} = 4
least cost dx(y)

Node achieving minimum is next Hop in shortest path, used in forwarding table
598 29 599 30 600 31

BITS Pilani BITS Pilani BITS Pilani

Dx(z) = min{c(x,y) + Dx(z) = min{c(x,y) +


Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
Distance vector algorithm = min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
= 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 node x cost to cost to cost to
Iterative, asynchronous: Each node: table x y z x y z table x y z x y z x y z

• Each local iteration caused


x 0 2 7 x 0 2 3 x 0 2 7 x 0 2 3 x 0 2 3
from

from
from

from
y ∞∞ ∞ y 2 0 1 y ∞∞ ∞ y 2 0 1

from
y 2 0 1
by: local link cost change wait for (change in local link cost or msg z ∞∞ ∞ z 7 1 0 z ∞∞ ∞ z 7 1 0 z 3 1 0
• DV update message from from neighbor) node y cost to node y cost to cost to
neighbor
cost to
table x y z y table x y z x y z x y z y
2 1 2 1
x ∞ ∞
∞ x ∞ ∞ x 0 2 7 x 0 2 3
recompute estimates x z x z
from

from

from
y 2 0 1 7 y 2 0 1 y 2 0 1 7

from
Distributed: z ∞∞ ∞ z ∞∞ ∞ z 7 1 0
y 2 0 1
z 3 1 0
Each node notifies neighbors
only when its DV changes if DV to any dest has changed, notify node z cost to
table x y z
node z cost to
table x y z
cost to
x y z
cost to
x y z
neighbors
• Neighbors then notify their x ∞∞ ∞ x ∞∞ ∞ x 0 2 7 x 0 2 3
neighbors if necessary

from

from
y 2 0 1 y 2 0 1
from

from
y ∞∞ ∞ y ∞∞ ∞
z 7 1 0 z 7 1 0 z 3 1 0 z 3 1 0
601 32 602 time 33 603 time 34

BITS Pilani BITS Pilani BITS Pilani


Distance vector: link cost changes Hierarchical routing Interconnected ASes
Link cost changes: 1 Aggregate routers into regions, Gateway router:
 Node detects local link cost change y “autonomous systems” (AS)  At “edge” of its own AS
3c
4 1 3a 2c
 Updates routing info, recalculates x z  Has link to router in another AS
3b
AS3
2a
2b
distance vector 50 Routers in same AS run same routing 1c AS2
protocol 1a
 If DV changes, notify neighbors 1d
1b AS1
• “Intra-as” routing protocol  Forwarding table configured by both
• Routers in different AS can run intra- and inter-as routing algorithm
“Good t0 : y detects link-cost change, updates its DV, informs its neighbors.
News different intra-as routing protocol  Intra-as sets entries for internal
dests
Intra-AS
Travels
Inter-AS
t1 : z receives update from y, updates its table, computes new least Routing Routing
Fast” cost to x , sends its neighbors its DV.
algorithm algorithm
 Inter-as & intra-as sets entries
Forwarding
t2 : y receives z’s update, updates its distance table. y’s least costs do not table for external dests
change, so y does not send a message to z.

604 35 605 36 606 37

BITS Pilani BITS Pilani BITS Pilani

Inter-AS tasks Intra-AS Routing RIP ( Routing Information Protocol)


 Suppose router in AS1 receives AS1 must: Included in BSD-UNIX distribution in 1982
datagram destined outside of AS1:
1. Learn which dests are reachable
Also known as interior gateway protocols (IGP) Distance vector algorithm
 Router should forward packet to Most common intra-as routing protocols: • Distance metric: # hops (max = 15 hops), each link has cost 1
gateway router, but which one? through AS2, which through AS3
2. Propagate this reachability info  RIP: routing information protocol • DVS exchanged with neighbors every 30 sec in response
to all routers in AS1  OSPF: open shortest path first message (aka advertisement)
Job of inter-as routing! • Each advertisement: list of up to 25 destination subnets (in IP
 IGRP: interior gateway routing protocol (cisco addressing sense)
proprietary) from router A to destination subnets:
3c u v subnet hops
3a w u 1
A B
3b v 2
AS3 2c other
1c w 2
2a networks
other 1a 2b x x 3
networks 1b AS2 z C D y 3
AS1 1d y
38 39 z 2 40
607 608 609

BITS Pilani BITS Pilani BITS Pilani

RIP: example RIP: example RIP table processing


A-to-D advertisement
dest next hops
w - 1
x - 1  RIP routing tables managed by application-level process
z z
….
C
… ...
4
z called route-d (daemon)
w x y  advertisements sent in UDP packets, periodically repeated
w x y
A D B D B
A
C C routed routed
routing table in router D routing table in router D
destination subnet next router # hops to dest destination subnet next router # hops to dest transport transprt
(UDP) (UDP)
w A 2 w A 2
network forwarding forwarding network
y B 2 y B 2 table
A 5 (IP) table (IP)
z B 7 z B 7 link link
x -- 1 x -- 1 physical physical
…. …. .... …. …. ....
610 41 611 42 612 43

BITS Pilani BITS Pilani BITS Pilani


OSPF (Open Shortest Path First) OSPF “advanced” features (not in RIP) Hierarchical OSPF
boundary router
“Open”: publicly available Security: all OSPF messages authenticated (to prevent malicious
Uses link state algorithm intrusion) backbone router

• LS packet dissemination backbone


• Topology map at each node Multiple same-cost paths allowed (only one path in RIP) area
For each link, multiple cost metrics for different TOS (e.G., border
• Route computation using dijkstra’s algorithm routers
Satellite link cost set “low” for best effort tos; high for real time
OSPF advertisement carries one entry per neighbor tos)
area 3
Advertisements flooded to entire AS Integrated uni- and multicast support:
• Carried in OSPF messages directly over IP (rather than TCP §Multicast OSPF (MOSPF) uses same topology data base as internal
or UDP OSPF area 1
routers

area 2
613
IS-IS routing protocol: nearly identical to OSPF 44 614 Hierarchical OSPF in large domains. 45 615 46

BITS Pilani BITS Pilani BITS Pilani

BGP basics BGP basics: distributing path information


Internet inter-AS routing: BGP
 BGP session: two BGP routers (“peers”) exchange BGP messages: Using EBGP session between 3a and 1c, AS3 sends prefix
BGP (border gateway protocol): the inter-domain routing protocol
 Advertising paths to different destination network prefixes ( “ path vector ”
• “Glue that holds the internet together” protocol) reachability info to AS1.
BGP provides each AS a means to:  Exchanged over semi-permanent TCP connections  1c can then use IBGP do distribute new prefix info to all routers in as1
• EBGP: obtain subnet reachability information from neighboring  1b can then re-advertise new reachability info to AS2 over 1b-to-2a ebgp
when AS3 advertises a prefix to AS1: session
ass. • AS3 promises it will forward datagrams towards that prefix
• IBGP: propagate reachability information to all as-internal When router learns of new prefix, it creates entry for prefix in its
• AS3 can aggregate prefixes in its advertisement forwarding table.
routers.
• Determine “ good ” routes to other networks based on 3c eBGP session
reachability information and policy. 3a
BGP
message 3a iBGP session
Allows subnet to advertise its existence to rest of internet: “i am 3b
AS3 2c other
3b
AS3 2c other
1c 1c
here” other 1a
2a
2b
networks
other 1a
2a
2b
networks

networks 1b AS2 networks 1b AS2


AS1 1d AS1 1d
616 47 617 48 618 49

BITS Pilani BITS Pilani BITS Pilani

Path attributes and BGP routes BGP route selection BGP messages
Advertised prefix includes BGP attributes
Router may learn about more than 1 route to BGP messages exchanged between peers over TCP connection
• Prefix + attributes = “route”
destination AS, selects route based on: BGP messages:
1. Local preference value attribute: policy decision • OPEN: opens TCP connection to peer and authenticates
Two important attributes:
2. Shortest AS-PATH sender
• AS-PATH: contains as-es through which prefix advertisement
3. Closest NEXT-HOP router: hot potato routing • UPDATE: advertises new path (or withdraws old)
has passed: e.g., AS 67, AS 17
• KEEPALIVE: keeps connection alive in absence of
• Next-hop: indicates specific internal-AS router to next-hop as. 4. Additional criteria UPDATES; also ACKs OPEN request
(May be multiple links from current AS to next-hop-as)
• NOTIFICATION: reports errors in previous msg; also used to
close connection
Gateway router receiving route advertisement uses import policy to
accept/decline
• E.G., Never route through AS x
619 • Policy-based routing 50 620 51 621 52

BITS Pilani BITS Pilani BITS Pilani


Router becomes aware of prefix Select best BGP route to prefix
Router may receive multiple routes
3c 3c Router selects route based on shortest AS-PATH
BGP BGP
3a message 3a message
3b 3b
AS3 2c other AS3 2c other
1c 2a networks 1c 2a networks
other
networks
1a 1b
2b other
networks
1a 1b
2b  Example: select
1d AS2 1d AS2
AS1 AS1
 AS2 AS17 to 138.16.64/22
 BGP message contains “routes”  AS3 AS131 AS201 to 138.16.64/22
 “route” is a prefix and attributes: AS-PATH, NEXT-HOP,…  Router may receive multiple routes for same prefix
 Example: route:  Has to select one route
 Prefix:138.16.64/22 ; AS-PATH: AS3 AS131 ; NEXT-HOP:
201.44.13.125

622 53 623 54 624 55

BITS Pilani BITS Pilani BITS Pilani

Router identifies port for route Hot Potato Routing


Find best intra-route to BGP route
Use selected route’s NEXT-HOP attribute
Identifies port along the OSPF shortest path Suppose there two or more best inter-routes.
§Route’s NEXT-HOP attribute is the IP address of the router interface that
begins the AS PATH. Adds prefix-port entry to its forwarding table: Then choose route with closest NEXT-HOP
Example: § (138.16.64/22 , port 4) Use OSPF to determine which gateway is closest
 AS-PATH: AS2 AS17 ; NEXT-HOP: 111.99.86.55
Router uses OSPF to find shortest path from 1c to 111.99.86.55 Q: From 1c, chose AS3 AS131 or AS2 AS17?
A: route AS3 AS201 since it is closer
3c 3c router 3c
3a 3a port 3a
3b 111.99.86.55 3b
2c 1 2c 3b
AS3 other AS3 other
AS3 2c other
1c 2a networks 1c 4 2a networks 1c
2 3 2a networks
other 1a 2b other 1a 2b other 1a 2b
networks 1b AS2 networks 1b AS2 networks 1b
AS1 1d AS1 1d 1d AS2
AS1
625 56 626 57 627 58

BITS Pilani BITS Pilani BITS Pilani

How does entry get in forwarding table? BGP routing policy BGP routing policy (2)

Summary legend: provider legend: provider


B network B network
1. Router becomes aware of prefix X X
W A W A
• via BGP route advertisements from other routers customer customer
C network: C network:
2. Determine router output port for prefix
• Use BGP route selection to find best inter-AS route Y Y

• Use OSPF to find best intra-AS route leading to best inter-  A advertises path AW to B
 A,B,C are provider networks
AS route  B advertises path BAW to X
 X,W,Y are customer (of provider networks)
• Router identifies router port for that best route  Should B advertise path BAW to C?
 X is dual-homed: attached to two networks  No way! B gets no “revenue” for routing CBAW since neither W nor C are B’s
3. Enter prefix-port entry in forwarding table  X does not want to route from B via X to C customers
 .. so X will not advertise to B a route to C  B wants to force C to route to w via A
 B wants to route only to/from its customers!

628 59 629 60 630 61


Network Layer 4-61
BITS Pilani BITS Pilani BITS Pilani
Why different Intra-, Inter-AS routing ?

Policy:
Inter-as: admin wants control over how its traffic routed, who
routes through its net.
Intra-as: single admin, so no policy decisions needed
Scale: Thank You
Welcome to our CS#9

Hierarchical routing saves table size, reduced update traffic Routing Algorithms conlusion
Performance:
Intra-as: can focus on performance Prof. C R Sarma
Inter-as: policy may dominate over performance
BITS Pilani

631 62 632 633 1


Network Layer 4-62 Transport Layer3-63
BITS Pilani

Routing algorithm classification A Link-State Routing Algorithm Dijsktra’s Algorithm


Q: global or decentralized Q: static or dynamic? Dijkstra’s algorithm
Notation: 1 Initialization:
information? Net topology, link costs known to 2 N' = {u}
Static: all nodes  C(x,y): link cost from node x to 3 for all nodes v
Global: y; = ∞ if not direct neighbors
 Routes change slowly over
4 if v adjacent to u
• Accomplished via “ link state
All routers have complete topology, time
5 then D(v) = c(u,v)
link cost info
broadcast”  D(v): current value of cost of 6 else D(v) = ∞
Dynamic: • All nodes have same info path from source to dest.V 7
“Link state” algorithms Computes least cost paths from 8 Loop
 Routes change more quickly  P(v): predecessor node along
Decentralized: one node (‘source”) to all other 9 find w not in N' such that D(w) is a minimum
 Periodic update path from source to v 10 add w to N'
Router knows physically-connected nodes
 N': set of nodes whose least cost 11 update D(v) for all v adjacent to w and not in N' :
neighbors, link costs to neighbors  In response to link cost • Gives forwarding table for that node
path definitively known 12 D(v) = min( D(v), D(w) + c(w,v) )
Iterative process of computation, changes Iterative: after k iterations, know 13 /* new cost to v is either old cost to v or known
exchange of info with neighbors least cost path to k dest.’S 14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'
“Distance vector” algorithms
634 2 635 3 636 4

BITS Pilani BITS Pilani BITS Pilani

Dijkstra’s algorithm: example Dijkstra’s algorithm, discussion Distance vector algorithm


D(v) D(w) D(x) D(y) D(z) Algorithm complexity: n nodes
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞ Each iteration: need to check all nodes, w, not in N Bellman-ford equation (dynamic programming)
1 uw 6,w 5,u 11,w ∞ N(n+1)/2 comparisons: o(n2) Let
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
More efficient implementations possible: o(nlogn) Dx(y) := cost of least-cost path from x to y
Then
4 uwxvy 12,y
uwxvyz x
Oscillations possible: Dx(y) = min {c(x,v) + dv(y) }
5
9 E.G., Support link cost equals amount of carried traffic:
Notes: 5 7
4 v
 Construct shortest path tree by tracing 1
A 1+e A A A
predecessor nodes 8 2+e 0 0 2+e 2+e 0
D B D B D B D B
 Ties can exist (can be broken arbitrarily) u
3 w y z 0
0 0
e 0
1+e 1 0 0
0
1+e 1
cost from neighbor v to destination y
2 C 0 1 0
1 1
C C 1+e C cost to neighbor v
3
e
7 4 Given these costs, Given these costs, Given these costs,
Initially Find new routing…. Find new routing…. Find new routing…. min taken over all neighbors v of x
637 v 5 638 Resulting in new costs Resulting in new costs Resulting
6 in new costs 639 7

BITS Pilani BITS Pilani BITS Pilani


Bellman-Ford example Distance vector algorithm Distance vector algorithm
5
Dx(y) = estimate of least cost from x to y Key idea:
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
3 From time-to-time, each node sends its own distance vector
2
v w 5 • X maintains distance vector dx = [dx(y): y є N ] estimate to neighbors
u 2 z B-F equation says:
1
3
1
When x receives new DV estimate from neighbor, it updates its
2 du(z) = min { c(u,v) + dv(z), own DV using B-F equation:
x y Node x:
1 c(u,x) + dx(z),
c(u,w) + dw(z) } • Knows cost to each neighbor v: c(x,v) Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N
= min {2 + 5,
1 + 3, • Maintains its neighbors’ distance vectors. For
5 + 3} = 4 each neighbor v, x maintains  Under minor, natural conditions, the estimate dx(y) converge to
Node achieving minimum is next dv = [dv(y): y є N ] the actual least cost dx(y)
Hop in shortest path, used in forwarding table
640 8 641 9 642 10

BITS Pilani BITS Pilani BITS Pilani

Dx(z) = min{c(x,y) + Dx(z) = min{c(x,y) +


Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)}
Distance vector algorithm = min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
= 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 node x cost to cost to cost to
each local
Iterative, asynchronous: Each node: table x y z
x 0 2 7
x y z
x 0 2 3
table x y z
x 0 2 7
x y z
x 0 2 3
x y z
x 0 2 3
iteration caused by:

from

from
from

from
y ∞∞ ∞ y 2 0 1 y ∞∞ ∞ y 2 0 1

from
y 2 0 1
• Local link cost change Wait for (change in local link cost or z ∞∞ ∞ z 7 1 0 z ∞∞ ∞ z 7 1 0 z 3 1 0

• DV update message from msg from neighbor) node y cost to node y cost to cost to cost to
table x y z y table x y z x y z y
neighbor x ∞ ∞
2 1
x ∞ ∞ x 0 2 7
x y z 2 1
∞ x z x 0 2 3 x z
Recompute estimates from

from

from
y 2 0 1 7 y 2 0 1 y 2 0 1 7

from
y 2 0 1
Distributed: z ∞∞ ∞ z ∞∞ ∞ z 7 1 0 z 3 1 0
Each node notifies neighbors
If dv to any dest has changed, notify node z cost to node z cost to cost to cost to
only when its DV changes neighbors table x y z table x y z x y z x y z

• Neighbors then notify their x ∞∞ ∞ x ∞∞ ∞ x 0 2 7 x 0 2 3

from

from
y 2 0 1 y 2 0 1
from

from
neighbors if necessary y ∞∞ ∞ y ∞∞ ∞
z 3 1 0 z 3 1 0
z 7 1 0 z 7 1 0
643 11 644 time 12 645 time 13

BITS Pilani BITS Pilani BITS Pilani

Distance vector: link cost changes Hierarchical routing Interconnected ASes


Link cost changes: 1 Aggregate routers into regions, Gateway router:
 Node detects local link cost change 4
y
1 “autonomous systems” (AS)  At “edge” of its own AS
 Forwarding table configured by
x
3c
both intra- and inter-as routing
 Updates routing info, recalculates 50
z  Has link to router in 3b
3a
2a
2c
algorithm
AS3
distance vector Routers in same AS run same another AS 1c
2b

 If DV changes, notify neighbors routing protocol 1a 1b AS1


AS2
 Intra-as sets entries for
• “Intra-as” routing protocol 1d
internal dests
t0 : y detects link-cost change, updates its DV, informs its neighbors.
• Routers in different AS can  Inter-as & intra-as sets
“Good
News t1 : z receives update from y, updates its table, computes new least cost to x ,
sends its neighbors its DV.
run different intra-as routing Intra-AS Inter-AS entries for external dests
Travels protocol Routing
algorithm
Routing
algorithm

Fast” t2 : y receives z’s update, updates its distance table. y’s least costs do not Forwarding
change, so y does not send a message to z. table

646 14 647 15 648 16

BITS Pilani BITS Pilani BITS Pilani


Inter-AS tasks RIP ( Routing Information Protocol) RIP: example
AS1 must: Included in BSD-UNIX distribution in 1982
Suppose router in AS1 Distance vector algorithm
receives datagram destined 1. Learn which dests are reachable z
• Distance metric: # hops (max = 15 hops), each link has cost 1
outside of AS1: through AS2, which through AS3 • DVS exchanged with neighbors every 30 sec in response message (aka w x y
 Router should forward 2. Propagate this reachability info to advertisement) A D B
packet to gateway router, all routers in AS1 • Each advertisement: list of up to 25 destination subnets (in IP addressing
but which one? sense) C
Job of inter-as routing!
Routing table in router D
from router A to destination subnets:
Destination subnet next router # hops to dest
3c u v subnet hops
u 1
w A 2
3a A B w
3b v 2 y B 2
AS3 2c other
1c 2a networks
w 2 z B 7
other 1a 2b x x 3
networks 1b z C D y 3
x -- 1
1d AS2
AS1 y z 2 18 …. …. ....
649 17 650 651 19

BITS Pilani BITS Pilani BITS Pilani

RIP: example OSPF (Open Shortest Path First) OSPF “advanced” features (not in RIP)
A-to-D advertisement
dest next hops
w - 1 “Open”: publicly available Security: all OSPF messages authenticated (to prevent malicious
x - 1
z C 4 intrusion)
…. … ... z
Uses link state algorithm
w x y
A D B • LS packet dissemination Multiple same-cost paths allowed (only one path in RIP)
• Topology map at each node For each link, multiple cost metrics for different TOS (e.G., Satellite
C • Route computation using dijkstra’s algorithm link cost set “low” for best effort tos; high for real time tos)
routing table in router D
destination subnet next router # hops to dest OSPF advertisement carries one entry per neighbor Integrated uni- and multicast support:
w A 2 • Multicast OSPF (MOSPF) uses same topology data base as
y B 2 OSPF
A 5 Advertisements flooded to entire AS
z B 7
• Carried in OSPF messages directly over IP (rather than TCP Hierarchical OSPF in large domains.
x -- 1
…. …. .... or UDP
652 20 653 21 654 22

BITS Pilani
IS-IS routing protocol: nearly identical to OSPF BITS Pilani BITS Pilani

Hierarchical OSPF Internet inter-AS routing: BGP BGP basics


boundary router
BGP (Border Gateway Protocol): the de facto inter-domain routing  BGP session: two BGP routers (“peers”) exchange BGP messages:
backbone router
protocol  advertising paths to different destination network prefixes (“path vector”
• “Glue that holds the internet together” protocol)
backbone
 exchanged over semi-permanent TCP connections
area
border BGP provides each AS a means to: when AS3 advertises a prefix to AS1:
routers • AS3 promises it will forward datagrams towards that prefix
• eBGP: obtain subnet reachability information from neighboring
• AS3 can aggregate prefixes in its advertisement
ASs.
area 3
• iBGP: propagate reachability information to all AS-internal 3c
routers. 3a
BGP
message
internal • Determine “good” routes to other networks based on reachability 3b
AS3 2c other
routers 1c
area 1 information and policy. other
2a
2b
networks
1a
area 2 allows subnet to advertise its existence to rest of Internet: “I am here” networks
AS1 1d
1b AS2
655 23 656 24 657 25

BITS Pilani BITS Pilani BITS Pilani


BGP basics: distributing path information
Path attributes and BGP routes BGP route selection
Using eBGP session between 3a and 1c, AS3 sends prefix Advertised prefix includes BGP attributes Router may learn about more than 1 route to destination
reachability info to AS1. • Prefix + attributes = “route” AS, selects route based on:
 1c can then use iBGP do distribute new prefix info to all routers in AS1
 1b can then re-advertise new reachability info to AS2 over 1b-to-2a eBGP Two important attributes:
1. Local preference value attribute: policy decision
session • AS-PATH: contains ass through which prefix advertisement has 2. Shortest AS-PATH
When router learns of new prefix, it creates entry for prefix in its passed: e.G., As 67, as 17 3. Closest NEXT-HOP router: hot potato routing
forwarding table. • Next-hop: indicates specific internal-as router to next-hop as. 4. Additional criteria
(May be multiple links from current AS to next-hop-as)
eBGP session
3a iBGP session
3b
AS3 2c other
Gateway router receiving route advertisement uses import policy to
1c 2a networks accept/decline
other 1a 2b
networks
1d
1b AS2 • E.G., Never route through AS x
AS1
658 26 659 • Policy-based routing 27 660 28

BITS Pilani BITS Pilani BITS Pilani

BGP messages Multicast Routing Multicast Routing


BGP messages exchanged between peers over TCP • Multicast routing is a type of network routing that is used to deliver a • Source-Specific Multicast (SSM) - This is a more efficient and
connection single packet to multiple recipients simultaneously. The algorithm scalable multicast routing algorithm that only delivers multicast
used to achieve this is based on the concept of multicast groups, traffic to receivers that explicitly express interest in receiving the
where a group of devices are designated to receive the same traffic.
BGP messages: multicast traffic.
• Protocol Independent Multicast (PIM) - This is a generic
• OPEN: opens TCP connection to peer and multicast routing protocol that can be used with any unicast
authenticates sender There are various multicast routing algorithms available, including: routing protocol.
• UPDATE: advertises new path (or withdraws old) • Dense mode (DM) - This is an efficient multicast routing algorithm
• KEEPALIVE: keeps connection alive in absence of that works well when the number of receivers is large and the In general, multicast routing algorithms work by creating multicast
network is dense. distribution trees that are used to forward multicast traffic from the
UPDATES; also ACKs OPEN request
• Sparse mode (SM) - This is an efficient multicast routing algorithm source to the receivers. The algorithm used to construct these
• NOTIFICATION: reports errors in previous msg; also that works well when the number of receivers is small and the trees depends on the type of multicast routing being used.
used to close connection 29
network is sparse. 30 31
661 662 663

BITS Pilani BITS Pilani BITS Pilani

Creating multicast distribution trees Creating multicast distribution trees


Multicast distribution trees are used in multicast routing to forward multicast
traffic from the source to the receivers. There are several methods for creating • The choice of the method for creating the multicast
these trees, including: distribution tree depends on the network environment
and the requirements of the application.
Source-Based Trees: In this method, a tree is constructed from the source to
the receivers, with the source being the root of the tree. The tree is constructed • For example, in a dense network with a large number
using either a shortest-path algorithm or a breadth-first search algorithm. of receivers, a source-based tree may be the most
efficient option.
Shared Trees: In this method, a single shared tree is used for all sources, and
receivers join the tree to receive multicast traffic. The shared tree is constructed
• On the other hand, in a sparse network with a small
using either a core-based or a rendezvous-point (RP) based approach. number of receivers, a shared tree or source-specific
tree may be more appropriate.
Source-Specific Trees: In this method, a separate tree is constructed for each
source, with the source being the root of the tree. This approach is more efficient
664
than the source-based tree, as it avoids the need to traverse32 the entire tree for 665 33 666
each source. BITS Pilani BITS Pilani BITS Pilani, Pilani Campus
Data Link Layer Design Issues
• Services Provided to the Network Layer
Chapter 3 • Framing
• Error Control
The Data Link Layer • Flow Control
The Data Link Layer
Presenter
Prof. C R Sarma
BITS Pilani
WILP-BITS-PILANI

2
667 668 669

Functions of the Data Link Layer Functions of the Data Link Layer (2) Services Provided to Network Layer

• Provide service interface to the network layer


• Dealing with transmission errors
• Regulating data flow
• Slow receivers not swamped by fast senders

Relationship between packets and frames. (a) Virtual communication.


670 671 672 (b) Actual communication.

Services Provided to Network Layer (2) Framing Framing (2)

Placement of the data link protocol. A character stream. (a) Without errors. (b) With one error. (a) A frame delimited by flag bytes.
673 674 675 (b) Four examples of byte sequences before and after stuffing.
Framing (3) Error Detection and Correction Error-Correcting Codes

• Error-Correcting Codes
• Error-Detecting Codes

Bit stuffing
(a) The original data.
(b) The data as they appear on the line.
Use of a Hamming code to correct burst errors.
(c) The data as they are stored in receiver’s memory after destuffing.
676 677 678

Error-Detecting Codes Elementary Data Link Protocols

• An Unrestricted Simplex Protocol


• A Simplex Stop-and-Wait Protocol
• A Simplex Protocol for a Noisy Channel

Calculation of the polynomial code checksum.

679 680 681

Simplex Protocol Stop – and – Wait Protocol Stop – and – Wait ARQ
The Simplex protocol is hypothetical protocol Stop – and – Wait protocol is for noiseless channel Stop – and – wait Automatic Repeat Request (Stop –
designed for unidirectional data transmission over too. It provides unidirectional data transmission and – Wait ARQ) is a variation of the above protocol
an ideal channel, i.e. a channel through which without any error control facilities. However, it with added error control mechanisms, appropriate
transmission can never go wrong. It has distinct provides for flow control so that a fast sender does for noisy channels. The sender keeps a copy of the
procedures for sender and receiver. The sender not drown a slow receiver. The receiver has a finite sent frame. It then waits for a finite time to receive a
simply sends all its data available onto the channel buffer size with finite processing speed. The sender positive acknowledgement from receiver. If the
as soon as they are available its buffer. The receiver can send a frame only when it has received timer expires or a negative acknowledgement is
is assumed to process all incoming data instantly. It indication from the receiver that it is available for received, the frame is retransmitted. If a positive
is hypothetical since it does not handle flow control further data processing. acknowledgement is received then the next frame is
or error control. sent.

682 683 684


Go – Back – N ARQ Selective Repeat ARQ Protocol Definitions
Go – Back – N ARQ provides for sending multiple This protocol also provides for sending multiple
frames before receiving the acknowledgement for frames before receiving the acknowledgement for the
the first frame. It uses the concept of sliding window, first frame. However, here only the erroneous or lost
and so is also called sliding window protocol. The frames are retransmitted, while the good frames are
frames are sequentially numbered and a finite received and buffered.
number of frames are sent. If the acknowledgement
of a frame is not received within the time period, all
frames starting from that frame are retransmitted. Continued 

Some definitions needed in the protocols to follow.


685 686 687
These are located in the file protocol.h.

Protocol Unrestricted Simplex


Definitions Simplex Stop-and-
(ctd.) Protocol Wait
Protocol

Some definitions
needed in the
protocols to follow.
These are located in
the file protocol.h.
688 689 690

A Simplex Protocol for a Noisy Channel A Simplex Protocol for a Noisy Channel (ctd.) Sliding Window Protocols

• A One-Bit Sliding Window Protocol


• A Protocol Using Go Back N
• A Protocol Using Selective Repeat

A positive
acknowledgement
with retransmission
protocol.
691 692
A positive acknowledgement with retransmission protocol. 693
Continued 
Sliding Window Protocols (2) A One-Bit Sliding Window Protocol A One-Bit Sliding Window Protocol (ctd.)

A sliding window of size 1, with a 3-bit sequence number.


(a) Initially.
(b) After the first frame has been sent.
(c) After the first frame has been received.
694
(d) After the first acknowledgement has been received. 695 696
Continued 

A One-Bit Sliding Window Protocol (2) A Protocol Using Go Back N


Sliding
Window
Protocol
Using Go
Back N

Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. Pipelining and error recovery. Effect on an error when
The notation is (seq, ack, packet number). An asterisk indicates
(a) Receiver’s window size is 1.
where a network layer accepts a packet.
697 698 (b) Receiver’s window size is large. 699
Continued 

Sliding Window Protocol Using Go Back N Sliding Window Protocol Using Go Back N Sliding Window Protocol Using Go Back N

700 701 702


Continued  Continued 
A Sliding Window Protocol Using Selective Repeat A Sliding Window Protocol Using Selective Repeat (2)
Sliding Window Protocol Using Go Back N (2)

Simulation of multiple timers in software.


703 704 705
Continued  Continued 

A Sliding Window Protocol Using Selective Repeat (3) A Sliding Window Protocol Using Selective Repeat (4) A Sliding Window Protocol Using Selective Repeat (5)

(a) Initial situation with a window size seven.


(b) After seven frames sent and received, but not acknowledged.
(c) Initial situation with a window size of four.
(d) After four frames sent and received, but not acknowledged.
706 707 708
Continued 

Protocol Verification Finite State Machined Models Petri Net Models

• Finite State Machined Models


• Petri Net Models

(a) State diagram for protocol 3. (b) Transmissions. A Petri net with two places and two transitions.
709 710 711
Petri Net Models (2) Example Data Link Protocols
HDLC supports two types of transfer modes, normal
response mode and asynchronous balanced mode.
•Normal Response Mode (NRM) − Here, two types of
• HDLC – High-Level Data Link Control stations are there, a primary station that send commands
and secondary station that can respond to received
• The Data Link Layer in the Internet commands. It is used for both point - to - point and multipoint
• Data is organized into frames. A frame is communications.
•Asynchronous Balanced Mode (ABM) − Here, the
transmitted via the network to the configuration is balanced, i.e. each station can both send
destination that verifies its successful commands and respond to commands. It is used for only
arrival. It is a bit - oriented protocol that is point - to - point communications.
applicable for both point - to - point and
multipoint communications.
712 A Petri net model for protocol 3. 713 714

HDLC Frame
High-Level Data Link Control
HDLC is a bit - oriented protocol where each frame
contains up to six fields. The structure varies according to •Flag − It is an 8-bit sequence that marks the beginning and the end of the
frame. The bit pattern of the flag is 01111110.
the type of frame. The fields of a HDLC frame are − •Address − It contains the address of the receiver. If the frame is sent by
the primary station, it contains the address(es) of the secondary station(s).
If it is sent by the secondary station, it contains the address of the primary
station. The address field may be from 1 byte to several bytes.
•Control − It is 1 or 2 bytes containing flow and error control information.
•Payload − This carries the data from the network layer. Its length may vary
from one network to another.
•FCS − It is a 2 byte or 4 bytes frame check sequence for error detection.
The standard code used is CRC (cyclic redundancy code)

Frame format for bit-oriented protocols.


715 716 717

High-Level Data Link Control (2) The Data Link Layer in the Internet
•I-frame − I-frames or Information frames carry user data from
the network layer. They also include flow and error control
information that is piggybacked on user data. The first bit of
control field of I-frame is 0.
•S-frame − S-frames or Supervisory frames do not contain
information field. They are used for flow and error control when
piggybacking is not required. The first two bits of control field of
S-frame is 10.
•U-frame − U-frames or Un-numbered frames are used for
Control field of myriad miscellaneous functions, like link management. It may
(a) An information frame. contain an information field, if required. The first two bits of
(b) A supervisory frame. control field of U-frame is 11.
a) Piggybacking - Giving hotspot A home personal computer acting as an internet host.
(c) An unnumbered frame.
718 719 720
PPP – Point to Point Protocol PPP – Point to Point Protocol (2)
Point-to-Point Protocol (PPP) is a TCP/IP protocol that is used
to connect one computer system to another. Computers use
PPP to communicate over the telephone network or the
Internet.
A PPP connection exists when two systems physically connect
through a telephone line. You can use PPP to connect one
system to another. For example, an established PPP connection
between a branch office and a central office allows either office
to transfer data to the other through the network.
PPP allows interoperability among the remote access software
of different manufacturers. It also allows multiple network
communication protocols to use the same physical
communication line.
The PPP full frame format for unnumbered mode operation.
721 722 723 A simplified phase diagram for bring a line up and down.

PPP – Point to Point Protocol (3) Computer Network Student Notes

Introduction
Link Control Protocol (LCP) is a part of Point – to – Point ● An interconnection of multiple devices, also known as hosts, that are
connected using multiple paths for the purpose of sending/receiving data.

Protocol (PPP) that operates in the data link layer. It is Computer networks can also include multiple devices/mediums which help
in the communication between two different devices; these are known as

responsible for establishing, configuring, testing,


Network devices and include hardware such as routers, switches, hubs, and
bridges.
● Computer network components are the major parts which are needed to install the
maintaining and terminating links for transmission. It software. Some important network components are NIC, switch, cable, hub, router,
and modem. Depending on the type of network that we need to install, some

also imparts negotiation for set up of options and use of


network components can also be removed. For example, the wireless network
does not require a cable.
● The arrangement of a network that comprises nodes and connecting lines

features by the two endpoints of the links. via sender and receiver is referred to as network topology. The various
network topologies are:

Mesh, Star, Bus, Ring and Hybrid

● Basic hardware components used in the OSI physical layer include network
interface cards (NICs), connectors and interfaces, and cables that facilitate the
transmission of data from source to destination.
● Devices that operate at this layer include Layer 2 switches (switching hubs) and
bridges. The data link layer is divided into two sublayers: Logical Link Control (LLC)
sublayer provides the multiplexing, flow and error control at the data link layer.
● Internet Service Provider (ISP) is a company which provides internet connection
to end users, but there are basically three levels of ISP. There are 3 levels of
Internet Service Provider (ISP): Tier-1 ISP, Tier-2 ISP, and Tier-3 ISP.
● Tier-1 ISP: These ISPs are at the top of the hierarchy and they have a global
reach; they do not pay for any internet traffic through their network; instead
lower-tier ISPs have to pay a cost for passing their traffic from one location
to another which is not under the reach of that ISPs. Generally, ISPs at the
same level connect to each other and allow free traffic passes to each other.
The LCP frame types. Such ISPs are called peers. Due to this cost is saved. They build

724 725
726

infrastructure, such as the Atlantic Internet sea cables, to provide traffic to and password. The client stores the information in the cookie, and then uses it in
subsequent requests to the server that set the cookie. The server can then update
Transport Layer
all other Internet service providers, not to end users.
the cookie based on the information in the new request and send it back to the ● Transport Layer is the second layer of the TCP/IP model. It is an end-to-end
EX:- Cogent Communications, Hibernia Networks, AT&T client. In this manner, state information can be maintained indefinitely, allowing the layer used to deliver messages to a host. It is termed as an end-to-end layer
client and server to have a “memory” that persists over a period of time. because it provides a point-to-point connection rather than hop-to-hop,
● Tier-2 ISP: These ISPs are service providers who connect between tier 1 ● FTP:FTP (File Transfer Protocol) is a network protocol for transmitting files between the source host and destination host to deliver the services reliably.
and tier 3 ISPs. They have regional or country reach and they behave just between computers over Transmission Control Protocol/Internet Protocol
The unit of data encapsulation in the Transport Layer is called as a segment.
like Tier-1 ISP for Tier-3 ISPs. connections. Within the TCP/IP suite, FTP is considered an application layer
● The basic difference between network layer and transport layer is that transport
● Tier-3 ISP: These ISPs are closest to the end users and help them to protocol.
layer protocol provides logical communication between processes running on
connect to the internet by charging some money. These ISPs work on ● E-mail Protocols are set of rules that help the client to properly transmit the
different hosts, whereas network layer protocol provides logical communication
purchasing models. These ISPs have to pay some cost to Tier-2 ISPs based information to or from the mail server. Here in this tutorial, we will discuss various
between hosts.
on traffic generated. protocols such as SMTP, POP, and IMAP.
● This link between the application and transport layer protocols is based on the
● SMTP is a push protocol and is used to send the mail whereas POP (post
ports selected to support the individual sessions supported by the transport layer.
Application Layer office protocol) or IMAP (internet message access protocol) are used to There are 65,535 port numbers available, and these are divided into three ranges:
retrieve those emails at the receiver’s side. Well-known ports (0 to 1023). These are reserved, and are commonly used by
● The Application Layer is the topmost layer in the Open System Interconnection Port number of SMTP and POP3 are 25* (or 26) and 110 respectively. HTTP, SMTP, POP3, FTP, DNS, etc. Because they are reserved, client
(OSI) model. This layer provides several ways for manipulating the data ● DNS is a host name to IP address translation service. DNS is a distributed applications can be programmed to request a connection to a specific port and its
(information) which actually enables any type of user to access the network with database implemented in a hierarchy of name servers. It is an application layer associated transport layer service (TCP or UDP). Registered ports are: 1024 to
ease. This layer also makes a request to its bottom layer, which is the presentation protocol for message exchange between clients and servers. 49151. These are assigned to user processes or applications, typically programs
layer for receiving various types of information from it. The Application Layer It is developed over UDP with port 53. that you have chosen to install on your computer that require network connectivity
interface directly interacts with applications and provides common web application ● Socket programming is a way of connecting two nodes on a network to (e.g. games and messaging services). When not assigned to a particular installed
services. This layer is basically the highest level of open system, which provides communicate with each other. One socket(node) listens on a particular port program, they can be used in the same manner as dynamic ports.
services directly for the application process. at an IP, while another socket reaches out to the other to form a connection. Dynamic or private ports (49152 to 65535). These are assigned dynamically to
● HTTP represents "Hypertext Transfer Protocol." HTTP is the protocol that can Server forms the listener socket while the client reaches out to the server. client applications when the client initiates a connection to a service.
transfer information over the network. It is the Internet protocol suite method and ● TCP/ UDP :- TCP is a connection-oriented protocol, whereas UDP is a ● Multiplexing – Gathering data from multiple application processes of the
defines commands and functions used for sharing web pages. HTTP uses a connectionless protocol. A key difference between TCP and UDP is speed, as TCP sender, enveloping that data with a header, and sending them as a whole to
server-client model. A client, for example, maybe a laptop or telephone device. is comparatively slower than UDP. Overall, UDP is a much faster, simpler, and the intended receiver is called multiplexing.
Server runs at port 80. HTTP is a stateless protocol . efficient protocol, however, retransmission of lost data packets is only possible with ● De-multiplexing – Delivering received segments at the receiver side to the
● Non-persistent and persistent are the two types of HTTP connections used to TCP.
connect the client with the webserver. The non-persistent connection has
correct app layer processes is called de-multiplexing.
connection type 1.0 while the persistent connection has connection type1.1 ● The transport layer is responsible for flow control. It uses the sliding window
● The non-persistent connection takes the connection time of 2RTT + file protocol that makes the data transmission more efficient as well as it controls the
transmission time. It takes the first RTT (round-trip time) to establish the flow of data so that the receiver does not become overwhelmed. Sliding window
connection between the server and the client. The second RTT is taken to request protocol is byte oriented rather than frame oriented.
and return the object. This case stands for a single object transmission. ● TCP protocol has methods for finding corrupted segments, missing segments, out-
● Cookies: Storing HTTP State Information of-order segments and duplicated segments. Error control in TCP is mainly done
When a server implements a function that requires state to be maintained across through the use of three simple techniques : Checksum – Every segment contains
a set of transactions, it sends a small amount of data to the Web client called a a checksum field which is used to find corrupted segments.
“cookie”. The cookie contains important information relevant to the particular Web ● Sliding window protocols are data link layer protocols for reliable and sequential
application, such as a customer name, items in a shopping cart, or a username delivery of data frames. The sliding window is also used in the Transmission

727 728 729


Control Protocol. In this protocol, multiple frames can be sent by a sender at a time intermediate network switching/ routing devices to the destination. These networks The binding cache contains bindings for the mobile node’s home address
before receiving an acknowledgment from the receiver. are called datagram networks since communication occurs via datagrams. They and its current care-of-address. Every time the home agent receives an IP
● TCP/IP is also a connection-oriented transport with orderly release. With orderly exist in packet switching networks. datagram that is destined to a mobile node currently away from the home
release, any data remaining in the buffer is sent before the connection is ● The major networking building blocks are workstations, network applications, the network, it sends a binding update to the correspondent node to update the
terminated. The release is accomplished in a three-way handshake between client type of network, servers, and routers. There must be workstations for a network to
information in the correspondent node’s binding cache. After this, the
and server processes. The connection-oriented protocols in the OSI protocol suite, be present or connected to it.
correspondent node can directly tunnel packets to the mobile node.
on the other hand, do not support orderly release. Applications perform any ● IP address is an address having information about how to reach a specific
handshake necessary for ensuring orderly release. host, especially outside the LAN. An IP address is a 32 bit unique address
● Stop – and – Wait protocol (ARQ) is the protocol for transmission of frames over Smooth handoff:
having an address space of 2^32.
noiseless channels. It provides unidirectional data transmission with flow control When a mobile user moves to completely new foreign network, as the name
● Classful Addressing:-The 32 bit IP address is divided into five subclasses.
facilities but without error control facilities. This protocol takes into account the fact suggests binding update consist of new IP address and information of the
These are: Class A , Class B , Class C , Class D , Class E
that the receiver has a finite processing speed. mobile will be sent by the new foreign agent to old foreign agent and then
● Classes of Routing Protocols :-
● Go-Back-N protocol, also called Go-Back-N Automatic Repeat Request, is a old foreign agent will send binding waring to home network about changing
1. Distance Vector Routing Protocol :These protocols select the best path
protocol that uses a sliding window method for reliable and sequential delivery of of mobile’s network, home network then updates its routing table according
on the basis of hop counts to reach a destination network in a particular
data frames. It is a case of sliding window protocol having to send a window size to information received from binding warning and sends binding update to
of N and receiving window size of 1. direction. Dynamic protocol like RIP is an example of a distance vector
CN and now CN will change its FA value to new FA value. If home network
● The sequence number (SYN) is the byte number of the first byte of data in the TCP routing protocol. Hop count is the number of intermediate nodes the packet
won’t update routing table then new upcoming packets will be dropped.
packet sends (also called a TCP segment). The acknowledgement number is the can traverse before reaching the destination. The path with the least hop
sequence number of the next byte the receiver expects to receive. count will be chosen as the best path .
● The sender sends packets of window size N and the receiver acknowledges 2. Link State Routing Protocol :These protocols know more about
all packets whether they were received in order or not. In this case, the Internetwork than any other distance vector routing protocol. These are also Data Link Layer and Local Area Networks
receiver maintains a buffer to contain out-of-order packets and sorts them. known as SPF (Shortest Path First) protocol. OSPF is an example of link-
state routing protocol. ● Data Link Layer is second layer of OSI Layered Model from the bottom of the
The sender selectively re-transmits the lost packet and moves the window
protocol family. This layer is one of the most complicated layers and has complex
forward.
functionalities. Data link layer hides the details of underlying hardware and
• Mobile IP represents itself to upper layer as the medium to communicate.
Mobile IP is a communication protocol (created by extending Internet ● It does many tasks like link framing, error control, flow control, multiple access
Protocol, IP) that allows the users to move from one network to another with control or media access control.
the same IP address. It ensures that the communication will continue without ● Data-link layer takes packets from Network Layer and encapsulates them into
Network Layer the user’s sessions or connections being dropped. Frames. Then, it sends each frame bit-by-bit on the hardware. At receiver’ end,
● The network layer is a portion of network stack that allows transfer of data packets data link layer picks up signals from hardware and assembles them into frames.
between different types of networks. Indirect routing or Triangular Routing: ● Error Control: Sometimes signals may have encountered problem in transition and
● For building private networks over public networks, circuit switching is done at the takes place when the destination is not on a directly attached IP network, the bits might have flipped. These errors are detected and attempted to recover
network layer of the communication system. In these networks, the path between forcing the sender to forward the datagram to a router for delivery. Triangular actual data bits using various checksum algorithms like CRC. It also provides error
the source and the destination nodes that is followed by the first data packet gets routing is a problem encountered in mobile IP protocol family. To avoid this reporting mechanism to the sender. Types of errors are single bit, multiple bits,
allocated. All other data packets transmitted between them will use the same path. burst etc.
problem there are optimization listed below.
One can get the required amount of QoS over these Logical circuits. ● Types of error detection and correction mechanisms are parity check, hamming
● In a connectionless communication system, datagram refers to the smallest unit code, cyclic redundancy check etc.
Route optimization: ● Multiple Access control protocols: When host on the shared link tries to transfer
using which data is transmitted. Datagrams are data packets which contain
adequate header information so that they can be individually routed by all the data, it has a high probability of collision. Data-link layer provides mechanism
Binding cache:

730 731 732

such as CSMA/CD to equip capability of accessing a shared media among multiple ○ Digital signals are discrete in nature and represent sequence of voltage
Systems. Main three types and its sub types are listed below. pulses. Digital signals are used within the circuitry of a computer system.
Quality of Service (QoS)
○ Random access protocol ○ ● Quality-of-Service (QoS) refers to traffic control mechanisms that seek to either
○ Controlled access protocol ○ Analog Signals differentiate performance based on application or network-operator requirements
○ Channelized protocol ○ Analog signals are in continuous wave form in nature and represented by or provide predictable or guaranteed performance to applications, sessions, or
● Random Access Control continuous electromagnetic waves. traffic aggregates. Basic phenomenon for QoS means in terms of packet delay and
○ ALOHA ● Transmission Impairment: When signals travel through the medium they tend to losses of various kinds.
○ CSMA/CD deteriorate. This may have many reasons as given: ● Need of QoS:
○ CSMA/CA ○ Attenuation ○ Video and audio conferencing require bounded delay and loss rate.
● Controlled Access Control ○ Distortion
○ Time-critical applications (real-time control) in which bounded delay is
○ Reservation ○ Noise
○ Polling ● Transmission Medium considered to be an important factor.
○ Token Passing ● Packet Scheduling: It is the means by which data (packet) transmission-governing
The media over which the information between two computer systems is sent is
● Channelization protocols a key function of quality of service is achieved.
called the transmission medium. Transmission medium comes in two forms.
○ FDMA ● Types of scheduling:
○ TDMA ● Guided Media ○ FIFO
○ CDMA All communication wires/cables are guided media, such as UTP, coaxial
○ Priority scheduling
● Switching in data link layer is done by network devices called bridges. cables, and fiber Optics. In this media, the sender and receiver are directly
connected and the information is send (guided) through it. ○ Weighted Fair Queuing (WFQ)
● A data link layer bridge connects multiple LANs (local area networks) together to
form a larger LAN. This process of aggregating networks is called network ● Unguided Media ● Traffic shaping (also known as packet shaping) is a technique that delays the flow
bridging. A bridge connects the different components so that they appear as parts of certain types of network packets in order to ensure network performance for
of a single network. Wireless or open air space is said to be unguided media, because there is higher priority applications at the gateway.
no connectivity between the sender and receiver. Information is spread over ● Types of Shaping:
● Virtual Local Area Networks or Virtual LANs (VLANs) are a logical group of
○ Leaky bucket
computers that appear to be on the same LAN irrespective of the configuration of the air, and anyone including the actual recipient may collect the
○ Token bucket
the underlying physical network. Network administrators partition the networks to information.
match the functional requirements of the VLANs so that each VLAN comprise of a ● Multiplexing ● Integrated Services(IntServ)
subset of ports on a single or multiple switches or bridges. This allows computers Multiplexing is a technique to mix and send multiple data streams over a single ○ Flow Based QoS Model (Resources are available prior to establishing the
and devices in a VLAN to communicate in the simulated environment as if it is a medium. This technique requires system hardware called multiplexer (MUX) for session)
separate LAN. multiplexing the streams and sending them on a medium, and de-multiplexer ○ Uses RSVP (signaling protocol) to create a flow over a connectionless IP
(DMUX) which takes information from the medium and distributes to different ● Differentiated Services (DiffServ)
destinations. ○ Categorizes traffic into different classes or priorities with high priority value
Physical layer and Medium assigned to real time traffic
● Physical layer in the OSI model plays the role of interacting with actual hardware ○ Hop by hop (no assurance of end-to-end QoS)
and signaling mechanism. Physical layer is the only layer of OSI network model ● Multiprotocol Label Switching (MPLS)
which actually deals with the physical connectivity of two different stations. This ○ Not primarily a QoS model, rather a Switching architecture
layer defines the hardware equipment, cabling, wiring, frequencies, pulses ○ Ingress to the network decides a label according to FEC (Forward
(voltage) used to represent binary signals etc. equivalence class)
● Physical layer provides its services to Data-link layer.
● Types of Signals

733 734 735

Network Security

● Network Security refers to the measures taken by any enterprise or


organization to secure its computer network and data using both hardware
and software systems. This aims at securing the confidentiality and
accessibility of the data and the network. Every company or organization
that handles large amounts of data, has to deploy a degree of solutions
against many cyber threats.
● Confidentiality means that data, objects and resources are protected from
unauthorized viewing and unauthorized access.
● Integrity means that data is protected from unauthorized changes to ensure that it
is reliable and correct.
● Availability means that authorized users have access to the systems and the
resources they need.
● Security attacks are classified as: physical attacks, passive attacks, active attacks,
Denial of Service (DoS) attacks etc. The classification was not exclusive and a
single attack might be classified in more than one division.
● Techniques used to guarantee confidentiality, integrity, access control etc. are
cryptography, perimeter security, multi factor authentication etc.

736

You might also like