查看本机gateway
netstat -rn
(以0.0.0.0开始的行的gateway是默认网关)
vi /etc/sysconfig/network-scripts/ifcfg-enp0s3
TYPE="Ethernet" #delete #PROXY_METHOD="none" #BROWSER_ONLY="no" #update #BOOTPROTO="dhcp" BOOTPROTO="none" DEFROUTE="yes" #insert PEERDNS="yes" PEERROUTES="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" #insert IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="enp0s3" UUID="22e0ea2e-0c27-4f6e-9828-c9f06ce7d6e1" DEVICE="enp0s3" ONBOOT="yes" #insert IPADDR=192.168.0.130 GATEWAY=192.168.0.1 NETMASK=255.255.255.0 DNS1=114.114.114.114 DNS2=8.8.8.8
重启ip服务:
systemctl restart network.service
开启80端口:
firewall-cmd --add-port=80/tcp --permanent
测试网络:
#使用wget测试
#使用yum update测试