Download presentation
Presentation is loading. Please wait.
1
CS4470 Computer Networking Protocols
4/4/2019 CS Computer Networking Protocols 13. Transport layer Huiping Guo Department of Computer Science California State University, Los Angeles
2
Outline Overview of transport layer Network Address Translation (NAT)
4/4/2019 Outline Overview of transport layer Network Address Translation (NAT) User Datagram Protocol (UDP) Dynamic Host Configuration Protocol (DHCP) 13. Transport layer CS4470
3
Transport layer overview
4/4/2019 Transport layer overview Application layer Application layer Data Data Data Transport layer Transport layer H Data H segment H Data T Network layer Network layer H Data T datagram 13. Transport layer CS4470
4
Transport vs. network layer
Provides computer-to-computer communication Source and destination addresses are computers Called host-to-host Transport layer Provides application-to-application communication Need extended addressing scheme to identify applications Called end-to-end 13. Transport layer CS4470
5
Transport Protocol Functionality
Identify sending and receiving applications Optionally provide Reliability Flow control Congestion control Note: not all transport protocols provide above facilities 13. Transport layer CS4470
6
Internet transport-layer protocols
UDP Unreliable, unordered delivery: Lightweight transport Becoming more popular (IP telephony) Best-effort delivery TCP Reliable, in-order delivery connection setup congestion control flow control 13. Transport layer CS4470
7
Identifying an application
Cannot extend IP address No unused bits Cannot use OS-dependent quantity Process ID Task number Job name Must work on all computer systems 13. Transport layer CS4470
8
Identifying an application (cont.)
Invent new abstraction Called protocol port number Used to identify sending or receiving application unambiguously Independent of underlying operating system Used only with TCP/IP protocols 13. Transport layer CS4470
9
Protocol Port Example Domain name server application is assigned port 53 Application using DNS obtains port 28900 UDP datagram sent from application to DNS server has Source port number 28900 Destination port number 53 When DNS server replies, UDP datagram has Source port number 53 Destination port number 28900 13. Transport layer CS4470
10
Network Address Translation (NAT)
Extension of original addressing scheme Motivated by exhaustion of IP address space Allows multiple computers to share single address Requires device to perform packet translation Implementations available Stand-alone hardware device IP router with NAT functionality embedded 13. Transport layer CS4470
11
NAT (cont.) A subnet NAT Three blocks of IP addresses are reserved
Obtains single, valid IP address Assigns a private address to each computer Uses NAT box to connect to Internet NAT Translates addresses in IP datagrams Three blocks of IP addresses are reserved 13. Transport layer CS4470
12
Illustration Of NAT Single valid IP address needed
Computers at site assigned private, non-routable addresses 13. Transport layer CS4470
13
NAT Example Site uses private network 10.0.0.0 / 8 internally
First computer assigned Second computer assigned And so on . . . Site obtains valid IP address (e.g., ). Assume computer sends to NAT translates IP source address of outgoing datagram NAT translates destination address of incoming datagram 13. Transport layer CS4470
14
Illustration Of NAT Translation
Transparent to each end Computer at site sends and receives datagrams normally Computer in Internet receives datagrams from NAT box 13. Transport layer CS4470
15
NAT Details Implementation: NAT router must:
outgoing datagrams: replace (source IP address, port #) of every outgoing datagram to (NAT IP address, new port #) . . . remote clients/servers will respond using (NAT IP address, new port #) as destination addr. remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair incoming datagrams: replace (NAT IP address, new port #) in dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table 13. Transport layer CS4470
16
NAT example All datagrams leaving local Datagrams with source or
rest of Internet local network (e.g., home network) 10.0.0/24 All datagrams leaving local network have same single source NAT IP address: , different source port numbers Datagrams with source or destination in this network have /24 address for source, destination (as usual) 13. Transport layer CS4470
17
WAN side addr LAN side addr
NAT example NAT translation table WAN side addr LAN side addr 1: host sends datagram to , 80 2: NAT router changes datagram source addr from , 3345 to , 5001, updates table , , 3345 …… …… S: , 3345 D: , 80 1 S: , 80 D: , 3345 4 S: , 5001 D: , 80 2 S: , 80 D: , 5001 3 4: NAT router changes datagram dest addr from , 5001 to , 3345 3: Reply arrives dest. address: , 5001 13. Transport layer CS4470
18
Dynamic Assignment of IP addresses
Dynamic assignment of IP addresses is desirable for several reasons: IP addresses are assigned on-demand Avoid manual IP configuration Support mobility of laptops Three Protocols RARP (until 1985, no longer used) BOOTP ( ) DHCP (since 1993) Only DHCP is widely used today. 13. Transport layer CS4470
19
DHCP Client-server: host requests an IP address from a DHCP server
Since this is an application, DHCP server does not have to be on the same network as the host. Must designate a relay agent who know the address of DHCP server There can be a few DHCP servers per site, rather than one on each network 13. Transport layer CS4470
20
4/4/2019 Relay agent 13. Transport layer CS4470
21
DHCP protocol: 4 steps DHCP server discovery.
Use DHCP discover message DHCP client creates an IP datagram Source IP address: Destination IP address: The IP datagram is passed down to the adapter which encapsulates the datagram in a frame Source MAC address: send’s MAC address Destination MAC address: FF-FF-FF-FF-FF-FF 13. Transport layer CS4470
22
DHCP protocol: 4 steps DHCP server offer.
A DHCP server receiving a DHCP discover message responds to the client with a DHCP offer message Each server offer message contains Transaction ID of the received discover message The proposed IP address for the client The network mask IP address lease time – the amount of time for which the IP address will be valid 13. Transport layer CS4470
23
DHCP protocol: 4 steps DHCP Request
The newly arriving client will choose from among one or more server offers The client responds to its selected offer with a DHCP request message, echoing back the configuration parameters 13. Transport layer CS4470
24
DHCP protocol: 4 steps DHCP ACK
The server responds to the DHCP request message with a DHCP ACK message, confirming the requested parameters Once the client receives the DHCP ACK, the interaction is complete and the client can use the DHCP-allocated IP address for the lease duration 13. Transport layer CS4470
25
4/4/2019 13. Transport layer CS4470
26
UDP: User Datagram Protocol [RFC 768]
Connectionless service Best-effort semantics Each message encapsulated in IP datagram Uses protocol ports to identify applications 13. Transport layer CS4470
27
Why is there a UDP? no connection establishment (which can add delay)
4/4/2019 Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control UDP can blast away as fast as desired 13. Transport layer CS4470
28
UDP Semantics Same best-effort semantics as IP (i.e., unreliable transfer) Message can be Lost Duplicated Delayed Delivered out of order 13. Transport layer CS4470
29
UDP: more other UDP uses often used for streaming multimedia apps
loss tolerant rate sensitive other UDP uses DNS SNMP reliable transfer over UDP: add reliability at application layer application-specific error recovery! 13. Transport layer CS4470
30
UDP segment format Application data (message) source port #
dest port # 32 bits Application data (message) length checksum Length, in bytes of UDP segment, including header 13. Transport layer CS4470
31
Destinantion IP address
UDP pseudo header Source IP address UDP Pseudo header 32 bits Application data (message) Destinantion IP address UDP length Protocol=17 UDP header It’s not transmitted to the IP layer It’s only used for computing the checksum 13. Transport layer CS4470
32
UDP checksum The checksum includes three sections: Goal
A pseudo header The UDP header The application data Goal detect “errors” (e.g., flipped bits) in transmitted segment 13. Transport layer CS4470
33
UDP Encapsulation Two levels of encapsulation
UDP datagram size cannot exceed maximum IP payload 13. Transport layer CS4470
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.