這篇文章主要介紹了linux 中firewall的使用方法總結的相關資料,這里提供了使用的命令幫助大家學習理解,需要的朋友可以參考下
linux 中firewall的使用方法總結
?firewall 簡單使用
?1,顯示所有配置
firewall-cmd?--list-all-zones
2,重新加載配置
firewall-cmd?--reload
3,從public移除 interface
firewall-cmd?--zone=public?--remove-interface=eno16777736
4,查詢外網端口
firewall-cmd?--permanent?--query-port=8080/tcp
5,刪除8080端口,禁止外網訪問
firewall-cmd?--permanent?--remove-port=8080/tcp
6,添加8080端口,供外網訪問
firewall-cmd?--permanent?--add-port=8080/tcp
7,重啟防火墻
systemctl?restart?firewalld
8,將發往80端口的請求轉發到8080
firewall-cmd?--add-forward-port=port=80:proto=tcp:toport=8080
9,查看一下防火墻現在開啟了哪些服務和端口
[root@localhost?~]#?firewall-cmd?--list-all public?(default,?active) ?interfaces:?eno16777736 ?sources:? ?services:?dhcpv6-client?ssh ?ports:?8080/tcp ?masquerade:?no ?forward-ports:?port=80:proto=tcp:toport=8080:toaddr= ?icmp-blocks:? ?rich?rules:
10,設置默認的zone
irewall-cmd?--get-default-zone firewall-cmd?--set-default-zone=trusted
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END