NAT Operation
B-4
When the router HR receives this packet, it searches for a NAT entry that
matches the From address of the packet. Since this is the first packet, assume
the table is empty. When no entry is found, (skipping proxies for now) the router
will create a new entry. It does this by recording information from packet 1, as
well as picking a new port value from its own pool that has been specifically
reserved for NAT (assume the range is 50000 to 55000, and that it chooses
50001). The new port is used as the packets source port. The NAT entry record
would look like the following:
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.32
1001
50001
TCP
SYNSENT
00:01:00
The Local IP and Local Port values are those that are local to hosts on the
home LAN. The Foreign IP value is the foreign side of the connection as
viewed by hosts on the home LAN. The Mapped Port value is the source port
when the packet is sent from HR. The source IP address used in the packet
is that assigned to HR by the ISP. The IP protocol of the packet is recorded,
and when using TCP, the state of the TCP connection is tracked to establish
a reasonable timeout value. The SYNSENT value indicates that a connection
request was sent. Before a full connection is established, the timeout is set fair-
ly low – say 1 minute.
As the packet is transmitted from HR to the ISP, it would look like the following:
Packet 1 (modified)
To
From
Protocol
64.1.1.100 : 80
128.1.2.12 : 50001
TCP
When IH receives the packet, it believes that the connection request came
from HR. It thus sends the response packet to HR. The packet would be ad-
dressed as follows:
Packet 2 (response to packet 1)
To
From
Protocol
128.1.2.12 : 50001
64.1.1.100 : 80
TCP