Fedora-防火墙firewall-cmd相关

改完后要执行firewall-cmd --reload!!!

查看防火墙状态


firewall-cmd --state

输出

running 

查看活动区域并附带网络接口

firewall-cmd --get-active-zones

输出

FedoraWorkstation interfaces: enp3s0 

通过网络接口查看对应的区域

firewall-cmd --get-zone-of-interface=enp3s0

输出

FedoraWorkstation 

通过区域名获得所有网络接口

firewall-cmd --zone=FedoraWorkstation --list-interfaces

输出

enp3s0 

通过区域名获得此区域的信息

firewall-cmd --zone=FedoraWorkstation --list-all

输出

FedoraWorkstation (default, active)
  interfaces: enp3s0 sources: services: dhcpv6-client mdns samba-client ssh
  ports: 1025-65535/udp 1025-65535/tcp
  masquerade: no forward-ports: icmp-blocks: rich rules: 

查看当前区域活动的services

firewall-cmd --get-service

输出

amanda-client amanda-k5-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns freeipa-ldap freeipa-ldaps freeipa-replication ftp high-availability http https imaps ipp ipp-client ipsec kadmin kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql privoxy proxy-dhcp puppetmaster radius rpc-bind samba samba-client sane smtp squid ssh synergy telnet tftp tftp-client tor-socks transmission-client vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local xmpp-server 

增加端口到防火墙中

firewall-cmd --zone=FedoraWorkstation --add-port=8080/tcp --permanent

firewall-cmd --zone=FedoraWorkstation --add-port=5060-5061/udp --permanent

删除

firewall-cmd --zone=FedoraWorkstation --remove-port=8080/tcp

firewall-cmd --zone=FedoraWorkstation --remove-port=5060-5061/udp

增加服务到防火墙中

firewall-cmd --zone=FedoraWorkstation --add-service=smtp --permanent

删除

firewall-cmd --zone=FedoraWorkstation --remove-service=smtp

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值