LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using DNS in iptables (https://www.linuxquestions.org/questions/linux-newbie-8/using-dns-in-iptables-826538/)

linuxuser2010 08-16-2010 09:30 AM

Using DNS in iptables
 
I need to use hostnames in my iptables. When I go to restart iptables, it works fine but when I am rebooting the Linux server it fails during startup since the name service is started up after the iptables. Does anybody have recommendations to get around that? Should I set up a script to run the iptables after everything the server comes back up fully?

suprstar 08-16-2010 09:46 AM

Well, if you bring your network up before the firewall, then there's a small window of time where your network is wide open. You COULD bring up ip tables after the network is up, but it's probably bad practice to do so. If you were to do that, check the rc[345].d directory:

lrwxr-xr-x 1 root root 18 Jun 2 2008 S08iptables -> ../init.d/iptables
lrwxr-xr-x 1 root root 17 Jun 2 2008 S10network -> ../init.d/network

Those 'S' scripts are the things run at startup. They run in order from S00 - S99. You could rename the scripts

lrwxr-xr-x 1 root root 17 Jun 2 2008 S08network -> ../init.d/network
lrwxr-xr-x 1 root root 18 Jun 2 2008 S10iptables -> ../init.d/iptables

to force network to start first.

A better idea is probably to leave the scripts in the original order, and put required entries in /etc/hosts so iptables can resolve what it needs to.


All times are GMT -5. The time now is 03:40 PM.