Centos 8 网卡connect: Network is unreachable错误解决办法

现象1、ifconfig没有ens160配置

[test@localhost ~]$ ifconfig 

lo: 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 4  bytes 240 (240.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4  bytes 240 (240.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:5c:db:27  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
现象2、使用ping或者nmcli命令提示NetworkManager is not running.

[test@localhost ~]$ ping 192.168.215.1
connect: Network is unreachable
[test@localhost ~]$ nmcli
Error: NetworkManager is not running.
先启动网络管理器

 systemctl start NetworkManager 

设置自启动

sudo systemctl enable NetworkManager

再使用nmcli查看态为unmanaged

[test@localhost ~]$ nmcli
virbr0: unmanaged
        "virbr0"
        bridge, 52:54:00:5C:DB:27, sw, mtu 1500

ens160: unmanaged
        "VMware VMXNET3"
        ethernet (vmxnet3), 00:0C:29:D1:E7:5F, hw, mtu 1500

lo: unmanaged
        "lo"
        loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

virbr0-nic: unmanaged
        "virbr0-nic"
        tun, 52:54:00:5C:DB:27, sw, mtu 1500
 

使用nmcli connection up ens160和nmcli device up ens160 ,出现device is strictly unmanaged报错

 nmcli connection up ens160 
Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).

 nmcli device up ens160 
Error: Failed to add/activate new connection: Connection 'ens160' is not available on device ens160 because device is strictly unmanaged
执行以下命令:

nmcli device set ens160 managed yes 
nmcli device status 


DEVICE           TYPE      STATE      CONNECTION 
br-1c57ae1d2940  bridge    unmanaged  --         
br-37a032e957ba  bridge    unmanaged  --         
br-b365648bec89  bridge    unmanaged  --         
docker0          bridge    unmanaged  --         
ens160           ethernet  unmanaged  --         
veth1ea0122      ethernet  unmanaged  --         
veth5707956      ethernet  unmanaged  --         
lo               loopback  unmanaged  --         
解决办法:
查看网络状态

nmcli networking 

手动开启接管

nmcli networking on

查看连接状态

nmcli connection show 
nmcli device status

 Centos 8 网卡connect: Network is unreachable错误解决办法_第1张图片

或者stop服务,再修改配置文件;最后启动服务

systemctl stop NetworkManager
vi /var/lib/NetworkManager/NetworkManager.state
[main]
NetworkingEnabled=true      //修改为true
WirelessEnabled=true
WWANEnabled=true
systemctl start NetworkManager

你可能感兴趣的:(Centos,centos,linux,运维)