Title: TDC561 Network Programming
1TDC561 Network Programming
Review Network Terminology Internet-work
Architecture Network Protocols for the Internet
- Camelia Zlatea, PhD
- Email czlatea_at_cs.depaul.edu
2Communication Network
- Set of services and features (from End system
view or Application programmer view) - Ex. guaranteed message delivery between
origination and termination points - Type of service differentiates the type of
networks - Ex. voice/PSTN vs. data networks
- Network Services distinguished by a set of
properties (mainly from Network Designer view) - Latency, bandwidth, number of end-points, service
interface, reliability resource utilization and
fair allocation. - Network Services easy-to-manage and to operate
(from Network Provider view) - Easy provisioning of network devices
- Rapid isolation and correlation of faults, alarms
3Network Performance
- Bandwidth (Throughput)
- of bits transmitted over the network in a
certain interval of time - Ex. 10 mil bits per sec (Mbps)
- Latency (Delay)
- How long it takes a message to travel from one
end to other of a network - Ex. One-way delay (latency)
- Round-Trip Delay
- LatencyPropagationTransmitQueue
- PropagationDistance/SpeedOfLight
- TransmitSize/Bandwidth
4Type of Networks
- Distance
- LAN (Local Area Networks)
- Ethernet, Token Ring, FDDI
- WAN (Wide Area Networks)
- X.25, ATM, Frame Relay
- Information Type
- Data Networks, telephony network (PSTN)
- Application Type
- General purpose (Internet) vs. special purpose
(banking network) - Security level
- Private enterprise networks
- Public PSTN, Internet
- Ownership of Protocols
- Proprietary SNA, IPX
- Open IP
- Protocol
- IP, IPX, AppleTalk, SNA
5The Internet
- Global scale, general purpose, heterogeneous
technologies, public, computer network - Internet Protocol (IP)
- Open system IETF (Internet Task Force) as
standard body - Intranet enterprise IP network
- IETF the protocol engineering and development
arm of the Internet. Subdivided into many groups,
which specify RFCs (Request For Comments) - A Typical Internet Standardization Process
- Internet Drafts
- RFC
- Proposed Standard
- Draft Standard (requires 2 working
implementations) - Internet Standard (declared by Internet
Architecture Board IAB, which is responsible for
defining the overall architecture of the
Internet, providing guidance and broad directions
6Connectivity
- Links physical medium connecting directly two
or more computers - Nodes computers connected by links
- Nodes attached at least two links run software
that forwards data received on one link out on
another - Switched Network forwarding nodes
systematically organized - Circuit-switched network
- Common for telephony network
- Strategy (1) establishes a dedicated circuit
across a sequence of links (2) source node sends
a stream of bits across this circuit to a
destination node. - Packet-switched network
- Network nodes send discrete blocks of data to
each other (packets/messages) - Store-and-forward strategy each node (1)
receives a packet, (2) stores packet in its
internal memory buffer, and (3) forward packet to
the next node.
7Connectivity
- Circuit-switched network
- Common for telephony network
- Strategy (1) establishes a dedicated circuit
across a sequence of links (2) source node sends
a stream of bits across this circuit to a
destination node (3) Circuit Termination - Busy signal if capacity for a circuit not
available - ExamplesPSTN Telephone networks, ISDN
(Integrated Service Digital Network) -
- Incoming links Node Outgoing links
8Circuit-switched network
Host1 Node2 Node3 Host4
Processing Delay
(1)
(2)
DATA
(3)
- Circuit establishment
- Data Transmission
- Circuit Termination
9Connectivity
- Packet Switching
- Network nodes send discrete blocks of data to
each other (packets/messages) - Store-and-forward strategy each node (1)
receives a packet, (2) stores packet in its
internal memory buffer, and (3) forward packet to
the next node. - Packet/Message Structure
- Header, Data, Trailer
- Each packet is passed through the network from
node to node along some path (Routing) - At each node the entire packet is received,
stored briefly, and then forwarded to the next
node (Store-and-Forward) - No capacity is allocated for the packets
10Packet-switching network
Host1 Node2 Node3 Host4
Processing Delay
Pk1 Pk2 Pk3
Pk1 Pk2 Pk3
Pk1 Pk2 Pk3
11Connectivity
- Virtual-Circuit Packet Switching
- Hybrid of circuit switching and packet switching
- All data is transmitted as packets
- All packets from one stream are sent along a
pre-established path (virtual circuit VC) - Guarantees in-sequence delivery of packets
- Packets from different virtual circuits can be
interleaved - Strategy
- VC establishment
- Data Transfer
- VC Disconnect
12Virtual Circuit Packet-switching network
Host1 Node2 Node3 Host4
Processing Delay
(1) (2) (3)
Pk1 Pk2 Pk3
Pk1 Pk2 Pk3
Pk1 Pk2 Pk3
13Protocol Architecture
- Protocol agreement between communication
entities on how to interpret meta-data or headers - Different layers put in different layers
NANetwork Access
Application protocol
App
App
TCP protocol
TCP
TCP
IP protocol
IP
IP
IP
IP
NA
NA
NA
NA
NA
NA
Data Links
Host Router
Router Host
14Layering
- Organization of a network system into a
successive logically distinct entities, such that
the service provided by one entity is determined
based on the service provided by the previous
(lower level) entity - Advantages
- Abstraction ( an intermediate layer that provides
an unique abstraction for applications regarding
various network technologies - Lower layers can be changed without affecting the
upper layers - Modularity protocol easy to manage and maintain
- Reuse upper layers can reuse the functionality
provided by lower layers - Disadvantages
- Information hiding can cause inefficient
implementations
15ISO OSI Reference Model
- ISO International Standard Organization
- OSI Open System Interconnection
- Goal A general OPEN standard
Physical Medium
16OSI Model Concepts
- Service what a layer does
- Interface how to access the service
- Protocol how is the service implemented
- Set of rules and formats that govern the
communication between two peers
17Physical Layer
- Service - move info between two systems connected
by physical link - Interface how to send bits
- Protocol coding scheme used to represent a bit,
voltage levels, duration of a bit - Examples cable coax, fiber optic links
transmitters receivers
18Data Link Layer
- Service
- Send data frames between peers
- Framing, i.e. attach frame separators
- Arbitrate access to common media, ensure
reliability of transmission, provide flow control - Interface send a data unit (packet) to a node
connected to the same physical media - Protocol layer addresses, MAC (Medium Access
Control) - Examples CSMA/CD
19Network Layer
- Service
- Deliver a packet to a specified destination
- Perform segmentation/reassemble
- Packet scheduling
- Buffer management
- Interface send a packet to a specified
destination - Protocol define global unique addresses
construct routing tables - Example Routing
- Bearer/Data Plane uses forwarding table to
forward packets - Control Plane construct and maintain Forwarding
Tables (distance vectors, link state protocols)
20Transport Layer
- Service
- Error-free and flow-controlled end-to-end
connection - Interface send a packet to specify destination
- Protocol implement reliability and flow
control - Example TCP and UDP
21Session Layer
- Service
- Full-Duplex
- Access management (ex. token control)
- Synchronization (ex. Check points fro long
transfers) - Interface depends on service
- Protocol token management, checkpoints, for
long transfers, roll-back functions - Presentation Layer
- Service
- Data conversions
- Interface depends on service
- Protocol define data formats, and rules to
convert from one format to another
22Application Layer
- Service End-User type of Service
- Interface depends on application
- Protocol depends on application
- Examples FTP, Telnet, HTTP, H323
23Internet Reference Model
- OSI vs. TCP/IP Architecture
Internet
Host-to-Network
Physical Medium
24(No Transcript)
25IP is a Network Layer Protocol
26Encapsulation Example
Ethernet Header
IP Header
An Ethernet segment transmitting HTTP data.
TCP Header
HTTP Header
. HTTP Data .
27IP Hour Glass
Networking Applications
Remote Access
Voice
HOST
email
Multimedia
file transfer
Web
VPN
TCP
IP
Router
Frame
ATM
Ethernet
DWDM
SONET
FDDI
Link
X.25
Networking Technologies
28IP - Simple, Stupid, Flexible
- In the Internet, intelligence is in Hosts
- IP is connectionless, best effort.
- Routing protocols today provide only connectivity
and supports only one type of service best
effort datagram
29Typical Members of the IP Protocol Family
Telnet
30Routing Protocols, part of the IP Protocol Family
BGP
RIP
TCP
UDP
OSPF
IP
Routing protocols exchange network reachability
information between routers.
31Packet Delivery Model
- Connectionless (datagram-based)
- Best-effort delivery (unreliable service)
- packets are lost
- packets are delivered out of order
- duplicate copies of a packet are delivered
- packets can be delayed for a long time
32IP Routing Basics
- Routing is the process for deciding where to send
each packet. - There are a number of routing algorithms that
provide rules for how routers - Communicate with each other about router and link
status. - Maintain lists of reachable networks.
- Select between alternate paths.
33IP Datagram
- IP Datagram format
- Version (4) currently 4
- Hlen (4) number of 32-bit words in header
- TOS (8) type of service (used for QoS)
- Length (16) number of bytes in this datagram
- Ident (16) used by fragmentation
- Flags/Offset (16) used by fragmentation
- TTL (8) number of hops this datagram has
traveled - Protocol (8) demux key (TCP6, UDP17)
- Checksum (16) of the header only
- DestAddr SrcAddr (32)
34IP Datagram
0
4
8
16
19
31
TOS
Length
V
ersion
HLen
Ident
Flags
Fragment Offset
TTL
Protocol
Checksum
SourceAddr
DestinationAddr
Pad
Options (variable)
(variable)
Data
1981, RFC 791
35IP Header Format
1981, RFC 791
36Example IP Packets
TCP Packet
UDP Packet
IP Header
IP Header
UDP Header
TCP Header
UDP Payload
TCP Payload
37Fragmentation and Reassembly
- Each network has some MTU (Maximum Transfer Unit)
- Strategy
- fragment when necessary (MTU lt Datagram)
- try to avoid fragmentation at source host
- refragmentation is possible
- fragments are self-contained datagrams
- delay reassembly until destination host
- do not recover from lost fragments
38IP Fragmentation
- A main function of IP is to fragment and
reassemble packets on the fly - each network in a heterogeneous collection of
networks has a Maximum Transmission Unit (MTU) - maximum size of IP packet (datagram) that can be
carried on network - Packets must be fragmented if entering a network
with a smaller MTU - packets remain fragmented until the reach
destination host - packet headers remain mostly unchanged
- packets are then reassembled
39Ethernet Frame Format
- Link Layer Address Formats (802 headers - 8 bytes
long) - Addresses
- Unique, 48-bit unicast address assigned to each
adaptor - Example 802be4b12
- Broadcast all 1s
- Multicast first bit is 1
40TCP/IP Protocol Stack
HOST B Application
HOST B Application
Transport TCP, UDP
Transport TCP, UDP
Message
H
Message
H
Internet/Network
Internet/Network
Message
H
H
Message
H
H
Network Access
Network Access
Message
H
H
H
Message
H
H
H
Physical Link
41Client-Server Communication
WAN
ISP
OSPF
ISP
ISP
BGP
OSPF
OSPF
External Router
External Router
Ethernet Switch
Ethernet Hub
WWW Server
Client PC
42Network Entities
- Client PC
- Ethernet Hub
- Fan-out a single 10Mbs connection to several end
points (ex. PC, IP phone) - Ethernet Switch (Layer2 switch)
- Bridges the data across multiple 10Mbs
connections - External Router
- Connects a LAN to the Internet (ISP network, for
example, with frame relay link over fiber cable)
router protected by Firewall(s) - Clouds
- ISPs networks running OSPF (Open Shortest Path
First) and interconnected by BGP (Border Gateway
Protocol)
43Internet-work
44Internet-work
45Internet-work
H1
R1
R2
R3
H8
ETH
IP
(1400)
ETH
IP
(1400)
PPP
IP
(512)
ETH
IP
(512)
PPP
IP
(512)
ETH
IP
(512)
PPP
IP
(376)
ETH
IP
(376)
46IP Node
Routing Protocols
UDP
TCP
yes yes no
Local Address?
Routing Table
Errors?
Output Operations
Queue
Queue
incoming datagram
outgoing datagram
47Addressing
- Addresses need to be globally unique, so they are
also hierarchical - Another reason for hierarchy route aggregation
- reduces size of routing tables
- geographical distribution constraints
48Addressing in the Internet
- Addressing tied to reachability
- Every host interface has its own IP address
- Router interfaces usually have their own IP
addresses - Current version of IP is version 4 (IPv4
addresses) - 4 bytes long
- two part hierarchy
- network number and host number
- different types of boundary indicator
- class, subnet mask, prefix
- Goal of boundaries is address aggregation
49Address classes
- Historical first choice
- fixed network-host partition, with 8 bits of
network number - Generalization
- Class A addresses have 8 bits of network number
- Class B addresses have 16 bits of network number
- Class C addresses have 24 bits of network number
- Distinguished by leading bits of address
- leading 0 gt class A (first byte lt 128)
- leading 10 gt class B (first byte in the range
128-191) - leading 110 gt class C (first byte in the range
192-223) - leading 1110 gt class D (multicast)
- leading 1111 gt Class E (reserved)
50Address evolution
- Class based scheme was too inflexible
- Two problems
- Too many routes
- Too few addresses
- Four extensions
- Subnetting (flexible boundaries within network)
- CIDR (flexible grouping of networks)
- Dynamic host configuration (reuse of addresses)
- A bigger address (IPv6)
- One issue
- Network address translation
51Subnetting
- Allows administrator to cluster IP addresses
within its network (mostly applicable to class B
addresses) - Route aggregation by maintaining routes only to
subnets (mostly within your own network)
52IPv6 - Addressing
- No matter how much reuse, 32-bit IPv4 addresses
are likely to eventually run out - IPv6 extends address size to 128 bits
- Classless and supports aggregation (prefixes)
subnetting - Flow label of (faster) lookup
- Unicast, and multicast addresses
- Interoperability with IPv4 through encapsulation
- But deployment has been slow
- Need is less urgent than anticipated
- Impact to host software
- Complexity of routing in mixed IPv4/IPv6
environment
53IP Addressing
- Two special addresses on each network
- Network address identifies the network
- An example is 10.1.2.0
- Broadcast address identifies all hosts on the
network - An example is 10.1.2.255
- These cannot be used for hosts
54TCP/UDP
- Transmission Control Protocol - reliable,
session-based service for delivery of sequenced
packets across an internet - User Datagram Protocol (UDP) provides fast /
unreliable datagram service.
55End-to-End (Transport) Protocols
- Underlying best-effort network
- drops messages
- re-orders messages
- delivers duplicate copies of a given message
- limits messages to some finite size
- delivers messages after an arbitrarily long delay
- Common end-to-end services
- guarantee message delivery
- deliver messages in the same order they are sent
- deliver at most one copy of each message
- support arbitrarily large messages
- support synchronization
- allow the receiver to apply flow control to the
sender - support multiple application processes on each
host
56UDP
- Simple Demultiplexor
- Unreliable and unordered datagram service
- Adds multiplexing
- No flow control
- Endpoints identified by ports
- servers have well-known ports
- see /etc/services on Unix
- Optional checksum
- pseudo header udp header data
- Header format
57UDP Packet Format
0
16
32
Source Port Address
Destination Port Address
Header
Checksum
Length
DATA
Checksum -- Numeric calculation to ensure packet
is not corrupt. Length -- Length of the data
portion of the packet, in bytes.
58UDP
59TCP
- Reliable Byte-Stream
- Connection-oriented
- Byte-stream
- sending process writes some number of bytes
- TCP breaks into segments and sends via IP
- receiving process reads some number of bytes
- Full duplex
- Flow control keep sender from overrunning
receiver - Congestion control keep sender from overrunning
network
60TCP
- Connection-oriented protocol
- logical connection created between two
communicating processes - connection is managed at TCP protocol layer
- provides reliable and sequential delivery of data
- receiver acknowledgements sender that data has
arrived safely - sender resends data that has not been
acknowledged - packets contain sequence numbers so they may be
ordered - Bi-directional byte stream
- both sender and receiver write and read bytes
- acknowledgements identify received bytes
- buffers hold data until there is a sent
- multiple bytes are packaged into a segment when
sent
61TCP Packet Format
0
16
31
Source Port Number
Destination Port Number
Sequence Number
Acknowledgement
0
Flags
Window
Hdr Len
Checksum
Urgent Pointer
Options/Padding
Data
62End-to-End Issues
- Based on sliding window protocol used at data
link - level, but the situation is very different.
- Potentially connects many different hosts
- need explicit connection establishment and
termination - Potentially different RTT
- need adaptive timeout mechanism
- Potentially long delay in network
- need to be prepared for arrival of very old
packets - Potentially different capacity at destination
- need to accommodate different amounts of
buffering - Potentially different network capacity
- need to be prepared for network congestion
63Client Server Communication
- The transport protocols TCP and UDP were designed
to enable communication between network
applications - Internet host can have several servers running.
- usually has only one physical link to the rest
of the world - When packets arrive how does the host identify
which packets should go to which server? - Ports
- ports are used as logical connections between
network applications - 16 bit number (65536 possible ports)
- demultiplexing key
- identify the application/process to receive the
packet - TCP connection
- source IP address and source port number
- destination IP address and destination port
number - the combination IP Address Port Number pair is
called a Socket
64Client Server Communication
Port
IP
Network Host
Network
122.34.45.67
Network Host
123.45.67.89
SOCKETS
122.34.45.6780
123.45.67.8965533
65Client Server Communication
Port
HTTP Server with three active connections
(sockets).
IP Network
Active
Active
Active
Listening
IP Host/ Server
The HTTP server listens for future connections.
66Common Ports
- Port numbers divided into three categories
- Well Known Ports 0-1023
- Registered Ports 1024-49151
- Dynamic/Private Ports 49152-65535
- Well Known Ports
- 1 TCP Port Service Multiplexor
- 20 File Transfer Protocol (FTP) Data
- 21 FTP Control
- 23 Telnet
- 25 Simple Mail Transfer (SMT)
- 43 Who Is
- 69 Trivial File Transfer Protocol (TFTP)
- 80 HTTP
67TCP/IP protocol suite
- File Transfer
- Remote Login
- Electronic Mail
- Network File Systems
- Remote Printing
- Remote Execution
- Name Terminal Servers
- Network-Oriented Windows Systems