Today, I leanred about the NAT: network address translation.
Why there is a NAT in the real world??
- Motivation: what is the problem?
- Number of IP addresses required in the internet is much more than the 4 billion available IP addresses.
- If a subnet grows larger than the ISP's IP address range, no IP address will be available for them.
- Solution:
- IPv6: larger IP address, more number of IP addresses
- Private networks with NAT: The assigned IP addresses are privately defined only in the LAN.
- Different LANs may use the same range of IP address (192.168.0.0/16), but they are distinguished because they are defined in seperate LANs.
This is the picture how NAT works in real world.
So, the local network sues only one IP address as far as outside world is connected (NAT router address):
- Range of addresses not needed from ISP: only one IP address for the router's interface connected to IPS.
- Can change addresses of devices in private LAN without notifying outside world.
- Can change ISP without changing addresses of devices in local network.
- Devices insdie private LAN not explicitly addresssable(visible) by outside world (a security plus).
This is one example of specific process of NAT.
In this picture, LAN's router translate the Public IP address to Private IP address. Or, it can be reversed.
Gateway in router also change the port number to send the IP address to destination.
In conclusion, port number should be changed to get to the destination!
Let's do examples!
In this example, private network is 192.168.0.0/16, Src: 192.168.0.101, 4300 and destination: 243.36.165.74, 25.
Router public IP address: 31.45.26.37, given port: 6200.
And this is my answer. In LAN's router, there are two sides: WAN side address and LAN side address.
In the table, our Private IP and port should be 192.168.0.101 / 4300. The other side for Public IP and Port
should be 31.45.26.37 / 6200 to get to our destination: 243.36.165.74.
Next example help you understand to filll the NAT translation table.
'Computer Science ๐ > Network Programming ๐ฐ๏ธ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
LAN address & APR (0) | 2023.04.20 |
---|---|
IP address vs MAC address (0) | 2023.04.19 |
DNS(1), Apr/12/2023 (0) | 2023.04.13 |
HTTP(3), Apr/11/2023 (0) | 2023.04.12 |
HTTP(2), Apr/11/2023 (0) | 2023.04.12 |