本次测试环境是在虚拟机上测试

网卡配置文件路径:/etc/sysconfig/network-scripts/ifcfg-ens33

[root@localhost ~]# cd /etc/sysconfig/network-scripts/          #进入网卡配置路径
[root@localhost network-scripts]# ll                     #列出文件,找到ifcfg-ens33网卡配置文件

CentOS 8 网卡设置

 

[root@localhost network-scripts]# vim ifcfg-ens33 

none    
BROWSER_ONLY=no
BOOTPROTO=none             #dhcp改为none或者static
DEFROUTE=yes
NAME=ens33
DEVICE=ens33
ONBOOT=yes                #no 改为 yes
IPADDR=192.168.1.130    #添加IP
NETMASK=255.255.255.0   #添加子网掩码
GATEWAY=192.168.1.1    #添加网关

 

[root@localhost network-scripts]# nmcli c reload     #重载网卡即可,centos 8重载网卡命令从systemctl改为nmcli来加载网卡了。

 

接下来就是ping测试看看,ping www.baidu.com 看看返回值,如果是返回截图下的值,可以绑定一下DNS来解决该问题

CentOS 8 网卡设置

[root@localhost ~]# vi /etc/resolv.conf

nameserver 114.114.114.114
nameserver 8.8.8.8

CentOS 8 网卡设置

 

相关文章:

  • 2021-07-15
  • 2022-12-23
  • 2021-12-24
  • 2021-06-28
  • 2021-12-08
  • 2022-12-23
  • 2022-02-20
  • 2022-01-09
猜你喜欢
  • 2022-12-23
  • 2022-01-22
  • 2021-11-24
  • 2021-05-26
  • 2021-11-20
  • 2022-01-21
  • 2022-12-23
相关资源
相似解决方案