LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   iptables flushed unexpectedly (https://www.linuxquestions.org/questions/linux-networking-3/iptables-flushed-unexpectedly-653839/)

jwhitehead 07-06-2008 12:20 AM

iptables flushed unexpectedly
 
Hi all,

I'm running 2.6.20-1.2320.fc5. I've setup an iptables transparent proxy to filter through Squid and Dansguardian, as below:

Code:

# Variables
EXT_CONN=eth0
INT_CONN=eth1

# Bridge external connections from external network card to internal
iptables -F -t nat
iptables -A POSTROUTING -t nat -o $EXT_CONN -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

#Allow port 8080 (Dansguardian) to receive connections
iptables -A INPUT -i $INT_CONN -p tcp --dport 8080 -j ACCEPT
# Redirect port 80 to Dansguardian (port 8080)
iptables -t nat -A PREROUTING -i $INT_CONN -p tcp --dport 80 -j REDIRECT --to-port 8080

And afterwards, when I run iptables -L -t nat, the listing looks as below, and works as expected, forwarding packets from 80 to 8080.

Code:

Chain PREROUTING (policy ACCEPT)
target    prot opt source              destination
REDIRECT  tcp  --  anywhere            anywhere            tcp dpt:http redir ports 8080

Chain POSTROUTING (policy ACCEPT)
target    prot opt source              destination
MASQUERADE  all  --  anywhere            anywhere

Chain OUTPUT (policy ACCEPT)
target    prot opt source              destination

But after a few minutes (haven't been able to determine exactly), the PREROUTING appears to get flushed, and iptables -L -t nat looks as below, and packets are no longer forwarded from 80 to 8080, but as you can see the masquerading is still configured:

Code:

Chain PREROUTING (policy ACCEPT)
target    prot opt source              destination

Chain POSTROUTING (policy ACCEPT)
target    prot opt source              destination
MASQUERADE  all  --  anywhere            anywhere

Chain OUTPUT (policy ACCEPT)
target    prot opt source              destination

I'm guessing something else is running on this server that might be emptying the PREROUTING listing. Any ideas, as there isn't that much running on this server. Or thoughts as to debug this? Thanks.

Mr. C. 07-06-2008 12:37 AM

Is your network interface bouncing ?

Search your /etc directory for all scripts that call iptables.


All times are GMT -5. The time now is 12:27 PM.