iptables规则备份和恢复
firewalld的9个zone
systemctl disable iptables 不开机启动systemctl stop iptables 关掉服务systemctl enable firewalld 开机启动systemctl start firewalld 打开服务
查看所有zone
[root@glinux-01 ~]# firewall-cmd --get-zonesblock dmz drop external home internal public trusted work
查看默认zone
[root@glinux-01 ~]# firewall-cmd --get-default-zonepublic
各个zone介绍
firewalld关于zone的操作
查询指定网卡
[root@glinux-01 ~]# firewall-cmd --get-zone-of-interface=ens33public[root@glinux-01 ~]# firewall-cmd --get-zone-of-interface=ens37no zone
如果新添加的网卡显示no zone
操作方法复制一份ens33的网卡配置文件改名成ens37的,并更改配置文件内容,在重启firewalld.
(如果还不行, 运行systemctl stop NetworkManager,在指定网卡zone)
cp /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-ens33ens37systemctl restart firewalld
[root@glinux-01 network-scripts]# systemctl stop NetworkManager[root@glinux-01 network-scripts]# firewall-cmd --get-zone-of-interface=ens37no zone[root@glinux-01 network-scripts]# firewall-cmd --zone=public --add-interface=ens37success[root@glinux-01 network-scripts]# firewall-cmd --get-zone-of-interface=ens37public
firewalld关于service的操作
查看所有service
[root@glinux-01 network-scripts]# firewall-cmd --get-servicesRH-Satellite-6 amanda-client amanda-k5-client bacula bacula-client bitcoin bitcoin-rpc bitcoin-testnet bitcoin-testnet-rpc ceph ceph-mon cfengine condor-collector ctdb dhcp dhcpv6 dhcpv6-client dns docker-registry dropbox-lansync elasticsearch freeipa-ldap freeipa-ldaps freeipa-replication freeipa-trust ftp ganglia-client ganglia-master high-availability http https imap imaps ipp ipp-client ipsec iscsi-target kadmin kerberos kibana klogin kpasswd kshell ldap ldaps libvirt libvirt-tls managesieve mdns mosh mountd ms-wbt mssql mysql nfs nrpe ntp openvpn ovirt-imageio ovirt-storageconsole ovirt-vmconsole pmcd pmproxy pmwebapi pmwebapis pop3 pop3s postgresql privoxy proxy-dhcp ptp pulseaudio puppetmaster quassel radius rpc-bind rsh rsyncd samba samba-client sane sip sips smtp smtp-submission smtps snmp snmptrap spideroak-lansync squid ssh synergy syslog syslog-tls telnet tftp tftp-client tinc tor-socks transmission-client vdsm vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local xmpp-server
查询默认service
[root@glinux-01 network-scripts]# firewall-cmd --list-servicesssh dhcpv6-client
查询指定service
[root@glinux-01 network-scripts]# firewall-cmd --zone=public --list-servicesssh dhcpv6-client