Network Transport & UDP Flashcards
Hourglass model of the Internet
- Few network protocols
– They are the ‘glue’ that allow inter-operation
Transport services and protocols
- Provide logical communication between app processes running on different hosts
- Transport protocols run in end system
- Send side: breaks app messages into segments, passes to network layer
- Receiver side: reassembles segments into messages, passes to app layer
- More than one transport protocol available to apps
- Internet: TCP and UDP
Transport Layer service (Service Types)
- Connection-oriented service
- 3 Phases: connection set-up, data transfer, disconnect - Connectionless service
- Transfer of isolated units
Transport Layer service (Aim)
– To Improve the Network Service quality that applications get from the network layer, e.g.:
* Reliable service
* Ensuring integrity of data passed to applications
– Can not guarantee delay or bandwidth guarantees (if the network layer does not provide those guarantees)
- Essentially a socket-to-socket communication service
Internet Transport Layer
- Lowest level end-to-end protocol
- Transport header generated by sender is interpreted only by destination
- Routers / gateways view transport header as part of the payload – they only see the Network (IP) header
- Can add extra functionality to the best effort packet delivery service provided by IP
– Can make up for some of the shortcomings of core network
Transport vs Network layer
- Network layer: logical communication between hosts
- Transport layer: logical communication between processes
– Relies on, enhances, network layer services
Transport vs Network Layer (household analogy)
12 kids in Ann’s house sending letters to 12 kids in Bill’s house:
* Hosts = houses
* Processes = kids
* App messages = letters in envelopes
* Transport protocol = Ann and Bill who demux to in-house siblings
* Network-layer protocol = postal service
Reminder: Layer relationship
Internet transport-layer protocols
- Reliable, in-order delivery: TCP (and QUIC)
– Congestion control
– Flow control
– Connection setup - Unreliable, unordered delivery: UDP
– No-frills extension of “besteffort” IP - Services not available:
– Delay guarantees
– Bandwidth guarantees
Some Transport Layer functions
- Multiplexing/de-multiplexing data for multiple
applications
– Uses “port’’ abstraction - Connection establishment
– Logical end-to-end connection - Error control
– Hides unreliability of network layer from applications
* Corruption, loss, duplication, reordering - End-to-end flow control
– To avoid flooding the receiver - Congestion control
– To avoid flooding the network
Multiplexing/ Demultiplexing
How demultiplexing wokrs
- Host receives IP datagrams
- Each datagram has source IP address, destination IP address
- Each datagram carries one transport-layer segment
- Each segment has source, destination port number
- Host uses IP addresses & port numbers to direct segment to appropriate socket
Connectionless demultiplexing
Connectionless demux: example
Connection-oriented demux
- TCP socket identified by 4- tuple:
- Source IP address
- Source port number
- Dest IP address
- Dest port number
- demux: receiver uses all four values to direct segment to appropriate socket
- Server host may support many simultaneous TCP sockets:
- Each socket identified by its own 4-tuple
- Web servers have different sockets for each connecting client
- Non-persistent HTTP will have different socket for each request
Connection-oriented demux:
example
UDP: User Datagram Protocol
- “Best effort” service, UDP segments may be:
– Lost
– Delivered out-of-order to app - Connectionless:
– No handshaking between UDP sender, receiver
– Each UDP segment handled independently of others - UDP is “mostly IP with a short transport header”
– Source and destination port
– Ports allow for dispatching of messages to receiver process - UDP use:
– Streaming multimedia apps
(loss tolerant, rate sensitive)
– DNS
– SNMP - Reliable transfer over UDP:
– Add reliability at application layer
– Application-specific error recovery!
UDP: segment header
why is there a UDP
- No connection establishment (which can add delay)
- Simple: no connection state at sender, receiver
- Small header size (only 8 bytes)
- No congestion control: UDP can blast away as fast as desired
UDP length limits
- Length in bytes (UDP header and data)
– Minimum is 8 bytes (length of UDP header)
– Maximum is
* Length field is 16 bits, so 216 - 1 = 65,535 is the max. value
* 65,535 – (UDP header) – (Minimum IP* header)
* 65,535 – 8 – 20 = 65,507 bytes
UDP Checksum (Goal)
Detect “ errors ” (e.g., flipped bits) in transmitted segment
UDP Checksum (Sender)
– Treat segment contents, including header fields, as sequence of 16-bit integers
– Checksum: addition (one’s complement sum) of segment contents
– Sender puts checksum value into UDP checksum field
UDP Checksum (Receiver)
– Compute checksum of received segment
– Check if computed checksum equals checksum field value:
* NO - error detected
* YES - no error detected. But maybe errors nonetheless?
More later …
UDP checksum (cont.)
- Basically a 16 bit sum of words in packet
– Note: we’ll see the same algorithm in detail when we look at IP - Covers network-layer (IP) and UDP headers +
payload
– But UDP layer doesn’t know internals of network layer…
UDP IPv4 pseudo header
- UDP checksum based on pseudo header not
real one
– Protocol must = 17 (UDP)
– Source and dest. addresses must match real IP header
– UDP length must match value in UDP header
UDP IPv4 pseudo header (cont.)
- Pseudo header never actually sent over the network
- Can be recreated on the receiving side easily to verify integrity
- Used because the source and destination
addresses are intrinsic to the meaning of a
packet- Though they are not part explicitly part of the UDP header
- Not included in the send packet to avoid duplication
Checksum Calculation - Example 1
Checksum is 16 bits long so we need to truncate the result.
Add the overflow bit to the rest 16 bits!
Checksum Calculation - Example 2
What layer is ICMP?
- RFC 792: “ICMP uses the basic support of IP as if it were a higherlevel protocol, however, ICMP is actually an integral part of IP, and must be implemented by every IP module.”
How does a sender know what port number to use ?
- The port numbers ranging from 0 to 1023 are called wellknown port numbers and are restricted
- These well-known ports are reserved for use by the well-known application protocols such as HTTP (port 80) and FTP (port 21)
- The list of well-known port numbers is given in RFC 1700
- Developers designing applications (“server” side of P2P or client/server applications) must determine which ports to use for each protocol they design