COMS/CSEE 4140 Networking Laboratory Lecture 08 Salman Abdul Baset Spring 2008
Announcements <ul><li>Prelab 7 and Lab report 6 due next week before your lab slot </li></ul><ul><li>Assignment 3 due next...
Last time… <ul><li>Interconnection devices (hub, bridge/switch, router) </li></ul><ul><li>Bridges/LAN switches vs. routers...
Agenda <ul><li>Private network and addresses </li></ul><ul><li>NAT (Network Address Translator) </li></ul><ul><ul><li>Basi...
Private Network <ul><li>Private IP  network is an IP network with private IP addresses </li></ul><ul><li>IP addresses in a...
Private Addresses
<ul><li>A hack to fix the IP address depletion problem . </li></ul><ul><ul><li>NAT is a router function where IP addresses...
Basic Operation of NAT <ul><li>NAT device stores the address and port translation tables  (Binding) </li></ul><ul><ul><li>...
NAT Issues <ul><li>Private-to-public address mapping </li></ul><ul><ul><li>Static NAT </li></ul></ul><ul><ul><li>Dynamic N...
Static mapping Dynamic mapping NAPT/PAT
Binding: Endpoint-independent
Binding: Address-dependent
Binding: Address and port dependent
Filtering: Endpoint-independent
Filtering: Address-dependent
Filtering: Address and port dependent
NAT Issues  <ul><li>Port preserving </li></ul><ul><li>Hair pinning </li></ul><ul><li>Discovering binding lifetime </li></ul>
Main uses of NAT <ul><li>Pooling of IP addresses </li></ul><ul><li>Supporting migration between network service providers ...
Pooling of IP addresses <ul><li>Scenario:  Corporate network has many hosts but only a small number of public IP addresses...
Pooling of IP addresses <ul><li>Host </li></ul><ul><li>private address:  10.0.1.2 </li></ul><ul><li>public address:  128.1...
Supporting migration between network service providers <ul><li>Scenario:  In practice (using CIDR), the IP addresses in a ...
Supporting migration between network service providers
Supporting migration between network service providers
IP masquerading <ul><li>Also called: Network address and port translation (NAPT), port address translation (PAT).   </li><...
IP masquerading
Load balancing of servers <ul><li>Scenario:  Balance the load on a set of identical servers, which are accessible from a s...
Load balancing of servers When does this work? When does this fail?
Concerns about NAT <ul><li>Performance </li></ul><ul><ul><li>Modifying the IP header by changing the IP address requires t...
Concerns about NAT <ul><li>End-to-end connectivity </li></ul><ul><ul><li>NAT destroys universal end-to-end reachability of...
NAT and FTP <ul><li>Normal FTP operation </li></ul>
NAT and FTP <ul><li>NAT device without FTP support </li></ul>
NAT and FTP <ul><li>NAT device with FTP support </li></ul>
Configuring NAT/firewall in Linux <ul><li>iptables </li></ul><ul><li>Table (queue) </li></ul><ul><ul><li>Filter, NAT, Mang...
Configuring NAT/firewall in Linux Modification of TCP quality of service bits before routing PREROUTING POSTROUTING OUTPUT...
Source:  http://www.linuxhomenetworking.com/wiki/index.php/Q uick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables#What_Is_ip...
Configuring NAT in Linux <ul><li>Linux uses the Netfilter/iptable Kernel package </li></ul>
Configuring NAT with  iptables <ul><li>First example: iptables –t nat –A POSTROUTING –s 10.0.1.2    –j SNAT --to-source 12...
Agenda <ul><li>Private network and addresses </li></ul><ul><li>NAT (Network Address Translator) </li></ul><ul><ul><li>Basi...
Dynamic Assignment of IP addresses <ul><li>Dynamic assignment of IP addresses is desirable for several reasons: </li></ul>...
Solutions for dynamic assignment of IP addresses <ul><li>Reverse Address Resolution Protocol (RARP) </li></ul><ul><ul><li>...
BOOTP (RFC 951) <ul><li>BOOTstrap Protocol (BOOTP)  </li></ul><ul><ul><li>Predecessor of DHCP </li></ul></ul><ul><ul><li>H...
DHCP <ul><li>Dynamic Host Configuration Protocol (DHCP)  </li></ul><ul><ul><li>From 1993 </li></ul></ul><ul><ul><li>An ext...
DHCP Interaction (simplified)
BOOTP/DHCP Message Format (There are >100 different options !!!)
BOOTP/DHCP <ul><li>OpCode :  1 (Request), 2(Reply) </li></ul><ul><ul><ul><ul><li>Note: DHCP message type is sent in an opt...
DHCP Message Type <ul><li>Message type is sent as an option.  </li></ul>DHCPRELEASE  7 DHCPINFORM  8 DHCPNAK  6 DHCPACK  5...
Other options (selection) <ul><li>Other DHCP information that is sent as an option: </li></ul><ul><li>Subnet Mask, Name Se...
DHCP Operation <ul><li>DHCP DISCOVER </li></ul><ul><li>DHCP OFFER </li></ul>
DHCP Operation <ul><li>DHCP DISCOVER </li></ul>At this time, the DHCP client can start to use the IP address <ul><li>Renew...
DHCP Operation <ul><li>DCHP RELEASE </li></ul>At this time, the DHCP client has released the IP address
Upcoming SlideShare
Loading in...5
×

08.ppt

901

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
901
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

08.ppt

  1. 1. COMS/CSEE 4140 Networking Laboratory Lecture 08 Salman Abdul Baset Spring 2008
  2. 2. Announcements <ul><li>Prelab 7 and Lab report 6 due next week before your lab slot </li></ul><ul><li>Assignment 3 due next week Monday </li></ul><ul><li>Project groups </li></ul>
  3. 3. Last time… <ul><li>Interconnection devices (hub, bridge/switch, router) </li></ul><ul><li>Bridges/LAN switches vs. routers </li></ul><ul><li>Bridge concepts, PDU </li></ul><ul><li>Spanning tree algorithm </li></ul><ul><li>Linux packet reception </li></ul>
  4. 4. Agenda <ul><li>Private network and addresses </li></ul><ul><li>NAT (Network Address Translator) </li></ul><ul><ul><li>Basic operation </li></ul></ul><ul><ul><li>Issues (binding, filtering, state maintenance) </li></ul></ul><ul><ul><li>Main uses of NAT </li></ul></ul><ul><li>Dynamic Host Configuration Protocol (DHCP) </li></ul>
  5. 5. Private Network <ul><li>Private IP network is an IP network with private IP addresses </li></ul><ul><li>IP addresses in a private network can be assigned arbitrarily but they are usually picked from the reserved pool ( can we use any? ) </li></ul><ul><ul><li>Not registered and not guaranteed to be globally unique </li></ul></ul><ul><li>Generally, private networks use addresses from the following experimental address ranges ( non-routable addresses ): </li></ul><ul><ul><li>10.0.0.0 – 10.255.255.255 </li></ul></ul><ul><ul><li>172.16.0.0 – 172.31.255.255 </li></ul></ul><ul><ul><li>192.168.0.0 – 192.168.255.255 </li></ul></ul>
  6. 6. Private Addresses
  7. 7. <ul><li>A hack to fix the IP address depletion problem . </li></ul><ul><ul><li>NAT is a router function where IP addresses (and possibly port numbers) of IP datagrams are replaced at the boundary of a private network. </li></ul></ul><ul><li>Breaks the End-to-End argument. </li></ul><ul><ul><li>RFC 1631 - The IP Network Address Translator (NAT) </li></ul></ul><ul><ul><li>Not an Internet standard (RFC 3700) but… </li></ul></ul><ul><li>Provides a form of security by acting as a firewall </li></ul><ul><ul><li>Home users </li></ul></ul><ul><ul><li>Small companies </li></ul></ul>N etwork A ddress T ranslator Other solutions to the IP address problem are?
  8. 8. Basic Operation of NAT <ul><li>NAT device stores the address and port translation tables (Binding) </li></ul><ul><ul><li>In the this example we mapped only addresses. </li></ul></ul><ul><li>NAT devices filters incoming traffic (Filtering) </li></ul><ul><li>Host </li></ul><ul><li>private address: 10.0.1.2 </li></ul><ul><li>public address: 128.143.71.21 </li></ul>Public Host <ul><li>Private Network </li></ul><ul><li>Internet </li></ul>64.236.24.4 NAT Device Private Address Public Address 10.0.1.1 128.59.16.21 <ul><li>Source </li></ul>= 10.0.1.2 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 10.0.1.2 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 128.143.71.21 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 128.143.71.21 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 64.236.24.4 <ul><li>Destination </li></ul>= 128.59.16.21 <ul><li>Source </li></ul>= 64.236.24.4 <ul><li>Destination </li></ul>= 10.0.0.2 <ul><li>Source </li></ul>= 64.236.24.4 <ul><li>Destination </li></ul>= 128.59.16.21 <ul><li>Source </li></ul>= 64.236.24.4 <ul><li>Destination </li></ul>= 128.59.16.21 <ul><li>Source </li></ul>= 64.236.24.4 <ul><li>Destination </li></ul>= 128.59.16.21 <ul><li>Source </li></ul>= 64.236.24.4 <ul><li>Destination </li></ul>= 10.0.0.2
  9. 9. NAT Issues <ul><li>Private-to-public address mapping </li></ul><ul><ul><li>Static NAT </li></ul></ul><ul><ul><li>Dynamic NAT </li></ul></ul><ul><ul><li>Overloading (NAPT or PAT) </li></ul></ul><ul><li>State maintenance </li></ul><ul><ul><li>Linux: /proc/net/ip_conntrack </li></ul></ul><ul><li>Binding and Filtering Behavior </li></ul><ul><ul><li>Binding: endpoint-independent, address dependent, address and port-dependent </li></ul></ul><ul><ul><li>Filtering: endpoint-independent filtering, address dependent filtering, address and port-dependent filtering. </li></ul></ul>
  10. 10. Static mapping Dynamic mapping NAPT/PAT
  11. 11. Binding: Endpoint-independent
  12. 12. Binding: Address-dependent
  13. 13. Binding: Address and port dependent
  14. 14. Filtering: Endpoint-independent
  15. 15. Filtering: Address-dependent
  16. 16. Filtering: Address and port dependent
  17. 17. NAT Issues <ul><li>Port preserving </li></ul><ul><li>Hair pinning </li></ul><ul><li>Discovering binding lifetime </li></ul>
  18. 18. Main uses of NAT <ul><li>Pooling of IP addresses </li></ul><ul><li>Supporting migration between network service providers </li></ul><ul><li>IP masquerading and internal firewall </li></ul><ul><li>Load balancing of servers </li></ul>
  19. 19. Pooling of IP addresses <ul><li>Scenario: Corporate network has many hosts but only a small number of public IP addresses. </li></ul><ul><li>NAT solution: </li></ul><ul><ul><li>Corporate network is managed with a private address space. </li></ul></ul><ul><ul><li>NAT device, located at the boundary between the corporate network and the public Internet, manages a pool of public IP addresses. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  20. 20. Pooling of IP addresses <ul><li>Host </li></ul><ul><li>private address: 10.0.1.2 </li></ul><ul><li>public address: 128.143.71.21 </li></ul><ul><li>Private Network </li></ul><ul><li>Internet </li></ul>NAT Device Public Host 64.236.24.4 Private Address Public Address 10.0.1.2 128.59.16.21 <ul><li>Source </li></ul>= 10.0.1.2 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 10.0.1.2 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 128.143.71.21 <ul><li>Destination </li></ul>= 64.236.24.4 <ul><li>Source </li></ul>= 128.143.71.21 <ul><li>Destination </li></ul>= 64.236.24.4
  21. 21. Supporting migration between network service providers <ul><li>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. </li></ul><ul><li>NAT solution: </li></ul><ul><ul><li>Assign private addresses to the hosts of the corporate network </li></ul></ul><ul><ul><li>NAT device has address translation entries which bind the private address of a host to the public address. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  22. 22. Supporting migration between network service providers
  23. 23. Supporting migration between network service providers
  24. 24. IP masquerading <ul><li>Also called: Network address and port translation (NAPT), port address translation (PAT). </li></ul><ul><li>Scenario: Single public IP address is mapped to multiple hosts in a private network. </li></ul><ul><li>NAT solution: </li></ul><ul><ul><li>Assign private addresses to the hosts of the corporate network </li></ul></ul><ul><ul><li>NAT device modifies the port numbers for outgoing traffic </li></ul></ul>
  25. 25. IP masquerading
  26. 26. Load balancing of servers <ul><li>Scenario: Balance the load on a set of identical servers, which are accessible from a single IP address </li></ul><ul><li>NAT solution: </li></ul><ul><ul><li>Here, the servers are assigned private addresses </li></ul></ul><ul><ul><li>NAT device acts as a proxy for requests to the server from the public network </li></ul></ul><ul><ul><li>The NAT device changes the destination IP address of arriving packets to one of the private addresses for a server </li></ul></ul><ul><ul><li>A sensible strategy for balancing the load of the servers is to assign the addresses of the servers in a round-robin fashion. </li></ul></ul>
  27. 27. Load balancing of servers When does this work? When does this fail?
  28. 28. Concerns about NAT <ul><li>Performance </li></ul><ul><ul><li>Modifying the IP header by changing the IP address requires that NAT boxes recalculate the IP header checksum. </li></ul></ul><ul><ul><li>Modifying port number requires that NAT boxes recalculate TCP checksum. </li></ul></ul><ul><li>Fragmentation </li></ul><ul><ul><li>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. </li></ul></ul>
  29. 29. Concerns about NAT <ul><li>End-to-end connectivity </li></ul><ul><ul><li>NAT destroys universal end-to-end reachability of hosts on the Internet. </li></ul></ul><ul><ul><li>A host in the public Internet often cannot initiate communication to a host in a private network. </li></ul></ul><ul><ul><li>The problem is worse, when two hosts that are in a private network need to communicate with each other. </li></ul></ul><ul><li>NAT and applications </li></ul><ul><ul><li>NAT break applications such as file transfer, VoIP </li></ul></ul>
  30. 30. NAT and FTP <ul><li>Normal FTP operation </li></ul>
  31. 31. NAT and FTP <ul><li>NAT device without FTP support </li></ul>
  32. 32. NAT and FTP <ul><li>NAT device with FTP support </li></ul>
  33. 33. Configuring NAT/firewall in Linux <ul><li>iptables </li></ul><ul><li>Table (queue) </li></ul><ul><ul><li>Filter, NAT, Mangle </li></ul></ul><ul><li>Chain </li></ul><ul><ul><li>Place within the table where firewall/NAT rules are placed. </li></ul></ul><ul><ul><li>Packets pass through chains where tables are looked up and a decision per packet is made. </li></ul></ul>
  34. 34. Configuring NAT/firewall in Linux Modification of TCP quality of service bits before routing PREROUTING POSTROUTING OUTPUT INPUT FORWARD TCP header modification Mangle Address translation for packets generated by firewall OUTPUT Address translation occurs after routing (SNAT) POSTROUTING Address translation occurs before routing (DNAT) PREROUTING Network address translation NAT Packets originating from firewall OUTPUT Packets destined for firewall INPUT Packets being forwarded FORWARD Packet filtering Filter Chain Function Packet transformation chain Queue Function Queue Type
  35. 35. Source: http://www.linuxhomenetworking.com/wiki/index.php/Q uick_HOWTO_:_Ch14_:_Linux_Firewalls_Using_iptables#What_Is_iptables.3F
  36. 36. Configuring NAT in Linux <ul><li>Linux uses the Netfilter/iptable Kernel package </li></ul>
  37. 37. Configuring NAT with iptables <ul><li>First example: iptables –t nat –A POSTROUTING –s 10.0.1.2 –j SNAT --to-source 128.16.71.21 </li></ul><ul><li>Pooling of IP addresses: iptables –t nat –A POSTROUTING –s 10.0.1.0/24 –j SNAT --to-source 128.16.71.0–128.16.71.30 </li></ul><ul><li>IP masquerading: </li></ul><ul><li>iptables –t nat –A POSTROUTING –s 10.0.1.0/24 –o eth1 –j MASQUERADE </li></ul><ul><li>Load balancing: </li></ul><ul><li>iptables -t nat -A PREROUTING -i eth1 -j DNAT --to-destination 10.0.1.2-10.0.1.4 </li></ul>
  38. 38. Agenda <ul><li>Private network and addresses </li></ul><ul><li>NAT (Network Address Translator) </li></ul><ul><ul><li>Basic operation </li></ul></ul><ul><ul><li>Issues (binding, filtering, state maintenance) </li></ul></ul><ul><ul><li>Main uses of NAT </li></ul></ul><ul><li>Dynamic Host Configuration Protocol (DHCP) </li></ul>
  39. 39. Dynamic Assignment of IP addresses <ul><li>Dynamic assignment of IP addresses is desirable for several reasons: </li></ul><ul><ul><li>IP addresses are assigned on-demand </li></ul></ul><ul><ul><li>Avoid manual IP configuration </li></ul></ul><ul><ul><li>Support mobility of laptops / handheld WiFi devices </li></ul></ul>
  40. 40. Solutions for dynamic assignment of IP addresses <ul><li>Reverse Address Resolution Protocol (RARP) </li></ul><ul><ul><li>Works similar to ARP </li></ul></ul><ul><ul><li>Broadcast a request for the IP address associated with a given MAC address </li></ul></ul><ul><ul><li>RARP server responds with an IP address </li></ul></ul><ul><ul><li>Only assigns IP address (not the default router and subnet mask) </li></ul></ul>Why not a good solution?
  41. 41. BOOTP (RFC 951) <ul><li>BOOTstrap Protocol (BOOTP) </li></ul><ul><ul><li>Predecessor of DHCP </li></ul></ul><ul><ul><li>Host can configure its IP parameters at boot time. </li></ul></ul><ul><ul><li>Three services </li></ul></ul><ul><ul><ul><li>IP address assignment. </li></ul></ul></ul><ul><ul><ul><li>Detection of the IP address for a serving machine. </li></ul></ul></ul><ul><ul><ul><li>The name of a file to be loaded and executed by the client machine (boot file name) </li></ul></ul></ul><ul><ul><li>Not only assign IP address, but also default router, network mask, etc. </li></ul></ul><ul><ul><li>Sent as UDP messages (UDP Port 67 (server) and 68 (host)) </li></ul></ul><ul><ul><li>Use limited broadcast address (255.255.255.255): </li></ul></ul><ul><ul><ul><li>These addresses are never forwarded </li></ul></ul></ul>
  42. 42. DHCP <ul><li>Dynamic Host Configuration Protocol (DHCP) </li></ul><ul><ul><li>From 1993 </li></ul></ul><ul><ul><li>An extension of BOOTP, very similar to DHCP </li></ul></ul><ul><ul><li>Same port numbers as BOOTP </li></ul></ul><ul><ul><li>Extensions: </li></ul></ul><ul><ul><ul><li>Supports temporary allocation (“leases”) of IP addresses </li></ul></ul></ul><ul><ul><ul><li>DHCP client can acquire all IP configuration parameters needed to operate </li></ul></ul></ul><ul><ul><li>DHCP is the preferred mechanism for dynamic assignment of IP addresses </li></ul></ul><ul><ul><li>DHCP can interoperate with BOOTP clients. </li></ul></ul>
  43. 43. DHCP Interaction (simplified)
  44. 44. BOOTP/DHCP Message Format (There are >100 different options !!!)
  45. 45. BOOTP/DHCP <ul><li>OpCode : 1 (Request), 2(Reply) </li></ul><ul><ul><ul><ul><li>Note: DHCP message type is sent in an option </li></ul></ul></ul></ul><ul><li>Hardware Type : 1 (for Ethernet) </li></ul><ul><li>Hardware address length : 6 (for Ethernet) </li></ul><ul><li>Hop count : set to 0 by client </li></ul><ul><li>Transaction ID : Integer (used to match reply to response) </li></ul><ul><li>Seconds: number of seconds since the client started to boot </li></ul><ul><li>Client IP address, Your IP address, server IP address, Gateway IP address, client hardware address, server host name, boot file name: client fills in the information that it has, leaves rest blank </li></ul>
  46. 46. DHCP Message Type <ul><li>Message type is sent as an option. </li></ul>DHCPRELEASE 7 DHCPINFORM 8 DHCPNAK 6 DHCPACK 5 DHCPDECLINE 4 DHCPREQUEST 3 DHCPOFFER 2 DHCPDISCOVER 1 Message Type Value
  47. 47. Other options (selection) <ul><li>Other DHCP information that is sent as an option: </li></ul><ul><li>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, … </li></ul>
  48. 48. DHCP Operation <ul><li>DHCP DISCOVER </li></ul><ul><li>DHCP OFFER </li></ul>
  49. 49. DHCP Operation <ul><li>DHCP DISCOVER </li></ul>At this time, the DHCP client can start to use the IP address <ul><li>Renewing a Lease </li></ul><ul><li>(sent when 50% of lease has expired) </li></ul><ul><li>If DHCP server sends DHCPNACK, then address is released. </li></ul>
  50. 50. DHCP Operation <ul><li>DCHP RELEASE </li></ul>At this time, the DHCP client has released the IP address
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×