Here are instructions on how to change install APF Firewall for your VPS:

Install APF Firewall


Download and Install
----------------------
1. Download:
wget http://rfxnetworks.com/downloads/apf-current.tar.gz
2. Extract:
tar -xzvf apf-current.tar.gz
cd apf-X.X
(X.X = version, press TAB to view the downloaded version)

(You may need to patch the source to install APF under Ubuntu. [1])

3. Install:
./install.sh
4. Configure
cd /etc/apf
vi conf.apf
5. Important configuration Options
DEVEL_MODE="1" -- Leave DEVEL_MODE enabled until you are SURE that you have a working configuration. This option will flush/clear your firewall every 5 minutes, so if you lock yourself out, just wait 5 minutes and you can get back in
6. Config Options Specific to VPSLink VPS Systems
SET_MONOKERN="1" -- This option normally does not need to be enabled, BUT, on a VPS instance, it MUST be enabled (at least on CentOS4). Without this enabled, APF will complain that it can't find the iptables module and will abort immediately.

IFACE_IN -- Set to "venet0" or whatever you see in the output of the "ifconfig" command.

IFACE_OUT -- Same as IFACE_IN.
7. General Config Options
IG_TCP_CPORTS -- These are the INBOUND TCP ports you want to open. Separate the values with space, E.g. "22 80 443" would open SSH, HTTP, and HTTPS

IG_UDP_CPORTS -- These are the INBOUND UDP ports you want open. E.g. "53" if you run a DNS server.

EG_TCP_CPORTS -- These are the OUTBOUND TCP ports you want to open. By default, ALL outbound connections are allowed, but if you enable EGF="1", then outbound will be restricted as well. I highly recommend this for a more secure system.

EG_UDP_CPORTS -- These are the OUTBOUND UDP ports you want open. Same comment as above EG_TCP_CPORTS.
If you somehow still run into issues with this, please don't hesitatie to let me know!