Firewall Types
Firewalls are frequently used to prevent unauthorized Internet users from accessing private networks connected to the Internet, especially intranets. All messages entering or leaving the intranet pass through the firewall, which examines each message and blocks those that do not meet the specified security criteria.
Packet Filter
Packet filtering inspects each packet passing through the network and accepts or rejects it based on user-defined rules. If a packet matches the packet filter rules the firewall will reject, discard it and send an error response or drop it, discard it without a response. Packet filters do not care if the packet is part of an existing connection and filtering occurs soley on the content of the packet itself, usually using a combination of source and/or destination IP address, its protocol and port number. This is a first generation firewall.
Advantages- It’s inexpensive (can be implemented as a router ACL).
- It’s fast and flexible.
- It is transparent to users.
- Access decisions are based only on address and port information.
- It has no protection from IP or DNS address spoofing.
- It doesn’t support strong user authentication.
- Configuring and maintaining ACLs can be difficult.
- Logging information may be limited.
Application Layer Firewall
An application (OSI layer 7) layer Firewall also known as a proxy based firewall can understand certain applications and protocols such as DNS, HTML and FTP. It can also detect whether a protocol is connecting to a non standard port. An application layer firewall may intercept all packets passing between applications dropping those packets which are not consistent with the application. This is a second generation firewall.
Advantages- Data packets aren’t transmitted directly to communicating hosts, thereby masking the internal network’s design and preventing direct access to services on internal hosts.
- It can be used to implement strong user authentication in applications.
- It reduces network performance because every packet must be passed up to the Application Layer of the OSI model to be analyzed.
- It must be tailored to specific applications. (This can be difficult to maintain or update for new or changing protocols.)
Stateful Inspection
Stateful inspection firewalls understand the context of the packet being filtered by keeping track of the connection information of data stream passing through it. This type of firewall operates at OSI layer 3, the network layer and is programmed to accept or reject packets based on the type of connection they match. Only packets that match a known connection stae will be allowed whilst others are rejected.
Advantages- Speed. (After a connection is established, individual packets aren’t analyzed.)
- Support for many protocols.
- Easy maintenance.
- Dependence on trustworthiness of the communicating users or hosts. (After a connection is established, individual packets aren’t analyzed.)
- Limited logging information about individual data packets is available after the initial connection is established.
Iptables
Iptables is an IP filter, so to understand how to use iptables one really must understand ip filters. An IP filter operates mainly in layer 2 of the TCP/IP stack. Iptables however has the ability to also work in layer 3, which most IP filters of today can. If the IP filter implementation strictly follows the definition, it would only be able to filter packets based on their IP headers namely source and destination address, protocol, etc. However, since the Iptables implementation is not perfectly strict, it is also able to filter packets based on other headers that lie deeper into the packet (TCP, UDP, etc), and shallower (MAC source address). A very good tutorial regarding iptables can be found :here
Advantages- The connection-tracking feature of IP Table is a very useful thing. It can be used to prevent most TCP hijackings for non-IP Masqueraded clients This functionality can also prevent attackers from injecting spurious ICMP packets for cracking and probing.
- Packets can now be matched based on MAC address, the local process's UID, Time To Live (TTL), or the rate of a class of packets being seend. These allow better detection and rejection of interlopers trying to inject packets or scan a system.
- Iptables has the ability to REDIRECT packets and has a generalized DNAT feature that allows arbitrary changing of the destination IP address and port number.
- To get logging, you must have two rules, one to match and LOG and one to match and DROP. This will not log the rule number that caused the logging.
- Packets being routed through the system (not from or to the system) are not processed by either of the INPUT or OUTPUT chains, only the FORWARD and NAT chains.
- IP Masqueraing (NAT) for many applications are not supported in IP Tables. These include games like Quake and Unreal Tournament, and services like Real Audio and ICQ.