Testing Your Linux Firewall Configuration

September 23, 2015 | Views: 2812

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

At Cybrary.it, 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 http://dev.inversepath.com/ftester/ftester-latest.tar.gz

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!

Share with Friends
Use Cybytes and
Tip the Author!
Share with Friends
Ready to share your knowledge and expertise?
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play

Support Cybrary

Donate Here to Get This Month's Donor Badge

Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?