Presentation is loading. Please wait.

Presentation is loading. Please wait.

DHCP and NAT.

Similar presentations


Presentation on theme: "DHCP and NAT."— Presentation transcript:

1 DHCP and NAT

2 IP address: how to get one?
Q: How does a router get IP address? hard coded by system admin every interface/port is assigned a unique IP address reflecting network assignment Q: How does a host get IP address? hard-coded by system admin in a file Windows: control-panel->network->configuration- >tcp/ip->properties UNIX: /etc/rc.config DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server “plug-and-play” Network Layer: Data Plane

3 DHCP: Dynamic Host Configuration Protocol
goal: allow host to dynamically obtain its IP address from network server when it joins network can renew its lease on address in use allows reuse of addresses (only hold address while connected/“on”) support for mobile users who want to join network DHCP overview: host broadcasts “DHCP discover” msg [optional] DHCP server responds with “DHCP offer” msg [optional] host requests IP address: “DHCP request” msg DHCP server sends address: “DHCP ack” msg Network Layer: Data Plane

4 DHCP client-server scenario
Server sees request and responds with an IP address DHCP server /24 arriving DHCP client needs address in this network /24 /24 Network Layer: Data Plane

5 DHCP: more than IP addresses
DHCP returns more than just allocated IP address on subnet: address of first-hop router for client name and IP address of DNS sever network mask (indicating network versus host portion of address) DCHP may not be on same subnet, in that case, the local router will forward the request to the DHCP server on behalf of the client, i.e., acting as agent. Uses IP Address Helper - see: There maybe more that one DHCP server on the network, all will respond, client picks one, usually first response that comes in Network Layer: Data Plane

6 DHCP client-server scenario
DHCP server: DHCP discover src : , 68 dest.: ,67 yiaddr: transaction ID: 654 arriving client Broadcast: is there a DHCP server out there? Client sends broadcast message over UDP to port 67 (reserved for DHCP) on the server, from port 68, asking for IP address DHCP offer src: , 67 dest: , 68 yiaddrr: transaction ID: 654 lifetime: 3600 secs DHCP server responds offering an IP address that the client can use from pool of addresses it has available. Broadcast: I’m a DHCP server! Here’s an IP address you can use DHCP request src: , 68 dest:: , 67 yiaddrr: transaction ID: 655 lifetime: 3600 secs Note: there could be several DHCP servers that might respond to client. Client chooses one to bind with and responds to that server accepting its IP address Broadcast: OK. I’ll take that IP address! Server sends final ACK binding that IP address and blocking for x secs DHCP ACK src: , 67 dest: , 68 yiaddrr: transaction ID: 655 lifetime: 3600 secs Broadcast: OK. You’ve got that IP address! Network Layer: Data Plane

7 DHCP client-server summary
DHCP server: arriving client DHCP discover DHCP offer DHCP request src: , 68 dest:: , 67 DHCPRequest yiaddrr: transaction ID: 655 DHCP serverID: lifetime: 3600 secs DHCP ACK src: , 67 dest: , 68 DHCPAck src: , 68 dest: , 67 DHCPDiscover yiaddr: transaction ID: 654 src: , 67 dest: , 68 DHCPOffer yiaddr: transaction ID: 654 DHCP serverID: lifetime: 3600 secs Network Layer: Data Plane

8 DHCP: more than IP addresses
DHCP can return more than just allocated IP address on subnet: its address of its (DHCP server) address of first-hop router for client name and IP address of DNS sever network mask (indicating network versus host portion of address) Network Layer: Data Plane

9 DHCP: example DHCP UDP IP Eth Phy DHCP DHCP connecting laptop needs its IP address, addr of first-hop router, addr of DNS server: use DHCP DHCP DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in Ethernet DHCP DHCP UDP IP Eth Phy DHCP Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server router with DHCP server built into router Ethernet demuxed to IP demuxed, UDP demuxed to DHCP Network Layer: Data Plane

10 DHCP: example DHCP DCP server formulates DHCP OFFER containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server DHCP UDP IP Eth Phy encapsulation of DHCP OFFER, frame forwarded to client, demuxing up to DHCP at client DHCP UDP IP Eth Phy DHCP DHCP router with DHCP server built into router client now knows its IP address, name and IP address of DSN server, IP address of its first-hop router DHCP A great “plug and play” service Q: Do you see a drawback? Network Layer: Data Plane

11 NAT: network address translation
rest of Internet local network (e.g., home network) /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) Network Layer: Data Plane

12 NAT: network address translation
motivation: local network uses just one IP address as far as outside world is concerned: range of addresses not needed from ISP: just one IP address for all devices can change addresses of devices in local network without notifying outside world can change ISP without changing addresses of devices in local network devices inside local net not explicitly addressable, visible by outside world (a security plus) Network Layer: Data Plane

13 NAT: network address translation
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 Network Layer: Data Plane

14 NAT: network address translation
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 * Check out the online interactive exercises for more examples: Network Layer: Data Plane

15 NAT: network address translation
16-bit port-number field: 60,000 simultaneous connections with a single LAN-side address! NAT is controversial: routers should only process up to layer 3 address shortage should be solved by IPv6 violates end-to-end argument NAT possibility must be taken into account by app designers, e.g., P2P applications NAT traversal: what if client wants to connect to server behind NAT? Network Layer: Data Plane


Download ppt "DHCP and NAT."

Similar presentations


Ads by Google