nV News Forums


nV News Forums (http://www.nvnews.net/vbulletin/index.php)
-   Networking And Security (http://www.nvnews.net/vbulletin/forumdisplay.php?f=58)
-   -   PFSense (http://www.nvnews.net/vbulletin/showthread.php?t=161156)

Bman212121 04-01-11 09:58 PM

I've been wanting to upgrade my firewall for some time now and have thought about a few different options. I really wanted something a little bit beefer than a typical SOHO router and at the same time configurable, flexible, and has a nice UI. Things that I've considered are a Cisco ASA, untangle, pfsense, LinksysRVS4000 or a newer SOHO device with more features. I've played with a few of those and decided upon PFSense.

What I was seeking that I couldn't do before is better blacklisting of IPs, traffic logging, wan failover. PFsense can provide all of these after adding a few packages.

Installation of this box is relatively simple, you just need a pc with 2 network cards in it. There are a few versions of the software as you can use it on either a disk or diskless system. It is possible to load PFSense onto a thumb drive and have it run in memory and only write changes when needed. Since I'm using an old Althon X2 system I grabbed the pfSense-2.0-RC1-amd64 iso. The requirements for a typical setup only require a 1GHZ cpu at most so this rig is way overkill. If I had an old P4 system I could have used that instead. If you're interested in seeing what you might need check out the sizing list: http://www.pfsense.org/index.php?opt...d=52&Itemid=49

The first thing I would have to suggest after you install it is let it do the update. Since this is a RC build there are going to be lots of updates yet. When you are on the first page you'll see a link saying updates are available. In order to use the auto update you'll have to check a box to allow unsigned images since the images are not signed in beta. This is located under System > Firmware > updater settings. After that's out of the way then you can move on to other things.

One of the best features of PFSense would be the packages. There are several options to add more functionality to your firewall depending upon your needs. I've loaded Country Block, vnstat2, and widescreen.

Country Block:

Does exactly what it says on the label. What it does for you is give you an easy way to check which countries you want to block, and it has a listing of all of the IP ranges assigned to that country. They even include a Top spammers list to make it easier to block the worst offenders.


I really like this option as I've seen plenty of port scans all originating from China on my old router. Most of the scanning was on blocked ports but before I had no way to even block more than 1 subnet for a specific rule. Now I can block entire countries from being able to find open ports on my firewall. By default it just blocks inbound attempt but you can also block outbound traffic. This could prove to be very useful if you get a virus on a machine and it tries to phone home.

There are a few quirks with using this package however. Everytime you make a change it will stop the service, so you will need to enable it again. It doesn't auto start upon reboot and when you do a firmware update it loses the settings. You could manually backup the file on your system so you don't have to set it up again. It will take a bit of time to figure out which countries you'll want to allow. You can either do it by adding a whitelist entry to just a particular IP, or uncheck the country. One thing I might do in the future is try to get a better breakdown for the US as I can't turn that setting on, but I read that US is right up there with China with the amount of spam it produces.


What this package does for me is give really nice summaries of wan and lan usage on a daily, weekly, and monthly timeframe. I tried using bandwithd, and ntop but neither one worked right. If you want a realtime traffic graph PFSense provides this with RRD graph, so this is nice to have for totals.




This package is pretty simple, it's just there to allow the web interface to resize to fit a widescreen resolution.

Other Packages:

I can think of a few things that other people might use include: Squid, Free Radius, TFTP. By default PFSense already has support for VPNs using IPsec L2TP, OpenVPN and PPTP. I already have squid running on another box and would highly suggest using it if you were to setup a server. It's a web proxy that you can use to speed up your internet access. It will cache web pages and host them locally for your client to download. The difference is noticable using a decent connection and it can take a slow connection like a phone and make it seem incredibly faster.

Configuration for your PAT or NAT rules is quite simple. Here is a screenshot of the page:


You simply put in a starting port, the IP you want it forwarded to, and the internal port. If you want a single port just put in the starting port, if you want multiple then include an ending port. For the target port you just put in the lowest port number and PFSense will setup the range. By default this will also make a firewall rule. For those who are not familar with this type of setup I will explain it a bit.

There are the firewall rules which simply state allow or deny traffic to pass on a specific port on an interface. Then there are NAT rules which say take any traffic from a specific port and pass it to another computer on a specific port. On most SOHO routers when you create a rule it opens the port on the interface and passes the traffic to another comptuer. With PFSense it seperates these so you have the ability to make rules to block traffic on specific ports while still allowing other traffic to pass. For instance you can make a NAT entry to allow web traffic on port 80. On a SOHO router every computer on the internet would then be able to access your web server because all attempts would be passed through. With PFSense I only need a single NAT entry to allow the traffic to be forwarded, but now I can make rules to allow certain IP addresses to connect to it.

Once you setup the NAT entry you will see the associated rule under Firewall > Rules. There you can change who gets access, create another rule to block certain IPs from accessing it, and also turn on logging on a per rule basis. What I could do is setup a lower priority block all rule and enable logging on it. This will log any attempt made to that port that is not authorized. Then I create a higher priority allow rule with logging disabled so I don't fill up my log entries.

By default only the last 50 entries are stored. I have turned this up some and am working on finding a good syslog server to store the logs on. Right now I'm trying splunk but it seems kind of confusing. My other option I might try is Kiwi. Unfortunately logging is something that is kind of difficult to do effectively. It can be hard to sort through all of the logs. If you goto status > system logs you can see logs for the system, firewall, DHCP, and VPNs. What is really handy with the firewall logs is that if you're troubleshooting a blocked connection, there is a 1 click rule function. If you find the blocked attempt you can click on it and PFSense will generate a rule to allow that traffic for you. You can also do this in the opposite manor by creating a block rule for traffic that is passing which shouldn't.

One more thing that might be useful to some is the captive portal. It allows you to use a walled garden approach on your network. Any attempt to get to the internet will redirect the person to a login page. They will have to authenicate before they will be allowed to use your internet connection. This could be useful for setting up a wireless access point that only has internet access. Then when a friend wants to borrow your wireless you don't have to mess with configuring wifi. Just have them connect to your AP and login with a password.

A few random comments... You can enable SSH to your server if you'd like to get to the command line. Knowing a bit of linux will have it's advantage here as you can accidently lock yourself out if you do something wrong. By default there is an anti-lockout rule to allow traffic to pass on 22, 80, and 443 from the lan interface to the server. All inbound WAN traffic is blocked. While trying to create DHCP reservations I checked the box for static ARP. This only allows computers with an entry in the table to connect to the server. I didn't have any computers in the list yet so when I clicked save it locked out all computers from accessing the firewall. :eek: I had to goto the console of the server and get on the terminal (shell). From there I did cd /conf to get into the config directory. Then I used vi config.xml to open up the configuration file and remove the line that said <static arp/> Once I saved that change I rebooted the server and was allowed access again. After doing that I would definitely suggest anyone make a backup config file in the config directory in case you really mess something up where you can't restore a config from the web interface. To do this just log into the shell and change to the config directory. "cd /conf" Then run "cp config.xml config.xml.backup" This will make a copy of your config. If you need to restore the backup just do a "cp config.xml.backup config.xml" and that will copy from the backup file over the config. Then reboot the server and it should work again. This will at least save you a bit of hassle over completely resetting the firewall to factory defaults and having to reconfigure the IP addresses so you can get back into the web interface to restore a config.

Also what was a little different for me was when you create a DHCP reservation it needs to be outside of your IP range. On my old router it had to be within the range.

Overall it seems like it will be a nice solution. Honestly once it's setup there shouldn't be much need to login to the firewall and it should provide a little better protection for your network by allowing you to filter traffic more precisely. I haven't gotten a chance to test the load balancing as I don't have a wireless NIC or a usb wireless device. When I get one I'm going to try to set it up so that if the main connection goes down I can use a 3G connection from a phone as failover. I configured the server in a couple of hours and it was so simple it seems like I need to do more. Everything is pretty straight forward and the layout is clean and simple. There is a lot of information about what the box is doing you can look at, and it's really easy to see who's generating traffic.

six_storm 04-01-11 10:15 PM

Re: PFSense
Awesome thread man. Are you using this for your home network?

I bought a used Juniper Netscreen from one of my clients (they upgraded) for my home network and it was pretty awesome. It doesn't have the cool open source features like PFSense, but it's still a solid device.

I may have to test out PFSense when I get my old workstation back. Good read!

Bman212121 04-01-11 10:43 PM

Re: PFSense
Yea this is for home. What's nice about PFsense is that it is VM compatible so you can mess around with it in a virtual machine if you'd like. The hardware requirements are also so low that if you have any type of spare pc lying around it will probably run it.

While doing a little more research I also came up with 2 more things to add. If you goto firewall > traffic shaper you can do layer 7 filtering. (Layer 7 is the application layer, or the highest layer of the OSI model)


Here is an example of an easy way to filter out bittorrent traffic. This doesn't require traffic to be a a specific port to work, this will find any torrent traffic and block it. There are lots of other things in the list even including a few games like WoW.

I'd add to the list of packages HAVP which is an http antivirus client using ClamAV. It will scan files as they are streamed through the firewall.

TheTaz 04-03-11 08:50 AM

Re: PFSense
I was thinking about doing something similar (Atom ITX with 2 nics between my DSL modem and Wireless Router)... but I was going to use Untangle.

I'll have to check out PFSense since it also has modules like Untangle.

EDIT: After looking at PFSense's available packages... I think Untangle is closer to what I am trying to accomplish.

Here's a list of the Free Apps you can get with Untangle:

Bman212121 04-03-11 11:07 AM

Re: PFSense
Yea I originally thinking of doing Untangle + PFSense and have PFSense be the perimeter firewall then use untangle in bridged mode. After installing untangle I was really put off with the layout of the Web interface. I like to know exactly what each thing is doing and the way it was presented in Untangle wasn't what I was looking for.


What I don't like about it is that it just shows the modules and really doesn't provide any info. You can see that it's allowing or blocking traffic, but you don't know what is being blocked. If you can change the "rack" layout to show 2 or 3 important modules that show data that would be a lot more useful to me.

PFsense can do everything that is listed under Untangles Lite Package, which most of those things in the base installation. One thing that I do like about untangle is the Reporting. It seems like they have a much more clear view of their logs.


After looking through those it does make me want to attempt installing it again in bridge mode to see if I can use the logging from it. What I would do is just change the lan IP on my PFSense box to another network and Put the WAN interface of Untangle on that subnet. Then put the LAN interface of Untangle on the old IP of my LANs gateway. So if I had as PFsense's LAN IP I would to this:

PFSense LAN:
Untangle WAN:
Untangle LAN:

I could easily run Untangle in a virtual machine since I already have a firewall in place. I would just need to plug PFsense directly into the virtual server and then use a 2nd nic configured for the LAN.

TheTaz 04-03-11 03:48 PM

Re: PFSense

Originally Posted by Bman212121 (Post 2413977)
What I don't like about it is that it just shows the modules and really doesn't provide any info. You can see that it's allowing or blocking traffic, but you don't know what is being blocked. If you can change the "rack" layout to show 2 or 3 important modules that show data that would be a lot more useful to me.

...One thing that I do like about untangle is the Reporting. It seems like they have a much more clear view of their logs.


Uhm... each module has an "Event Logs" Tab. So you don't really need reports, but you can use that as well.

Look at the Web Filter Lite application screenshots... then go to the 8th screenshot. That shows the Event Log for that module. So Essentially from the "Gui Rack"... you click Settings on the module you want to look at... then the Event Log tab.

Q 04-03-11 04:16 PM

Re: PFSense
I've been running PFSense since early 2009. It's fantastic. Superb post.

six_storm 04-03-11 07:53 PM

Re: PFSense
I tried running Untangle in a VM but it would not run very well. Will have to try PFSense in a VM when I get some time.

All times are GMT -5. The time now is 02:36 AM.

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.