E
E
Eugene M2018-12-24 00:21:17
CentOS
Eugene M, 2018-12-24 00:21:17

How to save a command in CentOS-7?

Every time you restart the server, you have to enter this command iptables -I INPUT -p tcp --dport 443 -j ACCEPTto make the site work over https. service iptables save not working in CentOS-7, how to save?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
CityCat4, 2018-12-24
@CityCat4

View /etc/sysconfig/iptables-config, parameters:

IPTABLES_SAVE_ON_STOP="no"
IPTABLES_SAVE_ON_RESTART="no"

It is clear that to save they must be set to YES
View /etc/sysconfig/iptables - this is actually a list of rules that are loaded at startup, add what you need, remove unnecessary

D
Dmitry, 2018-12-24
@q2digger

Firewalld came to CentOS 7 to replace the old iptables. If there is a strong desire to continue using iptables, you must
first disable firewalld ,

systemctl stop firewalld
systemctl mask firewalld

2.after that add iptables-services package
yum install iptables-services 
systemctl enable iptables-services

3. well, save your rules in /etc/sysconfig/iptables
iptables-save > /etc/sysconfig/iptables

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question