ubuntu20.04无法上网(图标消失),问题解决

文章目录

  • 问题:网络消失
  • 解决方案:给ens33 分配IP地址
  • 测试是否解决成功

问题:网络消失

在进入系统的过程中发现了网络图标消失
在这里插入图片描述
然后查看是不是虚拟机网络出了问题

右下角图标显示是正常的,所以虚拟机时是没有问题的
然后到终端查看ip
ubuntu20.04无法上网(图标消失),问题解决_第1张图片
发现没有ens33,说明没有ens33没有分配 IP地址

解决方案:给ens33 分配IP地址

再此查看使用ifconfig -a查看IP,ens33没有分配IP地址

shea@shea-machine:~$ ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:64:15:b6  txqueuelen 1000  (Ethernet)
        RX packets 49580  bytes 73816678 (73.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7543  bytes 505495 (505.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 232  bytes 19777 (19.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 232  bytes 19777 (19.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

使用sudo dhclient ens33命令分配IP地址

shea@shea-machine:~$ sudo dhclient ens33
[sudo] password for shea: 
shea@shea-machine:~$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.234.128  netmask 255.255.255.0  broadcast 192.168.234.255
        inet6 fe80::20c:29ff:fe64:15b6  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:64:15:b6  txqueuelen 1000  (Ethernet)
        RX packets 49652  bytes 73823060 (73.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7589  bytes 511638 (511.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 246  bytes 20911 (20.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 246  bytes 20911 (20.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

发现分配了IP地址

测试是否解决成功

现在去ping百度,记得使用ctrl + c退出,不然会一直发包

shea@shea-machine:~$ ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=128 time=20.0 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=128 time=21.5 ms
64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=128 time=21.3 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 20.035/20.948/21.472/0.648 ms

ping成功了
图标的话,再次开机就会出现

你可能感兴趣的:(ubuntu,linux)