Chapter 3 Networking
Chapter 3 Networking
▪ Concepts
▪ Switching
▪ Routing (IP)
▪ End-to-End Protocols (UDP/TCP)
▪ Wireless LAN
Introduction
Building Blocks
multiple access
(b)
■■■
Switched Networks
router/
Campus138.37.95.240/29 138.37.95.241 firewall
router subnet hammer
Staff subnet Student subnet
138.37.88 138.37.88.251 138.37.94.251 138.37.94
compute file server/
server Eswitch Eswitch
gateway
bruno
138.37.88.249 custard
138.37.94.246 printers
dialup
server
henry
138.37.88.230
other
file servers
server
hotpoint
138.37.88.162
web
server
copper
138.37.88.248
hub hub
sickle
Campus138.37.95.248/29 100 Mbps Ethernet
router subnet router/
138.37.95.249 firewall
1000 Mbps Ethernet
Eswitch: Ethernet switch
Firewall configurations
Internet
web/ftp
server
Internet
web/ftp
server
Internet
web/ftp
server
Addressing and Routing
Channel
Host
Application
Host Host
Multiplexing
L1 R1
L2 R2
Switch 1 Switch 2
L3 R3
Statistical Multiplexing
On-demand time-division
Schedule link on a per-packet basis
Packets from different sources interleaved on
link
Buffer packets that are contending for the link
Buffer (queue) overflow is called congestion
■■■
What Goes Wrong in the Network?
Layer n
Layer 2
Layer 1
Sender Communication Recipient
medium
Protocol layers in the ISO Open Systems Interconnection (OSI) model
Presentation header
Network header
ISO Architecture
Application Application
Presentation Presentation
Session Session
Transport Transport
Message
Layers
Application
Messages (UDP) or Streams (TCP)
Transport
UDP or TCP packets
Internet
IP datagrams
Network interface
Network-specific frames
Underlying network
Encapsulation in a message transmitted via TCP over an Ethernet
Application message
IP header TCP
Ethernet header IP
Ethernet frame
The programmer's conceptual view of a TCP/IP Internet
Application Application
TCP UDP
IP
Internet Architecture
Hourglass Design
Application vs Application Protocol (FTP, HTTP)
TCP UDP
IP
■■■
NET 1 NET 2 NET n
Protocol Multiplexing
Multiplexing and Demultiplexing (demux key)
Encapsulation (header/body)
Host Host
Application
Application Application
Application
program
program program
program
Data Data
RRP RRP
HHP HHP
Switch
Connect links to form a larger network.
Connect switches to form a larger network.
forwards packets from input port to output port
port selected based on address in packet header
Advantages
store and forward
support large numbers of hosts
Datagram Switching
A 2 0 Switch 1 Host E
Host F
C 3 3 1
2 Switch 2
F 1 Host C
2 3 1
G 1 0
… … Host A
X Y Z
Learn table entries based on source address
Table is an optimization; need not be complete
Always forward broadcast frames
Routing (IP)
Internetworking
H7 R3 H8
H1 H2 H3
Network 4
Network 2 (Ethernet) (point-to-point)
R1
R2
H4
Network 3 (FDDI)
H5 H6
IP Internet
TCP R1 R2 R3 TCP
IP IP IP IP IP
Connectionless (datagram-based)
Best-effort delivery (unreliable service)
packets can be lost, delayed, duplicated, delivered out of
order.
Datagram format: IP header
0 4 8 16 19 31
Version HLen TOS Length
SourceAddr
DestinationAddr
7 24
Clas s A: 0 Network ID Hos t ID
14 16
Clas s B: 1 0 Network ID Hos t ID
21 8
Clas s C: 1 1 0 Network ID Hos t ID
28
Clas s D (multicast): 1 1 1 0 Multicast addres s
27
Clas s E (reserved): 1 1 1 1 0 unus ed
globally unique
hierarchical: network + host
Decimal representation of Internet addresses
H7 R3 H8
H1 H2 H3
Network 4
Network 2 (Ethernet) (point-to-point)
R1
R2
H4
Network 3 (FDDI)
H5 H6
Address Translation in LAN
Map IP addresses into physical addresses of the
destination host (if connected directly) or the next hop
router
ARP
Each host caches its table of IP to physical address bindings
table entries are discarded if not refreshed
timeout in about 10 minutes
broadcast request if IP address not in table
target machine send its physical address to the sender
target machine also updates add entry of the source in its table
It is likely that the target will send IP packets to the source later on.
Other hosts (who receives the broadcasted request) update
table if already have an entry
End-to-End Protocols
Optional checksum
psuedo header (IP.src, IP.dsest, IP.proto, UDP.len) + UDP
header + data
TCP Overview
Write Read
bytes bytes
TCP TCP
Send buffer Receive buffer
■■■
Segment Segment Segment
Transmit segments
Segment Format
0 4 10 16 31
SrcPort DstPort
SequenceNum
Acknowledgment
Checksum UrgPtr
Options (variable)
Data
Segment Format (cont)
Each connection identified with 4-tuple:
(SrcPort, SrcIPAddr, DsrPort, DstIPAddr)
Sliding window + flow control
acknowledgment, SequenceNum, AdvertisedWinow
Data (SequenceNum)
Sender Receiver
Acknowledgment +
AdvertisedWindow
Flags
SYN, FIN, RESET, PUSH, URG, ACK
Checksum
pseudo header + TCP header + data
Connection Establishment and Three-Way Handshake
Creating a socket
int socket(int domain, int type, int protocol)
type = SOCK_STREAM, SOCK_DGRAM, SOCK_RAW
Sending/Receiving Messages
int send(int socket, char *msg, int mlen, int flags)
int recv(int socket, char *buf, int blen, int flags)
Wireless LAN
Ethernet Overview
64 48 48 16 32
Addresses
unique, 48-bit unicast address assigned to each adapter
example: 8:0:e4:b1:2
Every body hears the frame (shared media). But the one with
matching destination address picks up.
broadcast: all 1s
multicast: first bit is 1. The host can configure its adaptor to
accept some multicast addresses
Preamble (a seq. alternating 0s and 1s ) indicates the
start of a frame
Type: high-level protocols
Transmit Algorithm
If line is idle…
send immediately
upper bound message size of 1500 bytes
Limited occupancy on the line.
must wait 9.6us between back-to-back frames
To allow other hosts to send.
If line is busy…
wait until idle and transmit immediately
Collisions
delay (c)
detected during
transmission
51.2us •10Mbps = 64
bytes
Upon Collision
IEEE 802.11
Bandwidth: 1 - 11 Mbps
Physical Media
diffused infrared (10m)
Diffused: the sender do not need a clear line of sight.
spread spectrum radio (2.4GHz): 11 Mbps 54Mbps
Wireless LAN configuration
A B C
Laptops
LAN
Infrastructure mode
fixed
terminal
mobile terminal
infrastructure
network
access point
application application
TCP TCP
IP IP
LLC LLC LLC
802.11 MAC 802.11 MAC 802.3 MAC 802.3 MAC
802.11 PHY 802.11 PHY 802.3 PHY 802.3 PHY
Supporting Mobility
Distribution system
AP-1 AP-3
AP-2 F
A B G
H
C E
D
Collisions Avoidance
Actually no collision at A or D
Priorities
defined through different inter frame spaces
no guaranteed, hard priorities
SIFS (Short Inter Frame Spacing)
highest priority, for ACK, CTS, polling response
PIFS (PCF IFS)
medium priority, for time-bounded service using PCF
DIFS (DCF, Distributed Coordination Function IFS)
lowest priority, for asynchronous data service
DIFS DIFS
PIFS
SIFS
medium busy contention next frame
t
direct access if
medium is free DIFS
802.11 CSMA/CA
contention window
(randomized back-off
DIFS DIFS
mechanism)
direct access if t
medium is free DIFS slot time
station ready to send starts sensing the medium (Carrier Sense based
on CCA, Clear Channel Assessment)
if the medium is free for the duration of an Inter-Frame Space (IFS), the
station can start sending (IFS depends on service type)
if the medium is busy, the station has to wait for a free IFS, then the
station must additionally wait a random back-off time (collision
avoidance, multiple of slot-time)
if another station occupies the medium during the back-off time of the
station, the back-off timer stops (fairness)
802.11 CSMA/CA: contention resolution
boe busy
station2
busy
station3
busy medium not idle (frame, ack etc.) boe elapsed backoff time
DIFS
data
sender
SIFS
ACK
receiver
DIFS
other data
stations t
waiting time contention
Multiple Access with Collision Avoidance (MACA)
DIFS
RTS data
sender
SIFS SIFS
CTS SIFS ACK
receiver