首页 > 代码库 > CentOS Firewall CMD命令综述

CentOS Firewall CMD命令综述

 

systemctl start firewalld.service
systemctl enable firewalld.service
systemctl status firewalld.service

firewall-cmd --state

firewall-cmd --zone=public --add-port=8080/tcp --permanent

firewall-cmd --zone=public --remove-port=80/tcp --permanent

#restart firewall
firewall-cmd --reload

#list for ports for internet
firewall-cmd --zone=public --list-ports

#然后转发 tcp 22 端口至 3753
firewall-cmd --zone=public --add-forward-port=port=22:proto=tcp:toport=3753

#转发 22 端口数据至另一个 ip 的相同端口上
firewall-cmd --zone=public --add-forward-port=port=22:proto=tcp:toaddr=192.168.1.100

#转发 22 端口数据至另一 ip 的 2055 端口上
firewall-cmd --zone=public --add-forward-port=port=22:proto=tcp:toport=2055:toaddr=192.168.1.100

systemctl stop firewalld.service
systemctl disable firewalld.service

CentOS Firewall CMD命令综述