# 顯示目前設定
- firewall-cmd --list-all
# 重新載入防火牆設定
- firewall-cmd --reload
# 修改防火牆預設 ZONE
vi /etc/firewalld/firewalld.conf
DefaultZone=public
DefaultZone=dmz
.... 改成需要的 ZONE
# 以下可以加 --zone=XXXXX 指定區域
# 以下可以加 --permanent 儲存設定
# 新增服務
- firewall-cmd --add-service=http
# 移除服務
- firewall-cmd --remove-service http
# 新增/移除 port
- firewall-cmd --add-port=8080/tcp
- firewall-cmd --remove-port=8080/tcp
# 新增/移除 IP (PORT)
- firewall-cmd --add-rich-rule="rule family="ipv4" source address="192.168.1.3" accept"
- firewall-cmd --add-rich-rule="rule family="ipv4" source address="192.168.1.2" port port="1234" protocol="tcp" accept"
- firewall-cmd --remove-rich-rule="rule family="ipv4" source address="192.168.1.3" accept"
- firewall-cmd --remove-rich-rule="rule family="ipv4" source address="192.168.1.2" port port="1234" protocol="tcp" accept"
# 增加服務到等定 IP
- firewall-cmd --add-rich-rule="rule family="ipv4" source address="192.168.1.3" service name="ssh" accept"
# 轉PORT或IP
- firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
- firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080:=192.168.2.2
# 修改預設服務的連接 port
vi /etc/firewalld/zones/public.xml
變更服務的 PORT 後重載
全站熱搜
留言列表