Kullanıcı1233
Kıdemli Üye
- 19 Tem 2011
- 4,371
- 12
Hi guys! In this topic, i'll try to answer some questions like 'what is NAT?', 'why is NAT needed?', 'how does it work?', and 'what are types of it?'.
What is NAT and Why is NAT Needed?
NAT stands for Network Address Translation. Count of people who wants to connect to internet increasing incrementally from the first day internet came out. IP addresses in unique internal and external networks, which were given to everyone in their first years, constitute today's main problem. This system has showed up with the decrease of IPv4 addresses, the idea that IPv4 addresses will run out soon and how we can slow this process down. Devices need an IP address to go on the Internet.
Private IP Addresses
Between 10.0.0.0 and 10.255.255.254
Between 172.16.0.0. and 172.31.255.254
Between 192.168.0.0 and 192.168.255.254
But you can't connect to external network. You'll need an public IP address. This is why you need NAT. It helps to re-map your IP address while you're going to external network (out internet) and
that way you're connected now. But how does it happen exactly? I'll try to explain it as simple as possible.
When you send a request to an external network, this request goes to eth0 network interface. And a record is kept about that request. After that an IP address is assigned by NAT and client can go to internet. When it connected to externet network, target server sends whole network traffic to NAT router. Nat changes its own IP address (private) before it sends (public). It transmits to target server and connection is done. That is what's happening briefly. Here is another advantage, it acts as a firewall in the middle of external and internal network. Nothing can go in or come out unless they've been authorized. It works on Network Layer 3.
Basic NAT
It just changes your IP address, doesn't map your ports on network.
Dynamic NAT
More than one IP addresses are taken on external network and they are matched with internal network's IP addresses. You can connect to external network with one external IP address with configuration processes but it'ld be better if you do that with multiple IP addresses. And 'how does it work' you asked? Client wants to go to internet, checks NAT cable. If target is static, it matches and transmits to target. But if it's not static, matching with available IP address from pool has to be done and then you can make connection.
Dynamic NAT Router Configuration
NAT Router
Kod:
version 12.3
ip nat pool test 172.16.131.2 172.16.131.10 netmask 255.255.255.0
!--- Refer to
ip nat pool
for more details on the command.
.
ip nat inside source list 7 pool test
!--- Refer to
ip nat inside source
for more details on the command.
ip nat inside source static 10.10.10.1 172.16.131.1
interface e 0
ip address 10.10.10.254 255.255.255.0
ip nat inside
interface s 0
ip address 172.16.130.2 255.255.255.0
ip nat outside
ip route 192.168.1.0 255.255.255.0 172.16.130.1
access-list 7 permit 10.10.10.0 0.0.0.255
OutsideA Router
Kod:
version 12.3
hostname outsideA
!
!
!
interface Serial1/0
ip address 172.16.130.1 255.255.255.0
serial restart-delay 0
clockrate 64000
!
interface FastEthernet2/0
ip address 192.168.1.1 255.255.255.0
speed auto
half-duplex
ip route 172.16.131.0 255.255.255.0 172.16.130.2
InsideA Router
Kod:
version 12.3
!
interface Ethernet1/0
ip address 10.10.10.1 255.255.255.0
half-duplex
!
ip route 0.0.0.0 0.0.0.0 10.10.10.254
!
!
To show ip nat translations
Kod:
NATrouter#show ip nat translations
PAT
PAT stands for Port Address Translation. PAT means devices in internal network connect to external network through assigned public IP address. The difference is internal network devices go to internet through multiple ports (1024 ile 65535) on public IP.
Overlapping
Overlapping networks result when you assign an IP address to a device on your network that is already legally owned and assigned to a different device on the Internet or outside network. Overlapping networks also result when two companies, both of whom use RFC 1918 IP addresses in their networks, merge. These two networks need to communicate, preferably without having to readdress all their devices.
Types of NAT
Full Cone NAT
It's a connection that a single port is always open. It transmits incoming request from external computer. It needs to be configured by network administrator to accept connections.
(Address) Restricted Cone NAT
The first rule in this kind of connection is client needs to be made a contact with you earlier.
As you can see, client 192.248.22.100 makes a contact with you first, after then you're matched through NAT and ready to data exchange.
Port-Restricted Cone NAT
It works same like Restricted Cone NAT. Only difference is earlier IP address is not enough, it needs also port info like IPORT.
Symmetric NAT
All requests sent from internal network go out to external network in the form of IPORT. Client needs to leave a message like IPORT to get the responding authority. Random source ports are created for each port.
Visualization:
Kod:
{NAT internal side} | {NAT external side} | {Remote machine}
| |
1. (INT_ADDR, INT_PORT) => [ (EXT_ADDR, EXT_PORT1) -> (REM_ADDR, REM_PORT1) ]
2. (INT_ADDR, INT_PORT) <= [ (EXT_ADDR, EXT_PORT1) <- (REM_ADDR, REM_PORT1) ]
...
3. (INT_ADDR, INT_PORT) => [ (EXT_ADDR, EXT_PORT2) -> (REM_ADDR, REM_PORT2) ]
4. (INT_ADDR, INT_PORT) <= [ (EXT_ADDR, EXT_PORT2) <- (REM_ADDR, REM_PORT2) ]
Original: https://www.turkhackteam.org/networ...lation-nat-nedir-ve-nasil-calisir-hacker.html
Translator: R4V3N