What should I do if centos7 cannot find iptables?

藏色散人
Release: 2022-01-11 11:38:42
Original
4663 people have browsed it

centos7 cannot find the solution to iptables: 1. Write an iptables command to configure the firewall rules; 2. Save it through service iptables save; 3. Execute the service iptables restart command to restart.

What should I do if centos7 cannot find iptables?

The operating environment of this article: CentOS 7 system, Dell G3 computer.

What should I do if centos7 can’t find iptables?

Can’t find the iptables file under centos7?

Recently, to build an ftp service under centos7, follow the instructions Step by step, I found that the file etc/sysconfig/iptables did not exist, and then looked for a solution,

Solution:

1. Just write an iptables Command to configure a firewall rule. Such as: iptables -P OUTPUT ACCEPT.

[root@iZ23gx7o02aZ /]# cd /etc/sysconfig/
[root@iZ23gx7o02aZ sysconfig]# iptables -P OUTPUT ACCEPT
Copy after login

2. service iptables save to save.

[root@iZ23gx7o02aZ sysconfig]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@iZ23gx7o02aZ sysconfig]# ls
atd         firstboot         iptables-config  networking       readonly-root  sshd
auditd      grub              irqbalance       network-scripts  rhn            sysstat
authconfig  htcacheclean      kdump            ntpd             rngd           sysstat.ioconf
cbq         httpd             kernel           ntpdate          rsyslog        system-config-firewall
clock       i18n              keyboard         prelink          sandbox        system-config-firewall.old
console     init              modules          quota_nld        saslauthd      udev
cpuspeed    ip6tables-config  netconsole       raid-check       selinux
crond       iptables          network          readahead        smartmontools
[root@iZ23gx7o02aZ sysconfig]#
Copy after login

3. Use the service iptables restart command to restart:

[root@iZ23gx7o02aZ sysconfig]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@iZ23gx7o02aZ sysconfig]#
Copy after login

But when performing a save operation using service iptables save, it prompts that the save command does not exist, so I continue to look for a solution,

First, regardless of whether the firewall is disabled, use systemctl stop firewalld to turn off the firewall

Then use yum install iptables-services to install or update the service

Then use systemctl enable iptables to start iptables

Finally systemctl start iptables Open iptables

Done

Tryservice iptables save

Recommended tutorial: "centos tutorial"

The above is the detailed content of What should I do if centos7 cannot find iptables?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!