Question about iptables in edgy

Andreas andreas at tiddelipom.com
Mon Feb 26 19:56:10 UTC 2007


The enigma wrote:
> This is probably a silly question, but I'm rather new to Linux. Does
> iptables file start by default with Ubuntu edgy? I just configured a
> simple firewall called lokkit, and I checked to see if the chain entry
> took, and it did. Now I just want to know by starting my machine,
> booting into gnome desktop, does the iptables file configure the chains
> within the boot routine by default, or do I have to set up a command,
> like in the menu.lst file in grub, to use the iptables upon boot up. I
> know, I know.. I don't really need a firewall, and lokkit is not the
> most secure, I have a stand alone machine connected to a high-speed ISP.
> I'm just slightly, the paranoid type (probably from using Windows all
> these years).
> Thanks
>   
There are probably a couple of ways to do it, but I do it like this:

First add some stuff to the firewall script so you can start and stop it 
with with start/stop input command.
#!/bin/sh

case "$1" in
start)
/sbin/iptables -A INPUT bla bla bla
The rest of your iptables goes here
;;
stop)
/sbin/iptables -F
;;
esac

Make it executable
chmod +x lokkit

Now you can start your iptables firewall with /path/to/lokkit start and 
stop it with /path/to/lokkit stop.

Copy the firewall script to /etc/init.d.
cp /path/to/lokkit /etc/init.d

Then make a symbolic link from the script to the runlevels so it starts 
automagically when you boot linux.
cd /etc/rc2.d
ln -s /etc/init.d/lokkit /etc/rc2.d/lokkit
cd /etc/rc3.d
ln -s /etc/init.d/lokkit /etc/rc3.d/lokkit
cd /etc/rc4.d
ln -s /etc/init.d/lokkit /etc/rc4.d/lokkit
cd /etc/rc5.d
ln -s /etc/init.d/lokkit /etc/rc5.d/lokkit

Now it starts the iptables firewall when you boot linux. You can stop 
it, if you want to, with /etc/init.d/lokkit stop.
Start it again with /etc/init.d/lokkit start.

Hope this helps you a bit.

/Andreas




More information about the ubuntu-users mailing list