NAT & IP Masquerade. Internet NETWORK ADDRESS TRANSLATION INTRODUCTION. NAT & IP Masquerade Page 1 of 5. Internal PC 192.168.0.25



Similar documents
21.4 Network Address Translation (NAT) NAT concept

Lecture 2-ter. 2. A communication example Managing a HTTP v1.0 connection. G.Bianchi, G.Neglia, V.Mancuso

ICS 351: Today's plan. IP addresses Network Address Translation Dynamic Host Configuration Protocol Small Office / Home Office configuration

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

Network Address Translation (NAT)

Technical Support Information Belkin internal use only

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Chapter 7. Address Translation

Proxy Server, Network Address Translator, Firewall. Proxy Server

Networking Security IP packet security

Internet Protocol: IP packet headers. vendredi 18 octobre 13

UIP1868P User Interface Guide

Configuring Network Address Translation (NAT)

(Refer Slide Time: 02:17)

Broadband Phone Gateway BPG510 Technical Users Guide

FIREWALLS. Firewall: isolates organization s internal net from larger Internet, allowing some packets to pass, blocking others

AS/400e. TCP/IP routing and workload balancing

OS/390 Firewall Technology Overview

Chapter 12 Supporting Network Address Translation (NAT)

Networking TCP/IP routing and workload balancing

Firewalls. Ahmad Almulhem March 10, 2012

IP addressing and forwarding Network layer

Gary Hecht Computer Networking (IP Addressing, Subnet Masks, and Packets)

+ iptables. packet filtering && firewall

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

Scaling the Network: Subnetting and Other Protocols. Networking CS 3470, Section 1

IP Filtering for Patton RAS Products

Chapter 3. TCP/IP Networks. 3.1 Internet Protocol version 4 (IPv4)

8.2 The Internet Protocol

Connecting with Computer Science, 2e. Chapter 5 The Internet

IMPLEMENTATION OF INTELLIGENT FIREWALL TO CHECK INTERNET HACKERS THREAT

FIREWALL AND NAT Lecture 7a

Technical Support Information

DATA COMMUNICATIONS MANAGEMENT. Gilbert Held INSIDE

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

Компјутерски Мрежи NAT & ICMP

CS 457 Lecture 19 Global Internet - BGP. Fall 2011

Protocols. Packets. What's in an IP packet

ECE 358: Computer Networks. Solutions to Homework #4. Chapter 4 - The Network Layer

IP Addressing A Simplified Tutorial

Ref: A. Leon Garcia and I. Widjaja, Communication Networks, 2 nd Ed. McGraw Hill, 2006 Latest update of this lecture was on

Connecting your Virtual Machine to the Internet. BT Cloud Compute. The power to build your own cloud solutions to serve your specific business needs

How To Configure Virtual Host with Load Balancing and Health Checking

1:1 NAT in ZeroShell. Requirements. Overview. Network Setup

Network Layers. CSC358 - Introduction to Computer Networks

Cape Girardeau Career Center CISCO Networking Academy Bill Link, Instructor. 2.,,,, and are key services that ISPs can provide to all customers.

Protocol Data Units and Encapsulation

Chapter 11. User Datagram Protocol (UDP)

Virtual private network. Network security protocols VPN VPN. Instead of a dedicated data link Packets securely sent over a shared network Internet VPN

Linux Firewalls (Ubuntu IPTables) II

Mobile IP Network Layer Lesson 02 TCP/IP Suite and IP Protocol

IP Ports and Protocols used by H.323 Devices

ERserver. iseries. TCP/IP routing and workload balancing

2. IP Networks, IP Hosts and IP Ports

Firewall. IPTables and its use in a realistic scenario. José Bateira ei10133 Pedro Cunha ei05064 Pedro Grilo ei09137 FEUP MIEIC SSIN

Fig : Packet Filtering

SSC - Communication and Networking Java Socket Programming (II)

How to set up Inbound Load Balance under Drop-in Mode

Internet Protocol (IP) IP - Network Layer. IP Routing. Advantages of Connectionless. CSCE 515: Computer Network Programming IP routing

GregSowell.com. Mikrotik Security

VoIP telephony over internet

Chapter 5 Customizing Your Network Settings

Firewall Defaults and Some Basic Rules

Chapter 4 Customizing Your Network Settings

Lab Configuring Access Policies and DMZ Settings

iseries TCP/IP routing and workload balancing

Internet Ideal: Simple Network Model

How To Set Up A Net Integration Firewall

TCP/IP Basis. OSI Model

Firewalls. Ingress Filtering. Ingress Filtering. Network Security. Firewalls. Access lists Ingress filtering. Egress filtering NAT

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

Configuring Static and Dynamic NAT Simultaneously

NAT REFERENCE GUIDE. VYATTA, INC. Vyatta System NAT. Title

Answers to Sample Questions on Network Layer

Application-layer protocols

CS335 Sample Questions for Exam #2

Chapter 4 Firewall Protection and Content Filtering

IPv6 Tunneling Over IPV4

This Technical Support Note shows the different options available in the Firewall menu of the ADTRAN OS Web GUI.

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

Chapter 4 Customizing Your Network Settings

Configuring Network Address Translation

How To Understand The Internet Of S (Netware)

Internet Privacy Options

Video Conferencing and Firewalls

Firewall VPN Router. Quick Installation Guide M73-APO09-380

Distributed Systems. Firewalls: Defending the Network. Paul Krzyzanowski

INTRODUCTION TO FIREWALL SECURITY

Source-Connect Network Configuration Last updated May 2009

Wireless Edge Services xl Module 2.0 Update NPI Technical Training June 2007

Planning for Information Network

About Firewall Protection

Multi-Homing Dual WAN Firewall Router

Firewall Defaults, Public Server Rule, and Secondary WAN IP Address

Computer Networks. Introduc)on to Naming, Addressing, and Rou)ng. Week 09. College of Information Science and Engineering Ritsumeikan University

Application. Transport. Network. Data Link. Physical. Network Layers. Goal

Subnetting,Supernetting, VLSM & CIDR

Netfilter / IPtables

IP - The Internet Protocol

Transcription:

NAT & IP Masquerade Page 1 of 5 INTRODUCTION Pre-requisites TCP/IP IP Address Space NAT & IP Masquerade Protocol version 4 uses a 32 bit IP address. In theory, a 32 bit address space should provide addresses for more than four billion computers, but inefficiencies in address allocation mean that less than half of the addresses are used. The result is a so-called internet address crisis - there are more computers than usable addresses. Therefore permanent IP addressses have become expensive IP addresses are usually assigned dynamically and are often shared among many computers. Private Networks Many organizations run private networks using the internet protocol. The IANA has assigned three IP networks for private networking: 10.0.0.0/8, 172.16.0.0/16, and 192.168.0.0/16. These IP networks may be used by anyone provided that the network is not connected to the globally connected. If an internet router receives a packet from or to one of these three networks, the router should discard the packet. Most private networks are connected to the through a firewall. Internal computer are computers on the private network. Computers on the are defined as external computers. External and internal computers communicate with each other through the firewall. But the firewall may not transmit the private IP addresses on the. The firewall must substitute a valid IP address. There are two techniques to accomplish this substitution: Network Address Translation and IP Masquerade. NETWORK ADDRESS TRANSLATION Network Address Translation (NAT) is a method of sharing IP addresses among many computers on a private network. NAT works completely on the network level, meaning that NAT operates by changing IP packets. NAT does not modify higher level protocol information, such as TCP, UDP, or ICMP. How NAT works Suppose a computer on a private network has IP address. The computer sends a packet to a computer, IP address, on the (figure 1a). The firewall's internal address () is defined as the default gateway, so the packet arrives at the firewall. The firewall cannot forward the packet to the with a source address of. Instead, the firewall has been assigned a pool of valid IP addresses (65.93.135.0/24). The firewall's NAT module replaces the original source address with one of the IP addresses from the pool, records the original and replacement IP addresses in a translation table, then forwards the modified packet to the (see figure 1b). When the firewall receives packets from the internet (figure 1c) its NAT module compares the arriving packets to the translation table and replaces the destination IP addresses with the appropriate private IP address. The firewall then forwards the packet to the private network (figure 1d). Problems with NAT NAT is a one-to-one system, meaning that each private IP address must be mapped to exactly one IP address. Once the IP address is used, it is removed from the pool until the communication is complete (the sysadmin will set a timeout value if the translation has been idle for that period of time, then the address will be returned to the pool). IP addresses are expensive, so there will typically be many more computers in the private network than there are addresses in the pool. When all the addresses are used up, no more computers may connect to the. to: from: NAT pool: 65.93.135.0/24 Figure 1a: NAT

NAT & IP Masquerade Pag e 2 of 5 to: from: Figure 1b: NAT to: from: Figure 1c: NAT to: from: Figure 1d: NAT IP MASQUERADE IP Masquerade is a many-to-one translation technique: it allows many private IP addresses to share one IP address simultaneously. IP Masquerade operates at the network and transport level: it changes both IP and TCP (and UDP) header information. on both the IP level and the TCP (or UDP) levels. How IP Masquerade Works In an IP Masquerade system, many computers on a private network access the internet through an IP masquerading firewall. When the internal computer sends a packet to the internet, the firewall receives the packet on it's internal interface. A TCP connection is defined by two sockets one socket at the source computer and another socket at the destination computer. A socket consists of the computers IP address and the port number (for instance, port 80 for

NAT & IP Masquerade Page 3 of 5 http). When the internal PC sends a segment to the computer in the internet, it specifies the destination socket :80 and its own socket, :80. The firewall cannot forward this TCP segment to the because the IP address is a private network address. The firewall must replace the private IP address with its own IP address,, similar to the NAT procedure. But IP Masquerade takes an extra step: it changes the port number. The IP Masquerade module replaces the original port number with a higher number, such as 10000. The IP masquerade module creates a translation table entry listing the original socket number and the modified socket number, then forwards the modified TCP segment to the (figure 2b). Later, if the firewall receives TCP segments from the with destination socket :10000, it will translate the socket number back to the original value and forward the segment on the private network. Now, suppose another computer on the private network sends a TCP segment to the (figure 2c). The segment arrives at the firewall. The IP masquerade module modifies the socket number: it replaces the private IP to: :80 from: :80 Figure 2a: IP Masquerade dest: :80 src: :10000 :80 :10000 Figure 2b: IP Masquerade 192.168.1.37 dest: 138.128.37.12:80 src: 192.168.1.37:80 :80 :10000 Figure 2c: IP Masquerade 138.128.37.12

NAT & IP Masquerade Pag e 4 of 5 192.168.1.37 dest: 138.128.37.12:80 src: :10001 :80 :10000 192.168.1.37:80 :10001 Figure 2d: IP Masquerade 138.128.37.12 address with the firewall's address, and replaces the original port number with a unique port number from the translation pool. Then the IP masquerade module adds the new entry to the translation table and forwards the modified segment to the (figure 2d). Later, if the firewall receives a segment from the with destination socket :10001, then the IP masquerade module will replace the destination socket number with the original socket number from the translation table and transmit the corrected segment on the private network. There is a timeout value associated with the entries in the translation table: if a socket listed in the translation table goes unused for a time period longer than the time out, then the entry is removed from the translation table. Problems with IP Masquerade IP Masquerade uses a unique port number for each connection from the private network. There are 65,536 possible port numbers, so it is unlikely that IP masquerade will run out numbers, but under certain circumstances it can happen. For instance, Game Spy software opens thousands of short lived connections. If multiple hosts on the private network run Game Spy, then the firewall can run out of port numbers. IP masquerade works well when computers on the private network originate all connections. IP masquerade doesn't work when computers on the try to open connections to computers on the private network. For instance, some game servers use multiple connections. The computer on the private network opens the first connection to the game server, and that works fine with IP masquerade. But then the game server tries to open a second connection on a different port to the client on the private network. This is a problem, because when the firewall sees the new incoming connection request the new socket won't be in the translation table, so the IP masquerade module won't know where to send the segment. Port Forwarding Suppose you want to run a web server on one of the computers in your private network. This would be a problem, because computers from the cannot send IP datagrams to a private IP address. IP masquerade overcomes this problem using a technique called port forwarding. Using port fowarding, you may program the IP masquerade module to forward any segments destined for a specific port on the firewall to a port on a computer in the private network. Mail server 192.168.0.12:25 to: :80 from: :80 Web server 192.168.1.37:80 Port Forwarding 192.168.0.12:25 :25 192.168.1.37:80 :80 Figure 3: Port Forwarding

NAT & IP Masquerade Pag e 5 of 5 For instance, consider the situation depicted in figure 3. The sysadmin wants to operate a mail server and a web server on the private network. To do this, the sysadmin creates two translations in the firewall's IP masquerading table. The first entry translates any segments arriving on the firewall's mail server socket to the private network's mail server socket. The second entry does the same thing for the web server. Unlike normal NAT and IP masquerade, port forwarding translations have no timeout period. The translations stay in the translation table until they are manually removed or the entire table is reset. DETECTING NAT AND IP MASQUERADE Some ISPs specify in their user agreements that you can only connect one computer. So you might ask, Can my ISP tell that I am running NAT or IP Masquerade? The short answer is Yes. When a computer originates an IP packet it assigns a value to the Time To Live (TTL) field. Usually this value is 128, sometimes it is 255. If your computer is directly connected to the ISP, then the ISP's edge router will always see values of 128 (or 255) in the TTL field of your packets. But each IP forwarding device reduces the value of the TTL field by 1. So if there is a NAT (or IP masquerade) box between your computer and the ISP edge router, then the ISP will see values of 127 (or 254) in your packets' TTL fields. Therefore the ISP can detect that you are using a NAT box. Obviously, the NAT box can be fixed to modify the TTL field so that the TTL value is always 128 let's call it stealth NAT. But as of this date (April 2003) NAT boxes do not implement stealth NAT. It is even possible to estimate the number of computers sharing a single IP address through an IP masquerade box. When a computer originates an IP packet, the originating computer creates a 16 bit ID number which goes in the ID field of the IP packet header. Typically ID numbers from a single computer are assigned in sequence, so one packet might have an ID number of 43,321, the next packet might have an ID number of 43,322, and so on. When these packets go through the IP masquerade module, the ID numbers are the same, so the ISP's edge router will see ID number 43,321, ID number 43,322, and so on. But if a second computer is also using IP masquerade, it will probably be using a different series of ID numbers, suppose it is generating packets with ID numbers 23,327, 23,328, etc. And a third computer might be sending packets with IDs of 7,000, 7,001, 7,002, etc. These packets arrive at the edge router in any particular order, so the edge router might see packets arriving with the following ID numbers: 7000, 23327, 23328, 7001, 43321, 7002, 43322, 23329, 7003, 43323. The edge router can easily determine that there are three different sequences of ID numbers, and therefore that there are three different hosts behind the IP masquerade box. NAT/IP MASQUERADE CONFUSION Just to make matters interesting, many authors confuse the terms NAT and IP masquerade. Some authors refer toboth NAT and IP Masquerade as NAT. You might also see terms like one-to-many NAT or multipoint NAT used instead of IP masquerade. Like so much of the computer world, jargon is poorly defined and the few good definitions are rarely enforced. You can help by using NAT and IP Masquerade properly.