iptables and firewalld

iptables is the old
firewall on centos, firewalld is the new firewall on centos, and it is used on systems after centos 7.

Open https:
firewall-cmd --zone=public --add-service=https //temporary
firewall-cmd --permanent --zone=public --add-service=https //permanent

firewalld firewall whitelist add:
firewall-cmd --permanent --zone=home --add-source=xxx.xxx.xxx.xxx

Open a port:
firewall-cmd --permanent --zone=public --add-port=8080-8081/tcp //Permanent
firewall-cmd --zone=public --add-port=8080-8081/tcp / /temporary

firewall-cmd --reload
firewall-cmd --list-all
firewall-cmd --get-active-zones
firewall-cmd --get-default-zones
firewall-cmd --state

Reference:
https://www.jianshu.com/p/411274f96492
https://blog.csdn.net/s_p_j/article/details/80979450
https://blog.csdn.net/weixin_46152207/article/details/111595819

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324344516&siteId=291194637