![1df73b115a05467a98d73b9eec7b95fd.png](https://i-blog.csdnimg.cn/blog_migrate/c7196eff9d198a06d023cacb7956b8b7.jpeg)
1.进入目录 cd /etc/sysconfig/network-scripts
2.找到ifcfg-ens33文件,有可能不通,寻找ifcfg-开头的文件
3.编辑ifcfg-ens33
TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=dhcpDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=2e718c8b-82c3-44b6-8b47-c13ab29a826bDEVICE=ens33ONBOOT=yes
4.将ONBOOT = no 改为 ONBOOT = yes
5.重启网卡
service network restart
6.用 ifocnfig 查看ip地址
ens33: flags=4163 mtu 1500 inet 192.168.184.128 netmask 255.255.255.0 broadcast 192.168.184.255 inet6 fe80::df42:1f5b:eaa8:2611 prefixlen 64 scopeid 0x20 ether 00:0c:29:b3:a7:36 txqueuelen 1000 (Ethernet) RX packets 31235 bytes 45545507 (43.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12671 bytes 806181 (787.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 220 bytes 19080 (18.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 220 bytes 19080 (18.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
7. 检查网络,成功ping网络
[root@localhost network-scripts]# ping www.baidu.comPING www.a.shifen.com (115.239.210.27) 56(84) bytes of data.64 bytes from 115.239.210.27 (115.239.210.27): icmp_seq=1 ttl=128 time=3.33 ms64 bytes from 115.239.210.27 (115.239.210.27): icmp_seq=2 ttl=128 time=5.25 ms64 bytes from 115.239.210.27 (115.239.210.27): icmp_seq=3 ttl=128 time=4.75 ms