When devices communicate across the Internet they send messages to one another. These messages are similar to letters in that they have a ‘to’ address and a ‘from’ address. The ‘to’ address is the IP address of the device it wants to send the message to, and the ‘from’ address is the IP address (and port number) to send any return messages to.
One of the rules of private IP addresses is that they should never be seen on the Internet because theoretically millions of devices could share that IP address, and routing to a private IP address would not work.
Therefore, they need to be removed somehow when a device with a private IP is sending messages. The Network Address Translation (NAT) is the process of rewriting the addresses on a message before it is transmitted across the Internet, or indeed rewriting it after it has been received.
In order to keep track of everything, when the private IP and port number is overwritten, a record is kept of where the message goes. This is dynamic and the record is created when an outbound message is sent. Every now and then the record is deleted if it hasn't been used for some time.
This means that when a reply is received with the same details the incoming message can be rewritten and readdressed to the device that originally sent the message.
NAT allows numerous devices to share one IP address and the necessary process of rewriting and translating the address (routing) information as messages are sent and received from the Internet.
NAT and VoIP calls
VoIP calls primarily consist of two parts. NAT can cause problems for VoIP calls, the most common of which is one-way audio.
- Setting up the call, and then
- Transmitting the audio
Unfortunately, the transmitting of audio will happen on different ports to the ones used to set up the call. So if we remind ourselves about how NAT works, when a message is sent out, the router makes a record of the destination IP address and port.
When a reply is received from that exact location, it is compared against the record and the message can then be redirected to the original internal address.
This works fine for the first part of a VoIP call (setting up the call). However, when audio transmission begins it will use a different port. There is no record of a message to this IP address and specific port being used recently in the records, so the router doesn't know where to send the information. So it does the only thing it can do—it ignores it.
This means that your VoIP call has been set up without issue, but you won't hear the other person as the audio information doesn't get through.