centos7-网络与防火墙常用命令

1、网络配置

vi /etc/sysconfig/network-scripts/ifcfg-ens33

BOOTPROTO="static"
IPADDR=192.168.163.131
NETMASK=255.255.255.0
GATEWAY=192.168.163.2

service network restart

2、防火墙

--开启
[root@cent7-zuoys ~]# service firewalld start
--重启
[root@cent7-zuoys ~]# service firewalld restart
--关闭
[root@cent7-zuoys ~]# service firewalld stop
--查看状态
[root@cent7-zuoys ~]# firewall-cmd --query-port=8080/tcp
no
--添加端口
[root@cent7-zuoys ~]# firewall-cmd --permanent --add-port=8080/tcp
success
--关闭端口
[root@cent7-zuoys ~]# firewall-cmd --permanent --remove-port=8080/tcp
success
--重启防火墙
firewall-cmd --reload
原文地址:https://www.cnblogs.com/yaoyuan2/p/10529924.html