0

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?

0

/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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.