I need to enable NAT on my VM in iptables. I followed official debian instruction to configure it:
First of all, i created /etc/iptables.rules file with following content: *nat -A POSTROUTING -s 192.168.0.0/16 -o eth0 -j SNAT --to-source 18.104.22.168 COMMIT
After i use
iptables-restore < /etc/iptables.rules manually, nat rules are added fine, everything works
But when i try to autoload iptables rules via file
/etc/network/if-pre-up.d/iptables with following content eth interfaces disappear (i can see only loopback interface via ifconfig):
#!/bin/sh /sbin/iptables-restore < /etc/iptables.rules
I tried to do the same on debian wheezy and this was working. In debian jessie this does not work. Is it my mistake, or bug?
P.S. I tried to move iptables script to
if-up.d folder, eth interfaces are present in this case, but iptables rules are not applied.