Firewalls are used to establish a controlled link between an internal network and the internet while protecting the internal network from external attacks. There are three main types of firewalls: packet-filtering routers which filter packets based on header information; application-level gateways which use proxy servers to establish connections and filter at the application layer; and circuit-level gateways which monitor TCP handshaking and filter at the session layer. The document then provides details on the design, characteristics, advantages, and disadvantages of each type of firewall.