Linux系統(tǒng)防火墻設(shè)置教程
Linux教程
2022-04-02 18:26
6879
為了安全,服務(wù)器最好開啟防火墻,開啟部分端口。下面是Linux系統(tǒng)防火墻設(shè)置教程
1.永久有效
開啟: chkconfig iptables on
關(guān)閉: chkconfig iptables off
2.即刻生效
開啟: service iptables start
關(guān)閉: service iptables stop
3.開啟部分端口
vim /etc/sysconfig/iptables
添加想要開啟的相關(guān)端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -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 8081 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart