Answer the question
In order to leave comments, you need to log in
How to make iptables restore rules after reboot?
In general, there is a machine on CentOS 7, put iptables on it. Usually iptables restored the rules from the /etc/sysconfig/iptables file, as it did in CentOS 6, but in this case it was a fiasco.
Answer the question
In order to leave comments, you need to log in
In CentOS 7, this is done a little differently. If you want to return the ability to do as it was in version 6, then run the following commands:
systemctl disable firewalld
yum install iptables-services
systemctl enable iptables
service iptables save
Install iptables-persistent
#service iptables-persistent
Usage: /etc/init.d/iptables-persistent {start|restart|reload|force-reload|save|flush}
I did this:
/etc/network/interfaces:
...
post-up /etc/network/rules.sh
...
/etc/network/rules.sh:
#!/bin/sh
/sbin/iptables - A POSTROUTING -t nat -s 192.168.3.0/24 -o eth0 -j SNAT --to-source ...
...
I'm on ubuntu from /etc/rc.local running a script with iptables settings
servise iptables save
cp iptables iptables.bak
#отредактировал как надо
servise iptables restart
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question