0% found this document useful (0 votes)
16 views41 pages

Lec 01

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views41 pages

Lec 01

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

1.

Introduction to Computer
Networks

Class Intro
Overview of packet switching and the Internet
Packet switching performance
Structure of the Internet
Internet protocol layers
Internet security
Roch Guerin, with adaptations from Jon Turner and John DeHart
Structure of Course
 Course web site (wiki):
o http://classes.engineering.wustl.edu/cse473/index.php/Main_Page
o Check out the Syllabus page
• Schedule and copies of lectures, labs, quizzes, exams, etc.
• Reading assignments: get you ready for each lecture
– Including RFCs: IETF Request For Comments
» “Standards” documents from the Internet Engineering Task Force
• Review Questions due almost every class, based on that day’s
lecture’s reading assignment
• 15 minute Quizzes about every two weeks
o Grades:
• 10% : Review Questions (binary grades based on “effort”)
• 20% : Quizzes (lowest quiz score is dropped)
• 25% : Labs
• 20% : Midterm
• 25% : Final
2
Structure of Course (continued)
 Lectures
o At the end of each lecture, time permitting, there
will be some exercises to see what we have
learned
 Office hours: Listed on web site
 TAs:
o Right now we have three:
• Jiayi Song
• Xin Yan
• Lingxin Zhao
o Office hours TBD

3
Structure of Course (continued)
 Studios
o Basically warmups for the Labs
 Git repository on bitbucket
o Code for studios and labs will come to you via your
Git repository, and you will submit your solutions
using Git as well
• See the wiki for details
 Piazza
o Link to class Piazza page on course web site
o Ask questions there so everyone can benefit
• We will not respond to direct email questions.
• There are no dumb questions!
o Sign up for our class on Piazza 4

Some Key Course Goals
 Architectural principles of the Internet (RFC 1958)
o Primary goal is connectivity
o Constant change (the network is not static)
o End-to-end argument
o Key is IP protocol
 Understanding sources and causes of packet delay
 Socket programming
 Reliable Data Transport a.k.a. TCP:
o Connection setup
o Reliability
o Flow control
o Congestion control
 IP Routing
 Internet system of protocols
5
 Some Internet security
Our Scope – Broadly Speaking

The mechanisms and devices behind


the Internet’s ability to offer end-to-
end connectivity, and their
performance

6
The Internet process

protocol
protocol
router
p1 p2 ...
host

socket
network
stack

IP
address packet
1.2.3.4

 Three main components


o Hosts or end-systems: sources and sinks of information
o Routers: responsible for information delivery through the network
o Protocols: the languages (there are many) used by hosts and
routers to deliver information from end to end
 A basic paradigm: a packet network, i.e., a network where
information delivery relies on atomic, self-contained units
7
Internet Overview process

router p2
p1 ...
host

socket
network
stack

IP
address packet
1.2.3.4

 Communication between running processes in hosts


 Host operating systems implement network stack
o Sockets provide interface between processes and network stack
 Internet Protocol (IP)
o IP address determines where packets are to be delivered
o Best effort delivery: no reliability built in to IP
o Packets also called Datagrams
8
Packet Switching
 Packets have a header and a payload
 Packets carry information in their payload
 Packets include a header that determines how they are
handled by routers and hosts
o Internet headers are “global,” i.e., contain all the information
needed to handle a packet
Global Global Global myAddress
address address address
table table table
Data myAddress Data myAddress Data myAddress

Data myAddress

o Other paradigms exist that rely on “local” headers involving


prior coordination with the network (e.g. MPLS)
Local Local Local myAddress
address address address
table table table
Data L1 Data L2 Data L3

Data L4

9
Internet Packet Format (Version 4)
Version IHL DSCP+ECN Total Length

Identification Flags Fragment Offset

Time To Live Protocol Header Checksum


Source IP Address (32 bits): 1.2.3.4
Destination IP Address (32 bits): 5.6.7.8
Options Padding

…. Payload ….
 Version (4 bits): Value = 4 (0100) for IPv4
 IHL (4 bits): Header length in 32-bit words
 DSCP: Differentiated Service Code Points (6 bits), Explicit Congestion Notification (2 bits)
 Total Length (16 bits): Header+payload length in bytes (min=20bytes, max=65,535bytes)
 Identification (16 bits): Identifies group of fragments
 Flags (3 bits): Specifies fragmentation status
 Fragment offset (13 bits): Location of fragment in original packet
 TTL (8 bits): Decremented by one by each router. Packet is discarded when TTL reaches 0
 Protocol (8 bits): Identifies protocol used in data payload (1: ICMP, 6: TCP, 17: UDP)
 Header Checksum (16 bits): Error detection field
 Options: 1st byte indicates presence/absence of option, 2 nd byte is option length, remaining bytes are option
10 data
Internet Packet Format (Version 6)
Version Traffic Class Flow Label

Payload Length Next Header Hop Limit

Source IP Address (128 bits)


2001:0DA8:E800:0000:0260:3EFF:FE47:0001

Destination IP Address (128 bits)


2400:DA56:FF10:AA34:100B:7BC1:D50A:0056

 Version (4 bits): IPv6 (0110)


 Traffic Class: 6 bits for DSCP, 2 bits for ECN (same as IPv4)
 Flow Label (20 bits): For faster, more deterministic forwarding of individual “flows”
 Payload Length (16 bits): Payload size in bytes, including extension headers (set to 0
for jumbo payloads – indicated in extension header)
 Next Header (8 bits): Type of next header, if any, including transport headers
 Hop Limit (8 bits): Equivalent to IPv4 TTL

11
 Note: No header checksum (assumes that link layer does error detection)
Internet Addresses
 IPv4: 32 bits (4x8) – 232 distinct addresses
o Represented as a.b.c.d, where a, b, c, d, are 8-bit numbers
in the range 0,…,255
o 0 = 00000000, 1 = 00000001, 2 = 00000010, … ,
255 = 11111111

 IPv6: 128 bits (8x16) – 2128 distinct addresses


o Represented as
W1X1Y1Z1:W2X2Y2Z2:W3X3Y3Z3:W4X4Y4Z4:W5X5Y5Z5:W6X6Y6Z6:W7X7Y7Z7:W8X8Y8Z8

where Wi,Xi,Yi,Zi are each HEX (4-bit) numbers in the range 0


to F(15)
o 0=0000, 1=0001, 2=0010, … , A(10)=1010 , B(11)=1011 ,
C(12)=1100 , D(13)=1101 , E(14)=1110, F(15)= 1111

12
Circuit Switching
 The main alternative to packet switching
o provides a dedicated communication channel (a circuit) to
transmits information, not packets, from source to destination
• telephone networks have traditionally used circuit switching
o calls for an initial setup phase, but then data flows continuously
and unimpeded
o relatively simple technology developed and evolved over more
than 100 years

13
Packet vs. Circuit Switching
 Letscompare packet and circuit switching
 Two examples:

o File Transfer
o Streaming application
 What are the delays involved with each?

14
Packet vs. Circuit Switching
File transfer – Packet
 Sequence of n packet switches, links of speed c bits/sec, propagation delay of δ sec for each
“hop”

c c
L+H
c
L+H
c
L+H L+H
M bits bits bits bits
c M n=4
bits bits

δ δ δ δ δ
 File size M bits, packet header H bits, maximum packet payload size L bits
o Number of bits transmitted: M+M/LH – need to include header bits for all packets
o Last bit leaves source at t0=(M+M/LH)/c – transmission of all the bits (payload+headers)
o Last bit arrives at first switch at t1=t0+δ =(M+M/LH)/c+δ – propagation time to next switch
o Last bit leaves first switch at time t2=t0+δ+(L+H)/c – transmission time of last packet
• Assumes that packet must be fully received before being retransmitted – no cut-through
o Last bit leaves last (nth) switch at t2n=t0 + nδ + n(L+H)/c - repeats at each switch
o Last bit arrives at destination at t2n+1=t2n+ δ

 Total minimum download time Pd= (M+M/LH)/c + n(L+H)/c + (n+1)δ

 M=106 bits, H=100 bits, L=10000 bits, c=106 bits/sec, δ=5 msec, n=4 Td=1.075 sec
 M=106 bits, H=100 bits, L=10000 bits, c=109 bits/sec, δ=5 msec, n=4 15
Td=26.05 msec
Packet vs. Circuit Switching
File transfer – Circuit
 Sequence of n circuit switches, circuit of speed c bits/sec, propagation delay of δ
sec for each “hop”
M c c c c c n=4
M
bits bits

δ δ δ δ δ
 File size M bits, setup processing time of σ at each hop
o Initiate connection at t=0
o Circuit setup time: 2(n+1)(δ+σ) - setup message from source to destination and back
o Last bit leaves source at t0= M/c +2(n+1)(δ+σ) – transmission of all payload bits
o Last bit arrives at destination at t2n+1=t0 + (n+1)δ – end-to-end propagation

 Total download time Cd= 2(n+1)(δ+σ) + M/c + (n+1)δ

 M=106 bits, c=106 bits/sec, δ=5 msec, σ=1 msec, n=4 Td=1.085
sec
 M=106 bits, c=109 bits/sec, δ=5 msec, σ=1 msec, n=4
16
Td=86 msec
Packet vs. Circuit Switching
File transfer
 Packet download time

Pd= (M+M/LH)/c + n(L+H)/c + (n+1)δ

 Circuit download time

Cd= 2(n+1)(δ+σ) + M/c + (n+1)δ

 Difference:

Pd – Cd= M/LH/c +n[(L+H)/c – 2(n+1)(σ+δ)

o Basically header overhead + hop-by-hop retransmissions


versus setup delay. As c increases, packet switching becomes
more attractive (for file transfers)
Packet vs. Circuit Switching
Streaming application – Packet
 Sequence of n packet switches, links of speed c bits/sec, propagation delay of δ sec
per “hop”

c c
L+H
c
L+H
c
L+H L+H
R bps L+H
bits
bits bits bits bits
c L+H
bits
R bps
n=4
δ δ δ δ δ

 Application generates bits at a rate of R bits/sec, packet header H bits, packet


payload size L bits
o First bit of (new) packet payload generated at t=0
o Packet ready for transmission at t0=L/R – L/R is the packetization delay
o Last bit arrives at first switch at t1= L/R+ (L+H)/c + δ – transmission+propagation
o Last bit arrives at destination at tn+1=tn+ (L+H)/c + δ

 Total minimum delay for first bit of packet: PS= L/R + (n+1) [(L+H)/c + δ]
 R=64,000 bits/sec, H=100 bits, L=1000 bits, c=106 bits/sec, δ=5 msec, n=4
PS =46.125 msec
 R=64,000 bits/sec, H=100 bits, L=1000 bits, c=109 bits/sec, δ=5 msec, n=4 18
Packet vs. Circuit Switching
Streaming application – Circuit
 Sequence of n circuit switches, propagation delay of δ sec per “hop”

R bps R bps
R R R R R n=4
δ δ δ δ δ
 Application generates bits at a rate of R bits/sec ( circuit of speed R bits/sec),
setup processing time of σ at each hop
o Circuit setup time: Tsetup=2(n+1)(δ+σ) - same as before
o No packetization delay!
• Bit b generated at time t0 = 0
• Bit b leaves source at time t0

o Bit b arrives at/leaves switch i at time ti = t0+iδ


o Bit b arrives at arrives at destination at tn+1 = t0+(n+1)δ

 Total bit transfer delay CS= (n+1)δ (basically just propagation delay)
 δ=5 msec, σ=1 msec, n=4
CS =25 msec; Tsetup=60 msec (but only relevant to first bit) 19
Packet vs. Circuit Switching
Streaming application
 Packet streaming delay

PS = L/R + (n+1) [(L+H)/c + δ]

 Circuit delay

CS = (n+1)δ

 Difference: PS – CS = L/R + (n+1)(L+H)/c

o Basically packetization + hop-by-hop retransmissions.


o As R and c increase, packet switching is less at a
disadvantage
o But there are many other factors to consider, e.g., coding and
decoding delay, etc.
More on Delay in Packet Networks
 Three main sources of network delay

o Transmission delay:
• Time to get bits sent onto a link

o Propagation delay:
• Time for bits to travel along a path

o Queuing delay:
• Time bits spend waiting in a queue (before a link)
21
Delays in Packet Networks
 Transmission delay: time to send a given number of
bits (e.g., a packet) onto a link of a given transmission
rate (bits/sec)
• Function of packet size and link speed, T=L/c, L is packet size (in
bits) and c is link speed (in bits/sec)

 Propagation delay: time for signals to travel over a


given distance ( = l/s, l is distance, s is signal
propagation speed)
• s is upper-bounded by speed of light, but typically lower in fiber,
cables and atmosphere (from 180,000 km/sec to 300,000
km/sec), i.e., around 25 msec coast-to-coast in the US
• We will typically approximate this to 200,000 km/sec

22
Delays in Packet Networks
 Queuing delay (waiting time): Caused by contention for
transmission resources (multiple packets seeking
transmission on the same link)
o Queueing delay
• N is the number of packets in the queue (when a new packet
arrives)
• Li, i = 1,…,N, is the size of packet i in bits
• i=1,…,N Li is number of bits ahead of you (assumes FCFS)
• c is link speed in bits/sec
• Queueing delay is then i=1,…,N Li/c
o Average queueing delay W
• E[N] x E[L] is the number of bits already in the queue on average
when a new packet arrives
• Hence, W = (E[N] x E[L])/c is, the average time it takes to transmit
bits ahead in the queue, a.k.a., average queueing delay 23
Revisiting Total Network Delay
 File transfer completion
o Time until last packet is ready for transmission by the source
o Plus sum of transmission, propagation, and queueing delays
at all hops for last packet
Pd= (M+M/LH)/c + n(L+H)/c + (n+1)δ +i=1,…,n Wi

 Streaming application delay


o Packetization delay (L/R)
o Plus sum of transmission, propagation, and queueing delays
at all hops for each packet
PS= L/R + (n+1) [(L+H)/c + δ] + i=1,…,n Wi

24
Estimating (Average) Queueing Delay
(at a single link)

 Estimating average packet size E[L] is relatively easy


 Link speeds c are known
 The main issue is estimating average queue size E[N]
 Key parameters
o Traffic load =aE[L]/c, where a is
packet arrival rate
o Maximum number of packets: B
 Infinite queue approx.
o E[N] /(1-)
o Assumes “random” packet
arrivals and lengths
o Reasonable for  below 0.8
 Exact finite queue expression  for =0.8 E[N]=4, so that if
 1  B B 1  B  1 B  E[L]=5,000 bits and c=108
EN  
1   1   B 1  bps, W=200 sec
25
Other Performance Metrics
 Throughput: rate at which data can be transferred across the
network
o In a circuit-switched network, throughput is fixed and equal to the
circuit rate
o In a packet-switched network, throughput is variable (depends on
interactions with other packets), but can be as high as the link rate
 Packet loss: fraction of packets not properly delivered (lost or
corrupted – the former is much more prevalent, except in
wireless networks)
o In networks, losses depend mostly on traffic load () and queue size B
o Approximate expression for packet loss probability PB
 B 1   
PB 
1   B1 
26
Accurate for random packet arrivals and lengths
The Tiered Structure of the Internet
 Network edge
o hosts and applications
core
o application architectures
• client/server, peer-to-peer
 Access network access
o physical media
• wired Ethernet, wireless, edge
DSL, cable networks, ...
o access network components
• DSL modems, firewalls, network address translators, ...
 Network core
o interconnected routers and related services
• Domain Name Service (DNS), routing protocols
o enable communication among a “network of networks”
27
Access Networks
 First-hop – from end systems to access routers
 Common types
o residential access – dial-up, DSL, cable modems, fiber-to-
home
o institutional access – universities, businesses, governments
o mobile access – for cell phone, tablets
 Key attributes
o network data rates
• 50 Kb/s for dialup to 10 Gb/s (or more) for wired Ethernet in
institutional networks and data centers
o dedicated or shared
• in shared access, must compete for access bandwidth with
other users, making service more variable, e.g., WiFi
o susceptibility to interference and eavesdropping
• service quality in wireless networks can be highly variable
• encryption essential for privacy
28
Network Core
 Rough hierarchy of Internet Service Providers
o Tier 1 ISPs operate at national/international scale
• large routers (Tb/s capacities) and growing
• connected by high speed links (10 to 40 Gb/s)
o Tier 2 ISPs operate on regional scale
o Tier 3 ISPs operate on local scale, provide access
o Large content providers (Google, Akamai, ...) operate
partly like Tier 1 ISPs

 Internet is a “network of networks”


o packets pass through many networks on their way from
source to destination
o requires cooperation among providers and mechanisms to
share cost and revenue
o ownership and management highly distributed
o ~12,000 ISPs today 29
Internet Protocol Layers
 Application layer (messages)
o implements user applications
Application Application
• email, web browsing
Transport Transport
 Transport layer (segments) Network Network Network
o concerned with moving data Link Link Link
between processes on hosts Physical Physical Physical
• UDP and TCP
host router host
 Network layer (datagrams/packets)
o concerned with moving datagrams/packets from host to host
through network of routers
• IP
 Link layer (frames)
o concerned with moving frames across local network
• Ethernet
 Physical Layer (bits)
o transferring bits across physical medium 30
Layers and Encapsulation
 Layers make network design more modular
o separate functions allowing different parts of a network to be
changed without affecting other parts
o “layer violations” inhibit the ability to make changes
o layer violations have become common in modern internet
• firewalls, middle-boxes, cross-layer optimizations for better
wireless performance
 As
packets go “down the stack”, each layer adds its
own packet header (encapsulation)
o UDP (alternatively TCP) adds 8 bytes (20) at transport layer
o IPv4 (alternatively IPv6) adds 20 bytes (40) at network layer
o Ethernet typically adds 26 bytes at link layer
 Aspackets go back “up the stack”, headers are
removed (decapsulation)
31
Internet Security (or Insecurity)
 Internet designed with little thought for security
o designed for well-intentioned and cooperative users
• in the modern internet, reality is very different
 Variety of tools at disposal of “bad guys”
o insert malware on hosts via virus, worm, Trojan horse,...
o use malware to spy on users, steal passwords
o use subverted hosts to send spam, launch DDoS attacks
o evade detection using source-address spoofing
o eavesdrop on other users as packets pass through shared
networks
o record and playback encrypted passwords
 Defenses
o keep up with security patches
o virus/malware detection and removal
o use strong encryption for all sensitive information
32
Exercises
1. Which of the following are not valid IPv4 addresses?
a) 12.34.5.57 b) 134.25.321.44 c) 0x23fed97c
d) 0.0.0.0 e) 0x1435c984b f) 275.31.48.21

33
Exercises
1. Which of the following are not valid IPv4 addresses?
a) 12.34.5.57 b) 134.25.321.44 c) 0x23fed97c = 35.254.217.23
d) 0.0.0.0 e) 0x1435c984b f) 275.31.48.21

both b) and f) have numbers greater than 255, which is not possible
given the 8-bit limitation of each number in a 32-bit IP address.
e) involves 9 hex characters, which is too many for a 32-bit address.

34
Exercises
2. Suppose that 100 packets arrive at a router all at the
same time, and must be sent out on the same output link.
If it takes 5 ms to transmit one packet, what is the
maximum delay experienced by the arriving packets?
What is the minimum delay? What is the average delay?

35
Exercises
2. Suppose that 100 packets arrive at a router all at the
same time, and must be sent out on the same output link.
If it takes 5 ms to transmit one packet, what is the
maximum delay experienced by the arriving packets?
What is the minimum delay? What is the average delay?

If you have 100 packets waiting, the delay of the first is


5msecs, the delay of the last is 500msecs, and the average
delay is 252.5msecs

36
Exercises
3. Consider the network path shown below. What is the total
end-to-end delay for a packet sent from A to B?
Labels above the links denote their transmission rates (so the middle
link has a rate of 1 Gb/s, i.e., 109 bits/sec). The labels below the links
are their lengths in km (signals propagate at 200,000 km/sec). Traffic
intensities are shown at the left end of each link. The average packet
length is 250 bytes. Assume infinite queues at each node.

10G 1G 1G 2M 10M
.1 km 200 km 1000 km 2 km .02 km
A =.9  =.98  =.5  =.1 B

37
Exercises
3. Consider the network path shown below. What is the total end-to-end delay
for a packet sent from A to B?
Labels above the links denote their transmission rates (so the middle link has a rate of 1
Gb/s, i.e., 109 bits/sec). The labels below the links are their lengths in km (signals
propagate at 200,000 km/sec). Traffic intensities are shown at the left end of each link.
The average packet length is 250 bytes.

10G 1G 1G 2M 10M
.1 km 200 km 1000 km 2 km .02 km
A =.9  =.98  =.5  =.1 B

First calculate average queue sizes.


Next we need the transmission delay at each hop for 1 pkt.
Then apply that to the queue sizes + 1. Then calculate propagation
delay. Sum that all up and we have 8.35 ms.
1 2 3 4 5 E2E
Load ( r ) 0 0.9 0.98 0.5 0.1
Link rate (b/s) 1.00E+10 1.00E+09 1.00E+09 2.00E+06 1.00E+07
Link length (km) 0.1 200 1000 2 0.02
Average queue length (pkts): E[N] = r/(1- r) 0 9 49 1 0.111111
Packet transmission time (sec): T = L/c 2.00E-07 2.00E-06 2.00E-06 1.00E-03 2.00E-04
Queueing + transmission delay (sec): (E[N]+1)*T 2.00E-07 2.00E-05 1.00E-04 2.00E-03 2.22E-04 2.34E-03
Propagation delay (sec): link length/200,000 km/s 5.00E-07 1.00E-03 5.00E-03 1.00E-05 1.00E-07 6.01E-03
8.35E-03 38
Exercises
4. Using the previous exercise, the traffic intensity at the 2
Mb/s link increases to 1.5, so that the average queueing
delay at the link increases to 200 ms, what is the capacity
of the queue feeding the link? What fraction of packets are
discarded?

39
Exercises
4. Using the previous exercise, the traffic intensity at the 2
Mb/s link increases to 1.5, so that the average queueing
delay at the link increases to 200 ms, what is the capacity
of the queue feeding the link? What fraction of packets are
discarded?

Assuming that under a load of 1.5, the queue is nearly full


all the time, the queue size or capacity is 200 packets (the
transmission time of a 250 bytes = 2,000 bits packet over a
2 Mbits/sec link is 1 ms). A queue size of 200 packets
translates into 200*250 = 50 kbytes.

Given a load of 1.5, about 1/3 of the packets are lost


(roughly ( -1)/ : explanation on next page)

40
Exercises
4. Continued…

A load of  = 1.5 means that for a link of capacity c bits/sec,


we are trying to push 1.5 x c bits/sec. Ignoring packet
granularity and focusing on bits, this means that for every 2
bits we transmit, the input link brings in 3 bits. The
transmission of 2 bits frees up 2 bits in the buffer that can
then accommodate 2 of the 3 arriving bits, but the 3rd is lost.
Hence the fraction of bits we lose is 1/3rd or in other words, a
loss probability of 1/3rd, which is indeed equal to ( -1)/ =
0.5/1.5 = 1/3rd

41

You might also like