pfSense is an another type of protection for our vulnerable network. A modular router that can be customize base on your network needs. It has the ability to act as a router or a firewall, or even your cache server which means all your youtube, facebook, and other sites has being temporarily saved in a storage and soon if someone in your LAN access the same website it can instantly retrive or view without the irony of web page reload or to buffer the video again. That's why your internet might become faster
than your previous setup when you use pfSense. But dont worry with the right settings that suites your needs, your cache storage will not be full. Cache settings can be customized to overwrite cache objects if the disk are full, so that your browsing, and live streaming experience will not be affected. And the best of all, it is free because it is an opensource software.
Now this tutorial describes how to install PFSense and Lusca+Cache in Virtual Box. I prefer to use VirtualBox because I often use it for Virtualization.
First, you need to setup a pfSense Virtual Environment. Let say you have an existing network setup and you don't want to disrupt the current network connectivity. It's like you have this kind of setup.
Basic network setup, w/o pfSense |
In this case, pfSense is only an option. Use or not to use pfSense scenario. |
Or, you totally remove your traditional router and replaced by pfSense(Hardware Mode) |
But this time, we will only setup and configure the second one. The "optional" pfSense infrastructure. Since we have the existing network setup that we do not want to disrupt the existing network. And at the same time we just want to test it first before bringt it to production environment.
First, download pfSense-LiveCD-2.0.3-RELEASE-i386...iso
Note: latest pfSense build has a bug (I already test it), it happens after you install lusca-cache package the proxy server gui doesn't show. Thats why I stick to the version 2.0.3.
Now, setup a pfSense Virtual Machine in your VirtualBox,
Go to Settings, then Storage
You may notice that I have two virtual disk, which I will use as Primary Drive(8gb) for pfSense
and Secondary Drive(40gb) for Lusca-cache storage.
Then setup the network for WAN and LAN interface
Go to Network tab, then
Adapter 1 for your WAN Interface
- Set it Bridge Adapter where it Attached to
- Select your WAN Interface where the internet connection from your host machine is connected
- Click the small arrow to collapse the Advance section
- Set Promiscuous Mode to Deny to disallow packets in and out your host and virtual machine
- Tick the Cable connected check box, it should be in check state
- Then click OK
Adapter 2 for your LAN Interface
- Set it Internal Network where it Attached to
- Select your LAN Interface where the internet connection from your host machine is connected
- Click the small arrow to collapse the Advance section
- Set Promiscuous Mode to Allow VMs to allow packets in and out your virtual machines
- Tick the Cable connected check box, it should be in check state
- Then click OK
Then power on your pfSense virtual machine
Then the Installation Wizard appears, Select Accept these Settings
Select storage to install pfSense. Here we need to select ad0 for pfSense Installation
Select Format this Disk
Select Use this Geometry
Format ad0 disk
Then, Partition disk
Select Accept and Create
Select Yes, partition ad0
Press enter to select OK, to continue
Select Accept and Install Bootblocks
Select 1st partition to install pfSense
Select OK. WARNING! All data in primary partition will be deleted. Be sure you don't have important files in it. And you know what you are doing
Select OK to proceed
Now in partitioning we don't need to modify it just select Accept and Create
Wait until the installation has been completed
Select Symmetric multiprocessing... Then press enter
When you are back on the main install page, select Install pfSense then press enter
Now for lusca-cache we need select ad1 (40gb)
Select Format this Disk to format ad1 (40gb) storage for lusca-cache
Select Use this Geometry
Select Format ad1 to proceed formatting, then it will show a loading screen very quickly
Select Partition Disk
Select Accept and Create by using down arrow
Select Yes, partition ad1
The wizard will prompt you that the disk was successfully partitioned, then press enter to continue
Then it will want you to install bootblocks. You should just skip this step
Then select a Partition to format
The wizard will prompt you to that it will erase all data. Hit OK to continue
Then it will prompt you again that it was formatted
Then you need to delete the default swap partition
And change mount point to /var/squid/cache or /cache, its up to you where do you want to put the cache storage but be sure you are aware of that
Select Accept and Create to format the partition and begin the installation of pfSense
Because we deleted the swap partition and do not install pfSense, the installation will be confused and comes back with an error. But don't worry this is normal, you just need to proceed. Select OK to continue
Then press, Cancel
Press enter again to continue
At this point you need to keep on pressing Esc button or Select Return to Select task until you are back to the main install page.
Select 'reboot' and once its rebooted, then remove the CD
Skip vlan setup
Assign LAN interface, then select Y to enable DHCP on LAN, then if you asked for OPT1 then just press enter to continue
Then you should be asked if you want to proceed, just type y and press enter
At this point you are now in the main menu of pfSense which you have privileges to setup other features like enabling ssh (14). But for this instance, I need to change the LAN IP address of pfSense to 192.168.5.1. So I we need to type 2 for Set interface(s) IP address
Type number 2 to configure LAN interface
Type the LAN IP address you wish to specify, then press enter
Then type its subnet bit count, which is 24 = 255.255.255.0
Then enable DHCP server on LAN
Type the start address of client address range. Start = 192.168.5.100
Then type the end address of the client address range. End = 192.168.5.150
Type y to revert to HTTP as the webConfigurator
Now since you have setup the NICs and IP addresses now,
Now we will going to configure the pfSense using the web gui, Go to your Virtual Box Manager, select the appropriate client vm you will use to test your internet connection. In this instance I will be using Windows XP Service pack 3 for testing purposes. Then press Settings button
Then power on your Windows VM, then you should see from your Local Area Connection Status window, that Windows has been given an IP address of 192.168.5.100 by the pfSense LAN DHCP.
To do this, your Windows network connection should be set as obtain ip address from dhcp server.
Now we may configure pfSense, fire up your google chrome or any web browser you like, and type the default gateway(router) ip address which is the pfSense 192.168.5.1
Type admin as Username
and pfsense as Password
Then press enter to login
Then you should be redirected to the pfSense configuration wizard, click Next
Next, customized your Hostname and Domain name
Set your timezone. Then, click Next
Set your desired admin password and click Next
Then wait for it finishes loading configuration
Then after it loads, click the here link
Then you should redirected inside the pfSense web gui. where the Dashboard will be the default Main Page. Notice your WAN interface already acquired its IP address from your existing router.
Then test your internet connection.
Then lets mount the second disk. Go to your fpSense gui, press 8 on your keyboard to enter the shell where you can type in commands. We need to mount the second disk the ad1 to be use for lusca-cache storage.
Then, type newfs /dev/ad1s1a or
Replace the '/dev/ad1s1a' with the proper name of your hard drive and the slice on your hard drive
This should show on your screen
Then edit fstab by typing vi /etc/fstab or ee /etc/fstab and add the following lines:
/dev/ad1s1a /cache ufs rw 1 1
Press Esc to leave editor, and press enter
And press enter again to save changes
Then changes has been save successfully, now type mount -a to mount the cache drive
An error will show saying No such file or directory, so we just need to mkdir /cache to create new folder/directory to the root(/) directory
But if you type df -h you may see it is now mounted. It should look like this
fetch http://pfsense-cacheboy.googlecode.com/svn/trunk/script/package.sh && chmod +x package.sh && ./package.sh
Then, click Execute
You should see this message, informing you that it's done
Then go to System, Package Manager, and Click Available Packages
Press Ctr+F on your keyboard to search for lusca-cache
Then click the + button to add/install lusca-cache
Click OK to continue if you've been asked by Chrome to install it
When the installation successfully completed, it should look like this
Now go to Services, Proxy Server.
On the general tab, Tick the Transparent proxy check box
and Click save button below
Here on this tab, Select Hard disk cache system to coss + aufs.
Then modify Coss Hard disk cache size to 100 and for Hard disk cache size to 38000. It depends on your configuration of virtual machine specs like HDD space, since we have only 40gb cache storage we need to allocate 38000 in terms of mega bytes.
And for Hard disk cache location it would be /cache
Maximum object size, higher than you declared value would not be cached but lower than declared will be cached. Its up to you how many you want to allocate. But for this instance we will just allocate 1gb which is 1024mb for the Maximum object size
Then click save
Now, since I prefer to choose to increase the download speed I decide to set 6024 for Overall bandwith throttling.
Click Save to save the settings
Then Go to Status at the Main Toolbar then click on Services to start the service
Now what?
Go ahead and test it, if theres no changes in your internet performance you may tweak the settings and play with it freely until you achieve your satisfaction. But remember, you must think that there are many consideration that causes your internet connection to slow down, and I cannot list here one by one for this post is only about the subject.
thanks po sa tutor
ReplyDeleteYou forget "chown -R proxy:proxy /cache" and then "squid -z" to build the cache. this step after you type "mount -a" CMIIW :)
ReplyDeleteit does not work now. The link fetch http://pfsense-cacheboy.googlecode.com/svn/trunk/script/package.sh && chmod +x package.sh && ./package.sh does not downloads package and even the script has issues now. The URL in the package.,sh has chudy.0fees.net that does not work now.
ReplyDeletehi sir... i cant see lusca pakage when i execute this fetch http://pfsense-cacheboy.googlecode.com/svn/trunk/script/package.sh && chmod +x package.sh && ./package.sh
ReplyDeletebecause management full out of this packages it changes squid
DeleteSir pwede po mag tanung sir eto po fb ko https://www.facebook.com/JamesLoveCrisel
ReplyDeleteplease sir namomroblema kc ako sa internet
same here... no lusca package found
ReplyDeleteSorry this post is too old. But I will post new version of this post.
ReplyDelete