Filtering of ports and system service calls on a single computer operating system

8.9. Packet Filtering Implementations for General-Purpose Computers

These days, a number of operating systems provide packet filtering features, independent of firewall products. Many Unix variants come with packet filtering, as does Windows NT.

There are two major reasons why you might want to use packet filtering implementations on general-purpose computers. First, you may want to use a general-purpose computer as a router (either providing only packet filtering, or as a single-box firewall that provides both packet filtering and proxying). In this case, you are using the general-purpose computer to provide the same sort of packet filtering services that a router would provide. Second, you may be using the general-purpose computer as a bastion host, and you may want to use packet filtering on the computer as a security measure to protect the computer itself.

Earlier Linux kernels used a filtering system called ipfw (which was a port of a BSD filtering system) and a configuration utility called ipfwadm. ipchains is a new filtering system, which provides more functionality than ipfw. ipchains allows you to convert configuration files from ipfwadm to ipchains.

The filtering performed by ipchains is done entirely in the kernel, and it requires only a single external utility to initialize the filtering rules. This means that it is possible to build a complete Linux filtering system that will fit on a single 1.44 MB floppy disk. The Linux Router Project is doing exactly this (see Appendix A, "Resources", for more information about the Linux Router Project).

Linux also has a facility called masquerading, which is used with ipchains to provide network address translation for both TCP and UDP. Masquerading keeps track of TCP connection state and supports timeout-based UDP requests and responses. Because it must be used with packet filtering, it can be considered a dynamic packet filtering system. In addition to providing straightforward network address translation for simple TCP and UDP protocols, Linux masquerading allows additional kernel modules to be loaded for more complicated protocols (for instance, FTP and RealAudio, which require reverse TCP connections or additional UDP ports).

8.9.1.1. ipchains

ipchains is designed around the concept of a chain of rules. Each rule specifies a condition and an action to take if the condition is met, called a target. The rules in a chain are used in order; a packet is checked against each rule in turn, and if the packet matches the condition, the specified action is taken.

There are three standard chains, called the input, output, and forward chains. All packets coming in to the machine are passed through the input chain, and all packets going out of the machine are passed though the output chain. The forward chain is used for packets that need to be sent to a different network interface from the one they were received on. Thus, if a packet is received for the machine, it's matched against the input chain; if the machine generates a packet, it's matched against the output chain. If the machine is acting as a router and gets a packet addressed to some other machine, the packet will be matched against all three chains.

The standard chains each have a default policy, which is applied when no rules match. It is also possible to create additional, user-defined, chains. If no rules match when checking a user-defined chain, processing will continue at the point where the chain was called.

The conditions in a rule can be based on any of the following:

  • The IP protocol number (e.g., TCP, UDP, ICMP, or IGMP).
  • The source and destination IP addresses. Addresses can be specified as a variable-length subnet (e.g., 192.168.8.0/22) or a network address with a mask, and negation is allowed (you can specify "all addresses except those that match this address and mask").
  • The source and destination TCP and UDP port numbers. Port numbers can be specified with ranges or masks, and negation is allowed.
  • The ICMP type and code.
  • Whether the packet is an IP fragment.
  • Whether the packet is a TCP start-of-connection packet.

  • The network interface. This is the interface the packet came in on for the input chain and the destination interface for the output and forward chains.

Each rule in a chain has a target action that is applied when the rule matches. The target of a rule decides what next happens to a packet. The allowed targets are:

  • Deny: Drop the packet without generating a response.
  • Reject: Don't process the packet, but generate an ICMP response (which will be passed though the output chain).
  • Accept: Process the packet.
  • Masq: Perform masquerading. This target is only valid in the forward chain.
  • Redirect: Forward the packet to a different port on the local machine.
  • Return: Apply the default policy for a built-in chain or continue processing at the point where a user-defined chain was called.
  • A user-defined chain.

Because a user-defined chain can be the target of a rule, it is possible to build complex filters or make ipchains behave like other packet filtering systems.

A rule can also make a log entry, which contains information about the action that was taken, the time, and a summary of the packet headers. Logging is performed by syslog.

Which firewalls filters ports and system service calls on a single computer operating system?

Reverse Proxy Server– placed in front of web servers, reverse proxy servers protect, hide, offload, and distribute access toweb serversNetwork Address Translation (NAT) Firewall– hides or masquerades the private addresses of network hostsHost-based Firewall– filtering of ports and system service calls on a single ...

Which of the following firewalls filters traffic based on source and destination data ports and filtering based on connection States?

The packet filtering firewall filters IP packets based on source and destination IP address, and source and destination port.

Which of the following firewalls filter traffic based on application program or service?

Proxy firewalls, also known as application-level firewalls, filter network traffic at the application layer of the OSI network model.

What are the 3 types of firewalls?

Firewall delivery methods.
Hardware-based firewalls. A hardware-based firewall is an appliance that acts as a secure gateway between devices inside the network perimeter and those outside it. ... .
Software-based firewalls. A software-based firewall, or host firewall, runs on a server or other device. ... .
Cloud/hosted firewalls..