Network Address Translation (NAT)
Last Updated : 04 Feb, 2025
Network Address Translation allows (NAT) multiple devices to use the same public IP address and access the Internet.
- There can be total 232 (around 4.3 billion) different IPv4 addresses which is very less considering the number of IPv4 devices connected to the Internet.
- The idea of NAT saves from IP address exhaustion. One public IP address is needed to access the Internet but we can use multiple IP addresses in our private network and access the internet from different devices and same IP address. To achieve this, a private IP address must be translated into a public IP address.
Network Address Translation(NAT)
Network Address Translation (NAT) is a process in which one or more local IP addresses are translated into one or more Global IP addresses and vice versa to provide Internet access to the local hosts. It also does the translation of port numbers, i.e., masks the port number of the host with another port number in the packet that will be routed to the destination. It then makes the corresponding entries of IP address and port number in the NAT table. NAT generally operates on a router or firewall.
Network Address TranslationWorking of Network Address Translation (NAT)
Generally, the border router is configured for NAT i.e. the router which has one interface in the local (inside) network and one interface in the global (outside) network. When a packet traverse outside the local (inside) network, then NAT converts that local (private) IP address to a global (public) IP address. When a packet enters the local network, the global (public) IP address is converted to a local (private) IP address.
If NAT runs out of addresses, i.e., no address is left in the pool configured then the packets will be dropped and an Internet Control Message Protocol (ICMP) host unreachable packet to the destination is sent.
Why Mask Port Numbers?
Suppose, in a network, two hosts A and B are connected. Now, both of them request for the same destination, on the same port number, say 1000, on the host side, at the same time. If NAT does only translation of IP addresses, then when their packets will arrive at the NAT, both of their IP addresses would be masked by the public IP address of the network and sent to the destination. Destination will send replies to the public IP address of the router. Thus, on receiving a reply, it will be unclear to NAT as to which reply belongs to which host (because source port numbers for both A and B are the same). Hence, to avoid such a problem, NAT masks the source port number as well and makes an entry in the NAT table.
NAT inside and outside addresses
Inside refers to the addresses which must be translated. Outside refers to the addresses which are not in control of an organization. These are the network Addresses in which the translation of the addresses will be done.

- Inside local address - An IP address that is assigned to a host on the Inside (local) network. The address is probably not an IP address assigned by the service provider i.e., these are private IP addresses. This is the inside host seen from the inside network.
- Inside global address - IP address that represents one or more inside local IP addresses to the outside world. This is the inside host as seen from the outside network.
- Outside local address - This is the actual IP address of the destination host in the local network after translation.
- Outside global address - This is the outside host as seen from the outside network. It is the IP address of the outside destination host before translation.
Types of Network Address Translation (NAT)
There are 3 ways to configure NAT:
Static NAT
In this, a single unregistered (Private) IP address is mapped with a legally registered (Public) IP address i.e one-to-one mapping between local and global addresses. This is generally used for Web hosting. These are not used in organizations as there are many devices that will need Internet access and to provide Internet access, a public IP address is needed.
Suppose, if there are 3000 devices that need access to the Internet, the organization has to buy 3000 public addresses that will be very costly.
Dynamic NAT
In this type of NAT, an unregistered IP address is translated into a registered (Public) IP address from a pool of public IP addresses. If the IP address of the pool is not free, then the packet will be dropped as only a fixed number of private IP addresses can be translated to public addresses.
Suppose, if there is a pool of 2 public IP addresses then only 2 private IP addresses can be translated at a given time. If 3rd private IP address wants to access the Internet then the packet will be dropped therefore many private IP addresses are mapped to a pool of public IP addresses. NAT is used when the number of users who want to access the Internet is fixed. This is also very costly as the organization has to buy many global IP addresses to make a pool.
Port Address Translation (PAT)
This is also known as NAT overload. In this, many local (private) IP addresses can be translated to a single registered IP address. Port numbers are used to distinguish the traffic i.e., which traffic belongs to which IP address. This is most frequently used as it is cost-effective as thousands of users can be connected to the Internet by using only one real global (public) IP address.
Advantages of NAT
- NAT conserves legally registered IP addresses.
- It provides privacy as the device's IP address, sending and receiving the traffic, will be hidden.
- Eliminates address renumbering when a network evolves.
Disadvantage of NAT
- Translation results in switching path delays.
- Certain applications will not function while NAT is enabled.
- Complicates tunneling protocols such as IPsec.
- Also, the router being a network layer device, should not tamper with port numbers(transport layer) but it has to do so because of NAT.
To read about Difference Between Network Address Translation and Domain Name System, refer to this article.
Similar Reads
Data Communication Tutorial Data communication plays an important role in today's interconnected world and enables the exchange of information between devices and networks. Whether you're sending an email, making a video call, or browsing the web, data communication ensures that information flows smoothly. This Data Communicat
5 min read
Basics of Data Communication
Data Communication - Definition, Components, Types, ChannelsTransferring data over a transmission medium between two or more devices, systems, or places is known as data communication. Nowadays, computing and telecommunications depend heavily on this data transmission, which makes a variety of applications conceivable, including email, video chatting, the In
7 min read
Types of Computer NetworksA computer network is a system that connects many independent computers to share information (data) and resources. The integration of computers and other different devices allows users to communicate more easily. It is a collection of two or more computer systems that are linked together. A network
11 min read
Transmission Modes in Computer Networks (Simplex, Half-Duplex and Full-Duplex)Transmission modes also known as communication modes, are methods of transferring data between devices on buses and networks designed to facilitate communication. They are classified into three types: Simplex Mode, Half-Duplex Mode, and Full-Duplex Mode. In this article, we will discuss Transmission
6 min read
Difference Between Serial and Parallel TransmissionData transmission is how computers and other devices send information to each other. There are two main ways to do this Serial and Parallel Transmission. In Serial Transmission, data is sent one bit at a time like sending a single line of people through a door. In Parallel Transmission data is sent
4 min read
How Data Encapsulation and De-encapsulation Works?Data encapsulation and de-encapsulation are fundamental concepts in computer networking and communication protocols. These processes are essential for transferring data across networks efficiently and securely. What is Data Encapsulation?Encapsulation is the process of adding additional information
4 min read
OSI Model
TCP/IP Model The TCP/IP model is a framework that is used to model the communication in a network. It is mainly a collection of network protocols and organization of these protocols in different layers for modeling the network.It has four layers, Application, Transport, Network/Internet and Network Access.While
7 min read
Data and Signals
Transmission of Signals
Transmission Impairment in Data CommunicationIn communication system, analog signals travel through transmission media, which tends to deteriorate the quality of analog signal, which means that the signal at the beginning of the medium is not the same as the signal at the end of the medium. The imperfection causes signal impairment. Below are
3 min read
What is Bandwidth? Definition, Working, Importance, UsesPre-Requisite: Introduction to Bandwidth Network bandwidth is the maximum capacity of a wired or wireless communications link to deliver data via a network connection in a given amount of time. Bandwidth is typically defined as the number of bits, kilobits, megabits, or gigabits that may be sent in
8 min read
Digital To Digital Conversion in Computer NetworkIn this article we will be discussing about digital-to-digital transmission in computer network i.e., how a digital data or information is converted into digital signal. The digital-to-digital encoding can be done by a technique called line coding. Line CodingThe process of converting the digital da
5 min read
Line CodingThe process of converting binary data into a sequence of bits of the digital signal is known as Line coding. It is also known as digital PAM formats. Need of Line coding: We always come across different types of data such as text, numbers, graphical images, audio, and video. These all data are store
2 min read
Analog to Digital ConversionDigital Signal: A digital signal is a signal that represents data as a sequence of discrete values; at any given time it can only take on one of a finite number of values. Analog Signal: An analog signal is any continuous signal for which the time varying feature of the signal is a representation of
6 min read
Digital to Analog ConversionDigital Signal - A digital signal is a signal that represents data as a sequence of discrete values; at any given time it can only take on one of a finite number of values. Analog Signal - An analog signal is any continuous signal for which the time varying feature of the signal is a representation
3 min read
Quadrature Amplitude ModulationQuadrature Amplitude Modulation (QAM) is a modulation technique that can be utilized in Analog modulation concepts and digital modulation concepts. It is a combination of ASK and PSK. So, in this article, we will discuss QAM, Analog QAM, Digital QAM, and many more. Quadrature Amplitude Modulation:Qu
5 min read
Analog to Analog Conversion (Modulation)Analog Signal: An analog signal is any continuous signal for which the time varying feature of the signal is a representation of some other time varying quantity i.e., analogous to another time varying Signal. Analog to Analog Conversion - Analog-to-analog conversion, or modulation, is the represent
3 min read
What is Modulation?Modulation can be digital or analog, the input wave of the analog signal varies continuously like a sine wave. Modulation can be defined as the process of converting data into waves by adding information to a carrier signal. Such a signal can be transmitted electronically or optically, but it must h
6 min read
Multiplexing
Transmission Media
Types of Transmission MediaTransmission media is the physical medium through which data is transmitted from one device to another within a network. These media can be wired or wireless. The choice of medium depends on factors like distance, speed, and interference. In this article, we will discuss the transmission media. In t
9 min read
Twisted-pair CableTwisted-pair Cable is a transmission media. Transmission media refers to the physical path or medium used to transmit data between devices. It can be divided into two parts: Guided Media and Unguided Media. In guided media, the signal is contained within the physical limits of the transmission mediu
4 min read
What is Coaxial Cable ?Coaxial cable is typically used by cable operators, telephone companies, and internet providers to transmit data, video, and voice communications to customers. Its installation and implementation are easy but it is less efficient than optical fiber also it provides moderately low bandwidth in compar
6 min read
Fiber Optics and TypesFiber Optics or Optical Fiber is a technology that transmits data as a light pulse along a glass or plastic fiber. An Optical Fiber is a cylindrical fiber of glass that is hair-thin in size or any transparent dielectric medium. The fiber which is used for optical communication is waveguides made of
6 min read
Difference between Twisted pair cable, Co-axial cable and Optical fiber cableA computer cable is a medium used to transmit data between devices such as computers, servers, routers, and switches. Cables physically connect these devices, enabling them to communicate within a network. In computer networking, it is very important to know the distinctions between the different ty
8 min read
Radio WavesRadio waves are a special type of energy that travels through space, carrying information without needing wires. They have the longest wavelengths in the electromagnetic spectrum, meaning they stretch out much farther than other waves like visible light or X-rays. These waves can be incredibly long,
9 min read
Infrared light for TransmissionInfrared light for Transmission :Infrared is the frequency of light that is not visible to the eyes .The frequency of the waves lies between three hundred gigacycles to four hundred THz. In this, the radiation is in the region of the electromagnetic spectrum . Infrared could be a communication mediu
3 min read
Difference between Guided and Unguided MediaNetwork media or transmission media refer to the physical pathways through which data is transmitted from one device to another within a network. These ways can be wired or wireless. The selection of media depends on factors like distance, speed, and interference. In this article, we will discuss th
4 min read
Error Detection and Correction
Channelization