Firewalls and NAT
It all about what you do with an IP packet, generally using its TCP or UDP port number.
Extended reading references for NAT
RFC 2663:
IP Network Address Translator (NAT) Terminology and Considerations
RFC 3022:
Traditional IP Network Address Translator (Traditional NAT)
NAT (Wikipedia)
PAT (Wikipedia)
How NAT Works
from Cisco
Description of NAT and how it impacts your online experience
from Microsoft
Extended reading references for Firewall
Firewall (Wikipedia)
How Firewalls work
Cisco PIX Firewall Software Configuration Guides
iptables for oteen.cs.unca.edu