CentOS7
- 查看防火墙状态
systemctl status firewalld.service
如状态显示 active(running)表示已经开启
- 关闭防火墙(仅在本次开机有效)
systemctl stop firewalld.service
- 永久关闭防火墙
systemctl status firewalld.service
- 开启防火墙
systemctl start firewalld.service
- 开机自动开启防火墙
systemctl enable firewalld.service
Ubuntu
- 开放端口,如8080
sudo ufw allow 8080