Académique Documents
Professionnel Documents
Culture Documents
Paul Krzyzanowski
pxk@cs.rutgers.edu
ds@pk.org
Except as otherwise noted, the content of this presentation is licensed under the Creative Commons
Attribution 2.5 License.
Page 1
Distributed systems
Page 2
Modes of connection
Circuit-switched
– dedicated path
– guaranteed (fixed) bandwidth
– [almost] constant latency
Packet-switched
– shared connection
– data is broken into chunks called packets
– each packet contains destination address
– available bandwidth ≤ channel capacity
– variable latency
Page 3
What’s in the data?
For computers:
– electrical encoding of data
– where is the start of the packet?
– which bits contain the length?
– is there a checksum? where is it?
how is it computed?
– what is the format of an address?
– byte ordering
Page 4
Protocols
Page 5
Protocols
versus
Page 6
Layering
Page 7
Layering
7 layers of protocols
Page 8
OSI Reference Model: Layer 1
1 Physical
Physical
Examples: RS-232, 10BaseT
Page 9
OSI Reference Model: Layer 2
Detects and corrects errors.
Organizes data into packets
before passing it down.
Sequences packets (if necessary).
Accepts acknowledgements from
receiver.
2 Data
Data Link
Link
1 Physical
Physical
Examples: Ethernet MAC, PPP
Page 10
OSI Reference Model: Layer 3
3 Network
Network
2 Data
Data Link
Link
1 Physical
Physical
Examples: IP, X.25
Page 11
OSI Reference Model: Layer 4
Provides a consistent
interface for end-to-end
(application-to-application)
communication. Manages
flow control.
Network interface is
Transport similar to a mailbox.
4 Transport
3 Network
Network
2 Data
Data Link
Link
1 Physical
Physical
Examples: TCP, UDP
Page 12
OSI Reference Model: Layer 5
Services to coordinate
dialogue and manage data
exchange.
Software implemented
Session switch.
5 Session
Manage multiple logical
4 Transport
Transport connections.
1 Physical
Physical Examples: HTTP 1.1, SSL,
NetBIOS
Page 13
OSI Reference Model: Layer 6
Data representation
Concerned with the
6 Presentation
Presentation meaning of data bits
5 Session
Session Convert between
4 Transport
Transport machine
representations
3 Network
Network
2 Data
Data Link
Link
1 Physical
Physical Examples: XDR, ASN.1,
MIME, MIDI
Page 14
OSI Reference Model: Layer 7
Collection of application-
7 Application
Application specific protocols
6 Presentation
Presentation
5 Session
Session
4 Transport
Transport
3 Network
Network
2 Data
Data Link
Link Examples:
email (SMTP, POP, IMAP)
1 Physical
Physical file transfer (FTP)
directory services (LDAP)
Page 15
Some networking
terminology
Page 16
Local Area Network (LAN)
Communications network
– small area (building, set of buildings)
– same, sometimes shared, transmission medium
– high data rate (often): 1 Mbps – 1 Gbps
– Low latency
– devices are peers
• any device can initiate a data transfer with any other
device
Page 17
Connecting nodes to LANs
network computer
Page 18
Connecting nodes to LANs
network computer
Adapter
– expansion slot (PCI, PC Card, USB dongle)
– usually integrated onto main board
Twisted pair
– Most common:
• STP: shielded twisted pair
• UTP: unshielded twisted pair
(e.g. Telephone cable, Ethernet 10BaseT)
Coaxial cable
– Thin (similar to TV cable)
– Thick (e.g., 10Base5, ThickNet)
Fiber
Wireless
Page 20
Hubs, routers, bridges
Hub
– Device that acts as a central point for LAN cables
– Take incoming data from one port & send to all other ports
Switch
– Moves data from input to output port.
– Analyzes packet to determine destination port and makes a virtual
connection between the ports.
Concentrator or repeater
– Regenerates data passing through it
Bridge
– Connects two LANs or two segments of a LAN
– Connection at data link layer (layer 2)
Router
– Determines the next network point to which a packet should be
forwarded
– Connects different types of local and wide area networks at
network layer (layer 3)
Page 21
Networking Topology
Bus Network
Page 22
Networking Topology
Tree Network
Page 23
Networking Topology
Star Network
Page 24
Networking Topology
Ring Network
Page 25
Networking Topology
Mesh Network
Page 26
Transmission networks
Baseband
– All nodes share access to network media on an
equal basis
– Data uses entire bandwidth of media
Broadband
– Data takes segment of media by dividing media into
channels (frequency bands)
Page 27
Broadband: RF broadcasts
http://www.ntia.doc.gov/osmhome/allochrt.pdf
Page 28
Broadband/Baseband: Cable TV
Broadband
audio +5.75 MHz
55-552 MHz: analog channels 2-78
6 MHz
553-865 MHz: digital channels 79-136 video
+1.25 MHz
Baseband within Broadband
DOCSIS: Data Over Cable Service Interface Specification
(approved by ITU in 1998; DOCSIS 2.0 in 2001)
Page 29
DOCSIS Modem
modulator
ethernet interface
(to PC)
Page 30
Baseband: Ethernet
Page 31
Ethernet media
Bus topology (original design)
– originally thick coax (max 500m): 10Base5
– then… thin coax (<200m): 10Base2
• BNC connector
Page 32
Wireless Ethernet media
Wireless (star topology)
– 802.11 (1-2 Mbps)
– 802.11b (11 Mbps - 4-5 Mbps realized)
– 802.11a (54 Mbps - 22-28 Mbps realized)
– 802.11g (54 Mbps - 32 Mbps realized)
– 802.11n (108 Mbps - 30-47 Mbps realized)
ethernet
Access Point
Page 33
Connecting to the Internet
Page 34
Connecting to the Internet
• Dedicated T1 or T3 line
– T1 line: 1.544 Mbps
(24 PCM TDMA speech lines @ 64 kbps)
– T3 line: 44.736 Mbps (672 channels)
– CSU/DSU at router presents serial interface
• Channel Service Unit / Data Service Unit
Page 35
Connecting to the Internet
Page 36
Clients and Servers
Page 37
Machine address
versus
Transport address
Page 38
Transport provider
Two categories:
connection-oriented protocols
connectionless protocols
Page 39
Connection-oriented Protocols
1. establish connection
2. [negotiate protocol]
3. exchange data
4. terminate connection
Page 40
Connection-oriented Protocols
Page 41
Connectionless Protocols
- no call setup
- send/receive data
(each packet addressed)
- no termination
Page 42
Connectionless Protocols
analogous to mailbox
- no call setup
- send/receive data drop letter in mailbox
(each packet addressed) (each letter addressed)
- no termination
datagram service
– client is not positive whether message arrived at
destination
– no state has to be maintained at client or server
– cheaper but less reliable than virtual circuit
service
Page 43
Ethernet
Page 44
Ethernet
frame
dest addr src addr data (payload) CRC
type
18 bytes + data
Page 45
IP – Internet Protocol
Goal:
build an efficient fault-tolerant network
that could connect heterogeneous
machines and link separately connected
networks.
Page 46
Internet Protocol
Page 47
IP Addressing
Each machine on an IP network is assigned a unique 32-bit number
for each network interface:
– IP address, not machine address
Page 48
IP Address space
Page 49
IP Addressing: networks & hosts
cs.rutgers.edu remus.rutgers.edu
128.6.4.2 128.6.13.3
80 06 04 02 80 06 0D 03
network # host #
Page 50
IP Addressing: networks & hosts
• IP address
– network #: identifies network machine belongs to
– host #: identifies host on the network
Page 51
IP Addressing
Expectation:
– a few big networks and many small ones
– create different classes of networks
– use leading bits to identify network
Page 52
IP Addressing
IBM: 9.0.0.0 – 9.255.255.255
Page 53
Running out of addresses
• Huge growth
Page 54
Classless Inter-Domain Routing (CIDR)
Page 55
Classless Inter-Domain Routing
Page 57
IPv6 vs. IPv4
IPv4
– 4 byte (32 bit) addresses
IPv6:
– 16-byte (128 bit) addresses
3.6 x 1038 possible addresses
8 x 1028 times more addresses than IPv4
– 4-bit priority field
– Flow label (24-bits)
Page 58
Network Address Translation (NAT)
External IP address
24.225.217.243
Internal
IP address
192.168.1.x .1 .2 .3 .4 .5
Page 59
Getting to the machine
Page 60
IP driver responsibilities
Page 61
Device driver responsibilities
Page 62
Network device
device
IP header IP data
header
payload
Page 63
Device addressing
Page 64
Routing
Router
– Switching element that connects two or more
transmission lines (e.g. Ethernet)
Page 65
Routing
Page 66
Dynamic Routing
• Route cost:
– Hop count (# routers in the path)
– Time: Tic count – time in 1/18 second intervals
Page 67
Dynamic Routing Examples
Page 68
Transport-layer protocols over IP
Page 69
TCP – Transmission Control Protocol
Page 70
UDP – User Datagram Protocol
Page 71
IP header
device TCP/UDP
IP header IP data
header header
payload
20 bytes
TTL protocol header checksum
source IP address
destination IP address
options and pad
Page 72
Headers: TCP & UDP
device TCP/UDP
IP header IP data
header header
payload
Page 73
Device header (Ethernet II)
device TCP/UDP
IP header IP data
header header
payload
frame
dest addr src addr data CRC
type
18 bytes + data
Page 74
Quality of Service Problems in IP
• Unreliable delivery
– Software to the rescue – TCP/IP
Page 75
IP Flow Detection
– Traffic Policing
• Discard traffic that exceeds allotted bandwidth
Page 76
Dealing with congestion
• FIFO queuing
• Priority queues
• Flow-based weighted fair queuing
– Group all packets from a flow together
• Class-based weighted fair queuing
– Based on protocols, access control lists,
interfaces, etc.
• Custom queues
Page 77
Inefficient Packets
• Header/packet compression
– Link-to-link
– Header compression (RFC 3843)
– Payload compression (RFC 2393)
– $ delivery vs. $ compression
Page 78
Differentiated Services (soft QoS)
Page 79
TOS bits
Page 80
Differentiated Services (Diff-Serv)
p p p d t r - -
Reliability: normal/high
Priority: 0-7 Throughput: normal/high
Delay: normal/low
Page 81
Guaranteed QoS (hard QoS)
Page 82
Reservation & Delivery Protocol
Page 83
Media Delivery Protocols
• Real-Time Control Protocol (RTCP)
– Provides feedback on QoS (jitter, loss, delay)
– RFC 3550
Page 84
ATM: Asynchronous Transfer Mode
Late 1980’s
Goal: Merge voice & data networking
Page 85
ATM
Page 86
ATM
Current standard:
– 53-byte cell: 48-byte data, 5-byte header
Sender specifies traffic type upon connecting:
Page 87
ATM
Page 88
Programming Interfaces
Page 89
Sockets
Page 90
Sockets
Page 91
Socket
Page 92
Programming with sockets
Page 93
Step 1
Create a socket
Page 94
Step 2
Page 95
Step 3a (server)
Set socket to be able to accept connections
Page 96
Step 3b (server)
Page 97
Step 3 (client)
Connect to server
Page 98
Step 4
Exchange data
Connection-oriented
read/write
recv/send (extra flags)
Connectionless
sendto, sendmsg
recvfrom, recvmsg
Page 99
Step 5
Close connection
shutdown(s, how)
how:
0: can send but not receive
1: cannot send more data
2: cannot send or receive (=0+1)
Page 100
Sockets in Java
java.net package
Page 101
Step 1a (server)
ServerSocket svc =
new ServerSocket(port)
Page 102
Step 1b (server)
Page 103
Step 1 (client)
obtained from:
getLocalHost, getByName,
or getAllByName
Socket s =
new Socket(“cs.rutgers.edu”, 2211);
Page 104
Step 2
Exchange data
obtain InputStream/OutputStream from
Socket object
BufferedReader in =
new BufferedReader(
new InputStreamReader(
s.getInputStream()));
PrintStream out =
new PrintStream(s.getOutputStream());
Page 105
Step 3
Terminate connection
close streams, close socket
in.close();
out.close();
s.close();
Page 106
Socket Internals
Page 107
Protocol Control Block
Page 108
Server: svr=socket()
Page 109
Server: bind(svr)
Page 110
Server: listen(svr, 10)
Page 111
Server: snew=accept(svr)
Page 112
Client: s=socket()
Page 113
Client: s=bind(s)
Page 114
Client: connect(s)
Page 115
Client: connect(s)
Page 116
Communication
Each message from client is tagged as either data or control
(e.g. connect)
Page 117
The end.
Page 118