RHEL7 中使用了firewalld代替了原来的iptables,操作设置和原来有点不同:
查看防火墙状态:systemctl status firewalld
启动防火墙:systemctl start firewalld
停止防火墙:systemctl stop firewalld
防火墙中的一切都与一个或者多个区域相关联,下面对各个区进行说明:
Zone Description -----------------------------------------------------drop (immutable) Deny all incoming connections, outgoing ones are accepted. block (immutable) Deny all incoming connections, with ICMP host prohibited messages issued. trusted (immutable) Allow all network connections public Public areas, do not trust other computersexternal For computers with masquerading enabled, protecting a local network dmz For computers publicly accessible with restricted access. work For trusted work areas home For trusted home network connections internal For internal network, restrict incoming connections
drop(丢弃)
任何接收的网络数据包都被丢弃,没有任何回复。仅能有发送出去的网络连接。
block(限制)
任何接收的网络连接都被 IPv4 的 icmp-host-prohibited 信息和 IPv6 的 icmp6-adm-prohibited 信息所拒绝。
public(公共)
在公共区域内使用,不能相信网络内的其他计算机不会对您的计算机造成危害,只能接收经过选取的连接。
external(外部)
特别是为路由器启用了伪装功能的外部网。您不能信任来自网络的其他计算,不能相信它们不会对您的计算机造成危害,只能接收经过选择的连接。
dmz(非军事区)
用于您的非军事区内的电脑,此区域内可公开访问,可以有限地进入您的内部网络,仅仅接收经过选择的连接。
work(工作)
用于工作区。您可以基本相信网络内的其他电脑不会危害您的电脑。仅仅接收经过选择的连接。
home(家庭)
用于家庭网络。您可以基本信任网络内的其他计算机不会危害您的计算机。仅仅接收经过选择的连接。
internal(内部)
用于内部网络。您可以基本上信任网络内的其他计算机不会威胁您的计算机。仅仅接受经过选择的连接。
trusted(信任)
可接受所有的网络连接。
操作防火墙的一些常用命令:
--显示防火墙状态
[root@localhost zones]# firewall-cmd --state
running
--列出当前有几个zone
[root@localhost zones]# firewall-cmd --get-zones
block dmz drop external home internal public trusted work
--取得当前活动的zones
[root@localhost zones]# firewall-cmd --get-active-zones
public
interfaces: ens32 veth4103622
--取得默认的zone
[root@localhost zones]# firewall-cmd --get-default-zone
public
--取得当前支持service
[root@localhost zones]# firewall-cmd --get-service
RH-Satellite-6 amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns ftp high-availability http https imaps ipp ipp-client ipsec kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt MySQL nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba samba-client smtp ssh telnet tftp tftp-client transmission-client vnc-server wbem-https
新闻热点
疑难解答