centos网卡设置路径:/etc/sysconfig/network-scripts/ifcfg-eno1文件
#实例文件
TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATALno IPV6INIT=yes IPV6_AUTOCONF=no IPV6_DEFROUTE=yes IPV6ADDR=2001:da8:215:9fa1::13/64 IPV6_DEFAULTGW=2001:da8:215:9fa1::1 IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=eno1 UUID=0ae4a857-370b-4694-9101-a774e8d26119 DEVICE=eno1 ONBOOT=yes IPV4_FAILURE_FATAL=no DNS1=10.3.9.4 BOOTPROTO=none IPADDR=10.6.101.23 PREFIX=24 GATEWAY=10.6.101.1
重启网卡:
service network restart
#或者
systemctl restart network
防火墙设置
1、查看firewall服务状态
systemctl status firewalld
2、查看firewall的状态
firewall-cmd --state
#查询端口是否开放 firewall-cmd --query-port=8080/tcp #开放80端口 firewall-cmd --permanent --add-port=80/tcp #移除端口 firewall-cmd --permanent --remove-port=8080/tcp #重启防火墙(修改配置后要重启防火墙) irewall-cmd --reload # 参数解释 1、firwall-cmd:是Linux提供的操作firewall的一个工具; 2、--permanent:表示设置为持久; 3、--add-port:标识添加的端口;
3、开启、重启、关闭、firewalld.service服务
# 开启 service firewalld start # 重启 service firewalld restart # 关闭 service firewalld stop