[email protected] mysql / systemctl stop firewalld.service; [email protected] mysql / systemctl disable firewalld.service; Removed /etc/s...">

当前位置:网站首页>Install iptables services and open ports

Install iptables services and open ports

2022-06-12 08:27:00 Dyansts

1. solve firewalld

[[email protected] mysql]# systemctl stop firewalld.service;
[[email protected] mysql]# systemctl disable firewalld.service;
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[[email protected] mysql]# systemctl mask firewalld.service;
Created symlink /etc/systemd/system/firewalld.service → /dev/null.

2. install iptables-services

Note check yum Update :yum check update

yum -y install iptables-services
// To configure date file 
[[email protected] ~]# systemctl enable iptables;
Created symlink /etc/systemd/system/basic.target.wants/iptables.service → /usr/lib/systemd/system/iptables.service.
// Start the service 
[[email protected] ~]# systemctl start iptables;

3. Open ports

[[email protected] ~]# vim /etc/sysconfig/iptables
========================================================================
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8090 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
 among 443 Is an open port 

4. Restart the service

[[email protected] ~]# systemctl restart iptables.service
[[email protected] ~]# systemctl enable iptables.service

原网站

版权声明
本文为[Dyansts]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203010548411479.html