Ready to Start Your Career?

Testing Your Linux Firewall Configuration

Falko 's profile image

By: Falko

September 23, 2015

Testing Your Linux Firewall Configuration - Cybrary

At, it's all about security and penetrating. I've decided to write this little guide for testing your own firewall configuration.

We're going to use Firewall Tester (FTester) tool. Important: this tool is now outdated. However, I find it still useful and nice to use for beginners.

The Firewall Tester (FTester) is a tool designed for testing firewall filtering policies and Intrusion Detection System (IDS) capabilities.

The tool consists of two perl scripts, a packet injector (ftest) and a listening sniffer (ftestd). The first script injects custom packets, defined in ftest.conf, with a signature in the data part while the sniffer listens for such marked packets. The scripts both write a log file which is in the same form for both scripts. A comparison of the two produced log files (ftest.log and ftestd.log) outlines the packets that were unable to reach the sniffer due to filtering rules if these two scripts are ran on hosts placed on two different sides of a firewall. Stateful inspection firewalls are handled with the 'connection spoofing' option. A script called freport is also available to automatically parse the log files.

Using the tool is not a completely automated process, ftest.conf must be crafted for every different situation. Examples and rules are included in the attached configuration file.

The IDS (Intrusion Detection System) testing feature can be used either with ftest only or with the additional support of ftestd for handling stateful inspection IDS, ftest can also use common IDS evasion techniques. The script can also process snort rule definition files.


  • firewall testing
  • IDS testing
  • simulation of real tcp connections for stateful inspection firewalls and IDS
  • TCP connection spoofing
  • IP fragmentation / TCP segmentation
  • IDS evasion techniques


The following perl modules are required: Net::RawIP, Net::PcapUtils, NetPacket

# perl -MCPAN -e "install Net::RawIP"# perl -MCPAN -e "install Net::Pcap"# perl -MCPAN -e "install Net::PcapUtils"# perl -MCPAN -e "install NetPacket"


Luckily, FTester is still available for download, so ..

# wget

After extracting the tool, we can focus on using it. This is the difficult part, as the tool has to be configured before one can use it. The basic syntax of configuration file is:

TCP and UDP packets: Source Address:Source Port:Destination Address:Destination Port:Flags:Protocol:Type of Service

ICMP packets: Source Address:Source Port:Destination Address:Destination Port:Flags:ICMP:icmp_type:icmp_pre

For example:

# SYN packet to port 80

# UDP packet

Stop signal is needed for the service to be stopped after test is complete:


Everything has to be written in “ftest.conf” file. As the file already contains some examples, comment out those you won’t need.

We can use for our test following configuration:

# checking privileged ports (<1025)

# checking proxy port


After saving our configuration file, first of all we have to start a daemon:# ./ftestd -i eth0

Then we can run the test:# ./ftest -f ftest.conf

After the completion of test, we use the ftest binary to compare logs:# ./freport ftest.log ftestd.log

The result is something like:

Authorized packets:


21 - > S TCP 0

22 - > S TCP 0

23 - > S TCP 0

25 - > S TCP 0

80 - > S TCP 0

110 - > S TCP 0

113 - > S TCP 0

1027 - > PA TCP 0

Modified packets (probably NAT):


443 - > S TCP 0

443 - > S TCP 0

Filtered or dropped packets:


1 - > S TCP 0

2 - > S TCP 0

3 - > S TCP 0




1026 - > S TCP 0

Thanks for reading this!

Schedule Demo