Set up IPtables Firewall

https://help.ubuntu.com/community/IptablesHowTo

set up your rules:

1.As 1st rule (INPUT 1) allow all traffic on loopback adapter lo (so your programs on localhost can communicate if all other traffic is blocked later)

sudo iptables -I INPUT 1 -i lo -j ACCEPT

2.Allow incoming traffic on port 80:

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

3.Block all other traffic:

sudo iptables -A INPUT -j DROP

list the rules

sudo iptables -L

save the firewall rules to /etc/iptables.rules

sudo sh -c "iptables-save > /etc/iptables.rules"

change /etc/network/interfaces to automatically load the rules before network adapters are set up:

auto eth0
iface eth0 inet dhcp
  pre-up iptables-restore < /etc/iptables.rules
  post-down iptables-save -c > /etc/iptables.rules

GUI configuration using Firestarter

sudo aptitude install firestarter

run with

sudo firestarter

documentation: http://www.fs-security.com/docs/preferences.php

Comments