In
<application>IPF
</application>, when a packet arrives at the
firewall from the
<acronym>LAN
</acronym> with a public destination, it first passes through the outbound rules of the
firewall ruleset. Then, the packet is passed to the
<acronym>NAT
</acronym> ruleset which is read from the top down, where the first matching rule wins.
<application>IPF
</application> tests each
<acronym>NAT
</acronym> rule against the packet's
interface name and source
<acronym>IP
</acronym> address. When a packet's
interface name matches a
<acronym>NAT
</acronym> rule, the packet's source
<acronym>IP
</acronym> address in the private
<acronym>LAN
</acronym> is checked to see if it falls within the
<acronym>IP
</acronym> address range specified in
<replaceable>LAN_IP_RANGE
</replaceable>. On a match, the packet has its source
<acronym>IP
</acronym> address rewritten with the public
<acronym>IP
</acronym> address specified by
<replaceable>PUBLIC_ADDRESS
</replaceable>.
<application>IPF
</application> posts an
entry in its internal
<acronym>NAT
</acronym> table so that when the packet returns from the Internet, it can be mapped back to its original private
<acronym>IP
</acronym> address before being passed to the
firewall rules for further processing.