Intro to Firewalling

User documentation

  • Last Updated: 01/05/2022

As you may have noticed in the static routing lab, a true router will accept any and all packets and forward them wherever it sees fit. This creates security problems because it allows an intruder to point a static route to your hub and access your entire network. We use firewalls to fix this problem.

Functions of a Firewall

A firewall-only appliance only does packet filtering, but they can also contain other functionality such as:
  • Network address translation
  • Traffic monitoring
  • Basic routing
  • DHCP server
  • DNS resolver
  • VPN server

For the firewalling lab, we will be discussing NAT, DHCP, DNS, and packet filtering.

Packet Filtering

A packet filter is an application on a firewall that upon retrieval of each packet, runs them through a list of rules. These rules specify where packets can go and if they are allowed through the wall. If none of the rules are matched, the packet is dropped (blocked). In most scenarios, firewalls automatically block all traffic unless otherwise stated.

There are two main types of rules: pass and block. A pass rule defines which traffic to allow to pass through, and a block rule defines which packets to drop. Rules are put in a specific queue or order that they are applied in. So if a packet is originally given a block rule but a rule further down allows it through, the packet will still go through.

Some rules in firewalls are called quick. Quick rules and a binding rule that have no other options. If a quick rule applies to a packet, the packet will be either blocked or passed through right there, no matter what follows that rule. Even if your packet has a rule that should allow it, if there is a quick rule that blocks it before it, the packet will be blocked.

Remember that if you don't have any firewall rules, all packets will be dropped, stopping you from having any access to the firewall.

Packet filtering adds security to the network by blocking malicious traffic. You can block traffic to and from a specific source ip if you know that it is malicious.

For example, if you didn't want someone access Google, you can make a rule that blocks that traffic from coming into your network:

block out quick on $ext_if from any to

This is blocking any traffic that comes on our external interface from anywhere from access Google.

Network Address Translation (NAT)

As you know, your computer does not have a public ip. It has a private ip. NAT is what takes your private ip, maps it to your firewall's public ip, and allows it to communicate with the rest of the internet. You normally have multiple private ips on one public ip. When the website you're visiting sees your ip, it will see your public ip, not your private ip. For example, go to It will show your public ip.

Hosts on the outside only seeing your public ip is very good for security because it stops them from distinguishing individual PCs inside the network. This can sometimes be an issue when isolating a problem, however, because it becomes difficult to isolate an infected machine if they come off of the same public ip.


You already know a little bit about DHCP from the intro to KVM lab. As a refresher, DHCP gives machines a private ip whenever they are connected to your network. DHCP works the same way on firewalls; it just is consolidated into one unit instead of having to have a secondary dhcp server.

DNS Resolver

A DNS resolver takes DNS (domain name system) requests and checks if it knows what IP address the DNS query should resolve to.
In other terms, it turns urls ( to ips ( If it isn't located, it forwards that query to another DNS server, and that DNS server returns the appropriate address.

VPN Server

VPN (Virtual Private Network) Servers allow someone to join a private network while not being physically linked to that network. It allows a user to redirect their internet traffic to another source and use their public ip under your private ip, no matter where you are located. They allow one to "spoof" their location by going through a public ip in a different part of the world.