I'm currently using dnsmasq to create a small Debian box as a DHCP and DNS cache server. Until today, I had just 2 interfaces (eth0, eth1). One connected to my WAN (eth0) and one connected to my LAN (eth1) to distribute the ip.

In order to forward the traffic between the NIC I set-up my iptables like this:

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT

Then I used iptables-persistent to fix the rules.

I've installed a new NIC (eth2), configured dnsmasq so I now have 2 subnets. I added :

iptables --append FORWARD --in-interface eth2 -j ACCEPT

It works.
I cleaned /etc/iptables/rules.v4, reinstalled iptables-persistent but when I edit /etc/iptables/rules.v4 there is no trace of eth2 in the config file.

The thing is that it works, but what am I doing wrong?

1 Answer 1


/etc/iptables/rules.v4 is not updated when you issue an iptables command, you have to update it yourself like:

iptables-save > /etc/iptables/rules.v4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .