CentOS7 防火墙 firewall-cmd
2024-10-11 07:39:18
最小化安装 CentOS7 后,很多端口默认是不打开的,需要通过 firewall-cmd 把这些端口打开。
检查防火墙状态
# firewall-cmd --state
running
关闭防火墙
# systemctl stop firewalld
# firewall-cmd --state
not running
查看开放端口列表
# firewall-cmd --list-all
public (default, active)
interfaces: docker0 enp0s3
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
暂时开放http 服务
# firewall-cmd --add-service=http
永久开放http 服务
# firewall-cmd --add-service=http --permanent
永久关闭http 服务
# firewall-cmd --remove-service=http --permanent
让设定生效
# systemctl restart firewalld
获取FirewallD 的服务名称
# firewall-cmd --get-service
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
查询服务的启用状态
# firewall-cmd --query-service http
yes
开放指定的端口
# firewall-cmd --add-port=/tcp
# firewall-cmd --list-all
public (default)
interfaces:
sources:
services: dhcpv6-client ftp ssh
ports: /tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
最新文章
- PHP设计模式(六)原型模式(Prototype For PHP)
- Objective-C中小怪兽的逻辑
- 【十大经典数据挖掘算法】Naïve Bayes
- win10U盘 安装
- look
- 证明Dijkstra中加入S的点已经最优
- linux下打开chm文件的方法
- rpmdb: BDB0113 错误
- 从ramdisk根文件系统启动Linux成功,及使用initramfs启动linux
- nyoj 540 奇怪的排序
- 过滤器(Filter)
- angularJS学习手册(1)
- 启用DHCP中继代理,实现跨子网服务 - Win 2003 Server
- 再造轮子之网易彩票-第一季(IOS 篇 by sixleaves)
- hiho 1015 KMP
- jenkins添加类ubuntu/centos节点报错
- 17.结构体(typedef)
- TP5新增模块
- 翻译:SockJS-node文档(一)
- go tail