# yum install firewalld # yum install firewall-config 一、介绍
二、使用方法# systemctl start firewalld # 启动, # systemctl enable firewalld # 开机启动 # systemctl stop firewalld # 关闭 # systemctl disable firewalld # 取消开机启动 $ firewall-cmd --help 1. 查看规则$ firewall-cmd --state $ firewall-cmd --get-active-zones public interfaces: eth0 eth1 $ firewall-cmd --get-zone-of-interface=eth0 public $ firewall-cmd --zone=public --list-interfaces eth0 $ firewall-cmd --zone=public --list-all public (default, active) interfaces: eth0 sources: services: dhcpv6-client http ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules: $ firewall-cmd --get-service $ firewall-cmd --get-service --permanent 2. 管理规则# firewall-cmd --panic-on # 丢弃 # firewall-cmd --panic-off # 取消丢弃 $ firewall-cmd --query-panic # 查看丢弃状态 # firewall-cmd --reload # 更新规则,不重启服务 # firewall-cmd --complete-reload # 更新规则,重启服务 # firewall-cmd --zone=public --add-interface=eth0 --permanent # firewall-cmd --set-default-zone=public a. 管理端口# firewall-cmd --zome=dmz --list-ports # firewall-cmd --zone=dmz --add-port=8080/tcp # firewall-cmd --zome=public --add-port=5060-5059/udp --permanent b. 管理服务# firewall-cmd --zone=work --add-service=smtp # firewall-cmd --zone=work --remove-service=smtp c. 配置 ip 地址伪装# firewall-cmd --zone=external --query-masquerade # firewall-cmd --zone=external --add-masquerade # firewall-cmd --zone=external --remove-masquerade d. 端口转发# firewall-cmd --zone=external --add-masquerade # firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=3753 # firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toaddr=192.168.1.100 # firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=2055:toaddr=192.168.1.100
(责任编辑:IT) |