_Practical TCP/IP_, Niall Mansfield, Addison-Wesley, 2003
Motivation: control access to a subnet
Reverse traffic is a problem (response to connection request initiated from the inside) since those packets will be directed to an ephemeral port. Generally requires that all ports be open to non-SYN packets.
Connection request from inside to port 80 on port 1234.Firewalls and packet filters can both be programmed to allow incoming connection requests to certain ports and internal IPs. But a packet filter allows any type of packet (SYN, ACK, data) through based on this rule.
Pending connection entered into state table.
ACK from outside to port 1234.
ACK is expected and allowed to port 1234.
Unexpected packets are denied.
A firewall, in contrast, can filter out bogus packets that are not associated with an established connection. This defeats certain types of attacks where packets are sent without establishing a TCP connection.
For example, a ping from the inside can be tracked so that the ICMP responses to the ping are allowed through, whereas ICMP packets that arrive but are not part of a "session" are denied.
ALGs don't simply relay requests from outside. They take a request apart at the application protocol level and re-issue a request to a server on the inside if they are satisfied the request is safe and legitimate.
An ALG involves two distinct TCP connections: one from the outside client to the ALG, and another from the ALG to the server.
Examples:
FTP GET commands could be allowed while PUT commands are denied.HTTP requests to certain URLs could be filtered.
The semi-trusted LAN hosts servers (web, dns, etc) that the public needs to get to.
The trusted LAN hosts internal servers. Access from the semi-trusted to the trust LAN is via the firewall and is as restrictive as possible.