Computer Network Ppt
Computer Network Ppt
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
• 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
Bridge
Bus Star Tree
hub host host host host host host
hub
hub hub
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
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
16 17 18
Persistent HTTP HTTP Request and Response
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
Flickr
28 29 30
34 35 36
Format of an e-mail
Electronic Mail: Common scenario
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
43 44 45
POP3 Web-based e-mail, cases I and II
DNS – The Domain Name System
46 47 48
49 50 51
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
3 Application
- Sockets (Berkeley)
-Winsock
58 59 60
-Mac TCP
64 65 66
67 68 69
SEND
data reply sendto() RECEIVE
recvfrom()
CLOSE
close()
70 71 72
4. 2. 2012
Continued… Continued… Continued…
73 74 75
76 77 78
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
82 83 84
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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.
Pipelining
94 95 96
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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)
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
• 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.
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
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
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
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
Computer Networks:
Transport Layer
BITS Pilani Chittaranjan Hota
Hyderabad Campus
Acknowledgement: Slides and Images adapted from Kurose, and Forouzan (TMH) PhD (CSE)
time
simple telnet scenario
136 137 138
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
32
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
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
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
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
value in arriving
packet’s header
0111 1
3 2
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
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Effect on Performance Router Architecture Overview Continued…
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
reassembly
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
IP Address Classes Address Hierarchy
128.192.111.202 / 29
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Network Address
Another Example Let us try… Translation: Why?
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
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Dynamic Host Configuration
ARP Reverse ARP Protocol (DHCP)
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
• 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
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Three-node loop instability Internet Routing Protocols Routing Information Protocol (RIP)
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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 BITS Pilani, Hyderabad Campus
Challenges for Interdomain Routing Open Shortest Path First (OSPF) OSPF “advanced” features (not in RIP)
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Path-Vector Routing Faster Loop Detection Flexible Policies
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
• 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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
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
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
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Model for MPLS Network MPLS Forwarding MPLS Operation LDP:
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
• 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 BITS Pilani, Hyderabad Campus
Coaxial cable Optical fiber Continued…
BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus BITS Pilani, Hyderabad Campus
Session 1
Introduction to Computer
Networks
Prof. C R Sarma
BITS Pilani WILP-BITS-Pilani
Pilani Campus
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)
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
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
The Network Core Network Core: Circuit Switching Message Switching
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
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”
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
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)
• 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
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
Thank You!
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.
Session – 2
Prof. C R Sarma
BITS Pilani WILP-BITS-Pilani
Pilani | Dubai | Goa | Hyderabad
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
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 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
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
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
• 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.
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
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
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.
•
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
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
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
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).
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
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
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
• •
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
• • •
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
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
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.
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
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
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
•
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
Attacking DNS
• BITS Pilani
DDoS attacks Redirect attacks Pilani Campus
▪ Potentially more
dangerous address: target IP 440 441
❖ Requires amplification
439
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
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
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
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
application P3 P1
P1
application P2 P4 application
host 2 host 3
host 1
463 464 465
Transport Layer 3-26
BITS Pilani, Pilani Campus BITS Pilani, Pilani Campus
• 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)
• 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
• 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
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
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
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
• 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
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
High-speed
Switching
Fabric
...
...
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
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
. . .. . .
. . .. . .
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
NAT: Network Address Translation NAT: Network Address Translation NAT: Network Address Translation
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
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)
* 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.
…
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
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
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
Node achieving minimum is next Hop in shortest path, used in forwarding table
598 29 599 30 600 31
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
area 2
613
IS-IS routing protocol: nearly identical to OSPF 44 614 Hierarchical OSPF in large domains. 45 615 46
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
How does entry get in forwarding table? BGP routing policy BGP routing policy (2)
• 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!
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
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
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
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
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
2
667 668 669
Functions of the Data Link Layer Functions of the Data Link Layer (2) Services Provided to Network Layer
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
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.
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 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.)
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
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) 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)
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.
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
features by the two endpoints of the links. via sender and receiver is referred to as network topology. The various
network topologies are:
● 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
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
Network Security
736