bumps in the wire: nat and dhcp

25
Bumps in the Wire: NAT and DHCP Nick Feamster CS 4251 Computer Networking II Spring 2008

Upload: duncan

Post on 15-Jan-2016

38 views

Category:

Documents


0 download

DESCRIPTION

Bumps in the Wire: NAT and DHCP. Nick Feamster CS 4251 Computer Networking II Spring 2008. NATs and Tunnels. NATs originally invented as a way to help migrate to a hybrid IPv4 IPv6 world Took on a life of their own May have substantially delayed IPv6 deployment by reducing address pressure! - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Bumps in the Wire:  NAT and DHCP

Bumps in the Wire: NAT and DHCP

Nick FeamsterCS 4251 Computer Networking II

Spring 2008

Page 2: Bumps in the Wire:  NAT and DHCP

NATs and Tunnels

• NATs originally invented as a way to help migrate to a hybrid IPv4 IPv6 world– Took on a life of their own– May have substantially delayed IPv6 deployment by

reducing address pressure!– You probably encounter them every day

• Tunnels: Coming up after NATs.

Page 3: Bumps in the Wire:  NAT and DHCP

B IPB IP

Network Address Translation

• NAT maps (private source IP, source port) onto (public source IP, unique source port)– reverse mapping on the way back– destination host does not know that this process is happening

• Very simple working solution.– NAT functionality fits well with firewalls

Publ A IPPubl A IP

B IPB IP

A Port’A Port’ B PortB Port

Priv A IPPriv A IP

B IPB IP

A PortA Port B PortB Port

Publ A IPPubl A IP

B PortB Port

B IPB IP

Priv A IPPriv A IP

B PortB Port A PortA Port

A Port’A Port’

A

B

Page 4: Bumps in the Wire:  NAT and DHCP

Types of NATs• Bi-directional NAT: 1 to 1 mapping between internal and external addresses.

– E.g., 128.237.0.0/16 -> 10.12.0.0/16– External hosts can directly contact internal hosts– Why use?

• Flexibility. Change providers, don’t change internal addrs.• Need as many external addresses as you have hosts - can use sparse address space internally.

• “Traditional” NAT: Unidirectional– Basic NAT: Pool of external addresses

• Translate source IP address (+checksum,etc) only– Network Address Port Translation (NAPT): What most of us use

• Also translate ports.– E.g., map (10.0.0.5 port 5555 -> 18.31.0.114 port 22) to (128.237.233.137 port 5931 -> 18.31.0.114 port 22)

• Lets you share a single IP address among multiple computers

Page 5: Bumps in the Wire:  NAT and DHCP

NAT Considerations

• NAT has to be consistent during a session.– Set up mapping at the beginning of a session and maintain it during

the session• Recall 2nd level goal 1 of Internet: Continue despite loss of

networks or gateways• What happens if your NAT reboots?

– Recycle the mapping that the end of the session• May be hard to detect

• NAT only works for certain applications.– Some applications (e.g. ftp) pass IP information in payload– Need application level gateways to do a matching translation– Breaks a lot of applications.

• Example: Let’s look at FTP• NAT is loved and hated

- Breaks many apps (FTP)- Inhibits deployment of new applications like p2p (but so do firewalls!)+ Little NAT boxes make home networking simple.+ Saves addresses. Makes allocation simple.

Page 6: Bumps in the Wire:  NAT and DHCP

Interconnection: “Gateways”

• Interconnect heterogeneous networks• No state about ongoing connections

– Stateless packet switches

• Generally, router == gateway• But, we can think of your home router/NAT as also

performing the function of a gateway

Home Network Internet

192.168.1.51

192.168.1.52

68.211.6.120:50878

68.211.6.120:50879

Page 7: Bumps in the Wire:  NAT and DHCP

Network Address Translation

• For outbound traffic, the gateway: – Creates a table entry for computer's local IP address

and port number– Replaces the sending computer's non-routable IP

address with the gateway IP address.– replaces the sending computer's source port

• For inbound traffic, the gateway:– checks the destination port on the packet – rewrites the destination address and destination port

those in the table and forwards traffic to local machine

Page 8: Bumps in the Wire:  NAT and DHCP

NAT Traversal• Problem: Machines behind NAT not globally

addressable or routable. Can’t initiate inbound conenctions.

• One solution: Signalling and Tunneling through UDP-Enabled NAT Devices (STUN)– STUN client contacts STUN server– STUN server tells client which IP/Port the NAT mapped it to– STUN client uses that IP/Port for call establishment/incoming

messages

Home Network 1

Home Network 2Relay node

Page 9: Bumps in the Wire:  NAT and DHCP

DHCP

• DHCPOFFER– IP addressing information– Boot file/server information (for network booting)– DNS name servers– Lots of other stuff - protocol is extensible; half of the options reserved for local

site definition and use.

DHCPDISCOVER - broadcast

DHCPOFFER

DHCPREQUEST

DHCPACK

Page 10: Bumps in the Wire:  NAT and DHCP

DHCP Features

• Lease-based assignment– Clients can renew. Servers really should preserve this

information across client & server reboots.

• Provide host configuration information– Not just IP address stuff.– NTP servers, IP config, link layer config,– X window font server (wow)

• Use:– Generic config for desktops/dialin/etc.

• Assign IP address/etc., from pool– Specific config for particular machines

• Central configuration management

Page 11: Bumps in the Wire:  NAT and DHCP

Dynamic Host Configuration Protocol

• Commonly used to automatically– assign IP addresses to clients– set various configuration parameters

• Useful for managing IP address space where– the total number of users outstrips the total number of

concurrent users

• Operators can – dynamically assign IP addresses to clients and– reclaim IP addresses when clients leave

Page 12: Bumps in the Wire:  NAT and DHCP

DHCP: Operation and Lease Times

• Lease Time: the time interval after which a server can reclaim an IP address– Configurable at server (universal or per-client)

DISCOVER

OFFER

REQUEST

ACK

REQUEST

Renew at ½the lease time

Page 13: Bumps in the Wire:  NAT and DHCP

Lease-Time Optimization

• Tradeoff: Utilization vs. Scalability, Convenience– Too long: Address space can be exhausted– Too short: Clients must reauthenticate, increase in

broadcast traffic

• Problem: Determine the appropriate lease time setting (and strategy) that– Minimizes inconvenience and unnecessary traffic– Avoids address-space exhaustion

Page 14: Bumps in the Wire:  NAT and DHCP

Outline

• Measurement study of DHCP utilization on the Georgia Tech wireless network (LAWN)– Largest known public DHCP study: 6,000 users/day– Study of on-times and off-times

• Emulation tool for evaluating the effects of longer lease times on utilization

• Evaluation of alternative lease time strategies– Single adaptation– Exponential

Page 15: Bumps in the Wire:  NAT and DHCP

Environment and Data

• Environment: Georgia Tech Local-Area Walkup/Wireless Network (“LAWN”)– 6,000 unique users per day– 2,500 concurrent users at peak– 4,000 IP addresses– 1,000 access points– 2,800 network ports– Single VLAN

• Data: DHCP Server logs from Feb 12-17, 2007– Used MAC addresses to identify individual clients– Current lease-time setting: 30 minutes

Page 16: Bumps in the Wire:  NAT and DHCP

Estimating Duration of Client Activity

• Clients issue DHCP “Renew” messages– One message every half-lease-time interval

• Idea: Use DHCP messages to estimate client presence/departure– Estimate client departure at time of last-seen renew

plus one-fourth the lease time

Page 17: Bumps in the Wire:  NAT and DHCP

DHCP Utilization on GT LAWN

Students returning to dorms

Wired machines

Monday Tuesday Wednesday Thursday Friday

Time

Nu

mb

er o

f A

ctiv

e L

ease

s

Page 18: Bumps in the Wire:  NAT and DHCP

Individual Client Dynamics

• On-Time: The duration of time a client is active– (last request - first request) + ¼(lease time)– 20% of sessions: 30 minutes or less– 59% of sessions: 90 minutes or less– Implication: increasing lease time to 90 min could

save renewals

• Off-time: Duration between a new lease and the time of the last expired lease– time of request – (time of last renew + lease time)– 70% of off-times: less than 210 minutes– 30% of off-times: less than 30 minutes

Page 19: Bumps in the Wire:  NAT and DHCP

Emulating Longer Lease Times

• DISCOVER and RELEASE remain unchanged• Some DISCOVER messages become renew

REQUEST messages

On-Time (22.5 min)

Off-time(37.5 min)

On-time(22.5 min)

30-minLease

60-minLease

Page 20: Bumps in the Wire:  NAT and DHCP

Emulating Longer Lease Times

Time (min)

Nu

mb

er o

f ac

tive

lea

ses

Page 21: Bumps in the Wire:  NAT and DHCP

Effects of Longer Lease Times

• Increased address space utilization– 30-minute lease time: 67% utilization– 90-minute lease time: 80% utilization– 240-minute lease time: exhaustion

• Reduced renewals and expirations– 90-minute lease time saves

• 70% of renewal messages• 23% of expirations

Page 22: Bumps in the Wire:  NAT and DHCP

Alternative Lease-Time Strategies

• Single adaptation: Set initial lease time, then smaller lease time upon renewal– Example: 90-minute initial lease time, 30-min renewal– Intuition: Optimize for class time interval

• Exponential: Exponentially increase lease time upon each renewal– Intuition: Clients that have been present on the

network longer are likely to persist

Page 23: Bumps in the Wire:  NAT and DHCP

Effects of Alternative Strategies

77%

71%30%

Renewals Saved

Time (min)

Nu

mb

er o

f ac

tive

lea

ses

Page 24: Bumps in the Wire:  NAT and DHCP

Summary

• Measurement study of DHCP utilization on the Georgia Tech wireless network (LAWN)– Largest known public DHCP study: 6,000 users/day– Study of on-times and off-times

• Emulation tool for evaluating the effects of longer lease times on utilization

• Evaluation of alternative lease time strategies– Single adjustment– Exponential

Page 25: Bumps in the Wire:  NAT and DHCP

IPv6 Autoconfiguration

• Serverless (“Stateless”). No manual config at all.– Only configures addressing items, NOT other host things

• If you want that, use DHCP.• Link-local address

– 1111 1110 10 :: 64 bit interface ID (usually from Ethernet addr)• (fe80::/64 prefix)

– Uniqueness test (“anyone using this address?”)– Router contact (solicit, or wait for announcement)

• Contains globally unique prefix• Usually: Concatenate this prefix with local ID -> globally

unique IPv6 ID• DHCP took some of the wind out of this, but nice for

“zero-conf” (many OSes now do this for both v4 and v6)