html5-img
1 / 54

CSEE W4140 Networking Laboratory

CSEE W4140 Networking Laboratory. Lecture 9: NAT and DHCP Jong Yul Kim 04.01.2009. Announcements. Final Project Topics Project topics will be on class website by today You’re welcome to come up with your own topics Final project will not be like the labs you’ve been doing.

tekla
Download Presentation

CSEE W4140 Networking Laboratory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSEE W4140Networking Laboratory Lecture 9: NAT and DHCP Jong Yul Kim 04.01.2009

  2. Announcements • Final Project Topics • Project topics will be on class website by today • You’re welcome to come up with your own topics • Final project will not be like the labs you’ve been doing. • No step-by-step guide • Need to write 3 reports • 5 weeks to deliver a demo and a good report • More interactions with staff • Same 20% of total grade as final exam

  3. Announcements • Final Project Schedule • April 3 (2 days from today) • select project and team (two students per team) • April 8 (a week from now) • submit a one page project proposal report stating the problem, equipment requirements, and deliverables • April 22 (3 weeks from now ) • submit an interim report stating your approach to the problem and planned experiment architecture • May 8 (5 weeks from now) • demo and submit the final report

  4. Today’s lecture • Network Address Translator (NAT) • Dynamic Host Configuration Protocol (DHCP)

  5. Private Networks • Private IP addresses used are: • 10.0.0.0 – 10.255.255.255 • 172.16.0.0 – 172.31.255.255 • 192.168.0.0 – 192.168.255.255 • Not globally unique • or routable

  6. Network Address Translator • The first RFC on NAT is RFC 1631. • A short-term solution to fix the IP address depletion problem. • The main idea is to reuse IP addresses • “… very small percentage of hosts in a stub domain are communicating outside of the domain at any given time.” • “… only a subset of the IP addresses inside a stub domain, need to be translated into IP addresses that are globally unique when outside communications is required.”

  7. Network Address Translator • Advantages • Can be installed incrementally without changes to either hosts or routers. • Disadvantages • Takes away end-to-end connectivity of IP addresses • “(A few unusual applications may require changes.)” • RFC 1631 was published in May 1994

  8. Source • Source • Source • Source = 10.0.1.2 = 128.143.71.21 = 10.0.1.2 = 128.143.71.21 = 64.236.24.4 = 64.236.24.4 = 64.236.24.4 = 64.236.24.4 • Destination • Destination • Destination • Destination = 64.236.24.4 • Source = 64.236.24.4 • Source = 64.236.24.4 = 64.236.24.4 = 64.236.24.4 = 64.236.24.4 • Source • Source • Source • Source • Destination = 10.0.0.2 • Destination = 128.59.16.21 • Destination • Destination • Destination • Destination = 128.59.16.21 = 128.59.16.21 = 128.59.16.21 = 10.0.0.2 Private Public Address Address 10.0.1.1 128.59.16.21 Basic Operation of NAT Private Network Internet • private address: 10.0.1.2 NATDevice • public address: 128.143.71.21 • Host Public Host 64.236.24.4

  9. Pooling of IP addresses • Scenario: Corporate network has many hosts but only a small number of public IP addresses • NAT solution: • Corporate network is managed with a private address space • NAT device, located at the boundary between the corporate network and the public Internet, manages a pool of public IP addresses • When a host from the corporate network sends an IP datagram to a host in the public Internet, the NAT device picks a public IP address from the address pool, and binds this address to the private address of the host

  10. Pooling of IP addresses

  11. Static mapping Dynamic mapping

  12. Supporting migration between network service providers • Scenario: In practice (using CIDR), the IP addresses in a corporate network are obtained from the service provider. Changing the service provider requires changing all IP addresses in the network. • NAT solution: • Assign private addresses to the hosts of the corporate network • NAT device has address translation entries which bind the private address of a host to the public address. • Migration to a new network service provider merely requires an update of the NAT device. The migration is not noticeable to the hosts on the network.

  13. Supporting migration between network service providers

  14. Supporting migration between network service providers

  15. IP masquerading • Also called: Network address and port translation (NAPT), port address translation (PAT). • Scenario: Single public IP address is mapped to multiple hosts in a private network. • NAT solution: • Assign private addresses to the hosts of the corporate network • NAT device modifies the port numbers for outgoing traffic

  16. IP masquerading

  17. IP Masquerading (NAPT/PAT)

  18. Problems of NAT • NAT and FTP • NAT and UDP applications

  19. NAT and FTP • Normal FTP operation Data channel initiated by server

  20. NAT and FTP • FTP failing because of NAT Data channel initiated by server

  21. NAT Behavioral Requirements for Unicast UDP (RFC 4787) • NATs do not handle UDP well • Categorizes NATs based on mapping and filtering behavior • NAT device stores the address and port translation tables (Mapping) • NAT devices selectively discard incoming traffic (Filtering)

  22. Endpoint-independent Mapping

  23. Endpoint-independent Filtering

  24. Address-dependent Mapping

  25. Address-dependent Filtering

  26. Address and port dependent Mapping

  27. Address and port dependent Filtering

  28. Concerns about NAT • Performance • Modifying the IP header by changing the IP address requires that NAT boxes recalculate the IP header checksum. • Modifying port number requires that NAT boxes recalculate TCP checksum. • Fragmentation • Care must be taken that a datagram that is fragmented before it reaches the NAT device, is not assigned a different IP address or different port numbers for each of the fragments.

  29. Concerns about NAT • End-to-end connectivity • NAT destroys universal end-to-end reachability of hosts on the Internet. • A host in the public Internet often cannot initiate communication to a host in a private network. • The problem is worse, when two hosts that are in a private network need to communicate with each other. • NAT and applications • NAT break applications such as file transfer, VoIP

  30. DHCP

  31. 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

  32. BOOTP • BOOTstrap Protocol (BOOTP) • From 1985 • Host can configure its IP parameters at boot time. • 3 services. • IP address assignment. • Detection of the IP address for a serving machine. • The name of a file to be loaded and executed by the client machine (boot file name) • Not only assign IP address, but also default router, network mask, etc. • Sent as UDP messages (UDP Port 67 (server) and 68 (host)) • Use limited broadcast address (255.255.255.255): • These addresses are never forwarded

  33. DHCP • Dynamic Host Configuration Protocol (DHCP) • From 1993 • An extension of BOOTP, very similar to DHCP • Same port numbers as BOOTP • Extensions: • Supports temporary allocation (“leases”) of IP addresses • DHCP client can acquire all IP configuration parameters needed to operate • DHCP is the preferred mechanism for dynamic assignment of IP addresses • DHCP can interoperate with BOOTP clients.

  34. BOOTP Interaction (b) (a) • BOOTP can be used for downloading memory image for diskless workstations • Assignment of IP addresses to hosts is static (c)

  35. DHCP Interaction (simplified)

  36. DHCP Pros • It relieves the network administrator of a great deal of manual configuration work. • The ability for a device to be moved from network to network and to automatically obtain valid configuration parameters for the current network can be of great benefit to mobile users. • Because IP addresses are only allocated when clients are actually active, it is possible, by the use of reasonably short lease times and the fact that mobile clients do not need to be allocated more than one address, to reduce the total number of addresses in use in an organization.

  37. DHCP Cons • Uses UDP, an unreliable and insecure protocol. • DNS cannot be used for DHCP configured hosts.

  38. BOOTP/DHCP Message Format (There are >100 different options)

  39. Message Fields • code: Indicates a request or a reply • 1 Request • 2 Reply • HWtype: The type of hardware, for example: • 1 Ethernet • 6 IEEE 802 networks • length: Hardware address length in bytes. E.g., Ethernet and token-ring both use 6 bytes. • hops: The client sets this to 0. It is incremented by a router that relays the request to another server and is used to identify loops. RFC 951 suggests that a value of 3 indicates a loop.

  40. Contd. • Transaction ID: A random number used to match this boot request with the response it generates. • Seconds: Set by the client. It is the elapsed time in seconds since the client started its boot process. • Flags field: The most significant bit of the flags field is used as a broadcast flag. All other bits must be set to zero, and are reserved for future use. Normally, DHCP servers attempt to deliver DHCP messages directly to a client using unicast delivery. The destination address in the IP header is set to the DHCP your IP address and the MAC address is set to the DHCP client hardware address. If a host is unable to receive a unicast IP datagram until it knows its IP address, then this broadcast bit must be set (=1) to indicate to the server that the DHCP reply must be sent as an IP and MAC broadcast. Otherwise this bit must be set to zero.

  41. Contd. • Client IP address: Set by the client. Either its known IP address, or 0.0.0.0. • Your IP address: Set by the server if the client IP address field was0.0.0.0. • Server IP address: Set by the server. • Router IP address: This is the address of a BOOTP relay agent, not a general IP router to be used by the client. It is set by the forwarding agent when BOOTP forwarding is being used • Client hardware address: Set by the client. DHCP defines a client identifier option that is used for client identification. If this option is not used the client is identified by its MAC address.

  42. Contd. • Server host name: Optional server host name terminated by X'00'. • Boot file name: The client either leaves this null or specifies a generic name, such as router, indicating the type of boot file to be used. In a DHCPDISCOVER request this is set to null. The server returns a fully qualified directory path name in a DHCPOFFER request. The value is terminated by X'00'. • Options: Subnet Mask, Name Server, Hostname, Domain Name, Forward On/Off, Default IP TTL, Broadcast Address, Static Route, Ethernet Encapsulation, X Window Manager, X Window Font, DHCP Msg Type, DHCP Renewal Time, DHCP Rebinding, Time SMTP-Server, SMTP-Server, Client FQDN, Printer Name, …

  43. DHCP Message Type • Message type is sent as an option.

  44. Message Types • DHCPDISCOVER: Broadcast by a client to find available DHCP servers. • DHCPOFFER: Response from a server to a DHCPDISCOVER and offering IP address and other parameters. • DHCPREQUEST: Message from a client to servers that does one of the following: • Requests the parameters offered by one of the servers and declines all other offers. • Verifies a previously allocated address after a system or network change (a reboot for example). • Requests the extension of a lease on a particular address.

  45. Contd. • DHCPACK: Acknowledgement from server to client with parameters, • including IP address. • DHCPNACK: Negative acknowledgement from server to client, indicating that the client's lease has expired or that a requested IP address is incorrect. • DHCPDECLINE: Message from client to server indicating that the offered address is already in use. • DHCPRELEASE: Message from client to server canceling remainder of a lease and relinquishing network address. • DHCPINFORM: Message from a client that already has an IP address (manually configured for example), requesting further configuration parameters from the DHCP server.

  46. Client Server Interactions • The client broadcasts a DHCPDISCOVER message on its local physical subnet. • The DHCPDISCOVER message may include some options such as network address suggestion or lease duration. • Each server may respond with a DHCPOFFER message that includes an available network address (your IP address) and other configuration options. • The servers record the address as offered to the client to prevent the same address being offered to other clients in the event of further DHCPDISCOVER messages being received before the first client has completed its configuration.

  47. Contd. • The client receives one or more DHCPOFFER messages from one or more servers. • The client chooses one based on the configuration parameters offered and broadcasts a DHCPREQUEST message that includes the server identifier option to indicate which message it has selected and the requested IP address option, taken from your IP address in the selected offer. • In the event that no offers are received, if the client has knowledge of a previous network address, the client may reuse that address if its lease is still valid, until the lease expires.

  48. Contd. • The serversreceive the DHCPREQUEST broadcast from the client. • Those servers not selected by the DHCPREQUEST message use the message as notification that the client has declined that server's offer. • The server selected in the DHCPREQUEST message commits the binding for the client to persistent storage and responds with a DHCPACK message containing the configuration parameters for the requesting client.

  49. Contd. • The combination of client hardware and assigned network address constitute a unique identifier for the client's lease and are used by both the client and server to identify a lease referred to in any DHCP messages. • The your IP address field in the DHCPACK messages is filled in with the selected network address.

  50. Contd. • The client receives the DHCPACK message with configuration parameters. • The client performs a final check on the parameters, for example with ARP for allocated network address, and notes the duration of the lease and the lease identification cookie specified in the DHCPACK message. At this point, the client is configured. • If the client detects a problem with the parameters in the DHCPACK message (the address is already in use on the network, for example), the client sends a DHCPDECLINE message to the server and restarts the configuration process.

More Related