平时用于学习和测试,在本地通过VMware部署了Ubuntu服务器,并配置了静态IP,方便远程连接。在某次启动虚拟机后,发现无法通过SSH连接。
用ip addr查看,发现ens33处于DOWN状态
root@shawn-virtual-machine:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:0c:29:e8:2a:60 brd ff:ff:ff:ff:ff:ff
altname enp2s1
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:f9:61:85:8e brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:f9ff:fe61:858e/64 scope link
valid_lft forever preferred_lft forever
5: veth4e95064@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
link/ether ee:24:fb:85:7e:8e brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::ec24:fbff:fe85:7e8e/64 scope link
valid_lft forever preferred_lft forever
解决:
执行
dhclient ens33
再次用ip addr查看查看
oot@shawn-virtual-machine:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:e8:2a:60 brd ff:ff:ff:ff:ff:ff
altname enp2s1
inet 192.168.17.128/24 brd 192.168.17.255 scope global dynamic ens33
valid_lft 1799sec preferred_lft 1799sec
inet6 fe80::20c:29ff:fee8:2a60/64 scope link tentative
valid_lft forever preferred_lft forever
3: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:f9:61:85:8e brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
inet6 fe80::42:f9ff:fe61:858e/64 scope link
valid_lft forever preferred_lft forever
5: veth4e95064@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default
link/ether ee:24:fb:85:7e:8e brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::ec24:fbff:fe85:7e8e/64 scope link
valid_lft forever preferred_lft forever
但是在每次虚拟机重启后都需要重新执行;
如果想要彻底解决这个问题,就需要开启NM托管:
查看托管状态
nmcli n
开启托管
nmcli n on
重启
systemctl restart NetworkManager
标签:00,虚拟机,forever,preferred,DOWN,lft,link,ff,ens33 From: https://www.cnblogs.com/Jedi-Pz/p/18450333非原创,这个是转载: https://www.jianshu.com/p/78349544eb9a