前一天好好的,今天连接不上ubuntu虚拟机,登陆上去发现网卡没了…(ifconfig -a 可见),尝试ifconfig ens33 up但是无IP,

root@ubuntu:/home/hadoop/Desktop# ifconfig 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:3e:cd:a4:97  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        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 1012  bytes 73069 (73.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1012  bytes 73069 (73.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        
########################

root@ubuntu:~/Desktop$ ifconfig ens33 up
root@ubuntu:~/Desktop$ ifconfig 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:3e:cd:a4:97  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:0c:29:11:c9:1c  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        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 448  bytes 33011 (33.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 448  bytes 33011 (33.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

hadoop@ubuntu:~/Desktop$

参考:https://blog.csdn.net/qq_45391763/article/details/103188482

root@ubuntu:/home/hadoop/Desktop# service network-manager stop
root@ubuntu:/home/hadoop/Desktop# rm /var/lib/NetworkManager/NetworkManager.state 
root@ubuntu:/home/hadoop/Desktop# service network-manager start
root@ubuntu:/home/hadoop/Desktop# ifconfig 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:3e:cd:a4:97  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.153.128  netmask 255.255.255.0  broadcast 192.168.153.255
        inet6 fe80::cd9b:1840:c271:7c29  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:11:c9:1c  txqueuelen 1000  (Ethernet)
        RX packets 25  bytes 3343 (3.3 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 46  bytes 5376 (5.3 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 1439  bytes 103732 (103.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1439  bytes 103732 (103.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@ubuntu:/home/hadoop/Desktop#
root@ubuntu:~$ cat /etc/network/interfaces
auto enp33
iface enp33 inet static
address 192.168.153.128
netmask  255.255.255.0
gateway  192.168.153.1

以上不行的话见下面!!!

参考:https://blog.csdn.net/yanghenpi/article/details/83146930

按顺序执行以下代码   Centos7操作系统 

都是在root的权限下
  systemctl stop NetworkManager
  systemctl disable NetworkManager  
  systemctl start network.service

最后重启网卡就看到了

  重启网卡

  service network restart

  查看

  #ifconfig
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐