![Texas TMS320C6000 Programmer'S Reference Manual Download Page 198](http://html.mh-extra.com/html/texas/tms320c6000/tms320c6000_programmers-reference-manual_1093844198.webp)
NAT Operation
B-5
Network Address Translation
When HR receives the packet, it checks the NAT entry table for an entry with
a Mapped Port value equal to the destination port of the packet (in this case
50001). The value of Protocol and the source IP address/port values must also
match the Protocol, Foreign IP, and Foreign Port fields of the NAT entry. This
helps ensure that the reply is from the desired server.
Here, HR finds the entry and proceeds to modify the packet. It replaces the
destination address/port with the “local” address/port stored in the entry. It also
resets the timeout of the entry. After modification, the packet would be ad-
dressed as follows:
Packet 2 (modified)
To
From
Protocol
192.168.0.32 : 1001
64.1.1.100 : 80
TCP
Once a connection is established, the timeout of the entry is set quite high (say
five hours). This is because TCP connections can stay connected for an indefi-
nite period of time without exchanging any packets.
If H2 attempts to connect to the same host simultaneously, there is no problem
sharing the public IP address assigned to HR. For example, H2 sends a con-
nection request to IH addressed as follows:
Packet 3
To
From
Protocol
64.1.1.100 : 80
192.168.0.33 : 1024
TCP
HR would not find a NAT entry for 192.168.0.33:1024, so it would create one:
NAT Entry Table
Foreign IP
Foreign
Port
Local IP
Local
Port
Mapped
Port
IP Protocol
TCP State
Timeout
64.1.1.100
80
192.168.0.33
1024
50002
TCP
SYNSENT
00:01:00
64.1.1.100
80
192.168.0.32
1001
50001
TCP
CONNECT
04:59:23
The modified packet and its reply would proceed similar to packets 1 and 2.
Packets that pass from the LAN to the WAN are searched based on Local IP
combined with Local Port. Packets that pass from the WAN to the LAN are
searched based on Mapped Port. Note that for all entries on the NAT entry
table, these values are unique.