Anonymous Anonymous

Basic and simple iptables configurations for home users

Tuesday, 12 de June del 2007
filed under , ,

OpenBSD has been always my prefered distribution when I have to install a firewall based on a *NIX machine. The PF rules are what I am used to see. But last year I had to write several configurations for a debian machine using iptables which I am not really used to. Since I tend to forget these things, I paste here a basic configuration, if you want to use it, paste this in your desired starting script.

Configuration #1: Basic firewall accepting web, ssh and ftp

#delete tables
iptables -F
iptables -X

#default policies
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

#Accept loopback
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -i lo -j ACCEPT

#Keep State for already stablished traffic
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#Serveis que permetem (web,ssh,ftp,icmp):
iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
iptables -A FORWARD -p tcp --dport 22 -j ACCEPT
iptables -A FORWARD -p tcp --dport 21 -j ACCEPT
iptables -A FORWARD -p icmp -j ACCEPT
#Pings to firewall:
iptables -A INPUT -p icmp -j ACCEPT

Configuration 2: Only pings to firewall

#delete tables
iptables -F
iptables -X

#default policies
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

#Keep State for already stablished traffic
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

#Pings to firewall:
iptables -A INPUT -p icmp -j ACCEPT

Was this post interesting?

Related posts

Leave your comment

Leave your comment
You need javascript to be activated on irder to leave comments

Login in OboLog, or create free blog if you don't have one yet.

Then we'll remember your data and show your avatar in your comments.

Sponsors

Comments

How to play MP3 with Ubuntu (alombarte)
Pues diría que no ;)...(20 Aug)
How to play MP3 with Ubuntu (leonardocipet)
...(20 Aug)
How to play MP3 with Ubuntu (leonardocipet)
Ya voté...(20 Aug)
How to play MP3 with Ubuntu (alombarte)
That was a post of the year 2006. I think that the new version of Ubuntu comes with mp3 support a...(16 Aug)
How to play MP3 with Ubuntu (ben)
hi, suppose I got no internet on the computer i wanna play mp3  with? what f...(14 Aug)

Login