X
X
Xoseo2016-04-27 10:26:39
linux
Xoseo, 2016-04-27 10:26:39

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

5 answer(s)
Y
Yoh, 2016-04-30
@Xoseo

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

O
O. J, 2016-04-27
@OrlovEvgeny

Install iptables-persistent

#service iptables-persistent 
Usage: /etc/init.d/iptables-persistent {start|restart|reload|force-reload|save|flush}

Y
Yuri Chudnovsky, 2016-04-27
@Frankenstine

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 ...
...

J
Janus74, 2016-04-27
@Janus74

I'm on ubuntu from /etc/rc.local running a script with iptables settings

A
Anton Nagaets, 2016-04-27
@gr1mm3r

servise iptables save
cp iptables iptables.bak
#отредактировал как надо
servise iptables restart

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question