Ubuntu桌面环境下没有网络配置图标,只有显示VPN设置
文章目录
- 分析:
- 查看网络设备状态
- 排查 NetworkManager(未解决)
- 排查2,桌面程序原因(未解决)
- 网卡配置原因(解决)
- 系统:
Ubuntu 22 with desk - 问题现象:
电脑正常上网,但是每过一段时间就会变动ip
系统桌面右上角有网络图标,机器正常联网但是显示Ethernet(eno1)Unmanaged,进入网络设置只有VPN设置 - 解决:
设备类型配置错误,将wifi修改为ethernet
修改 /usr/lib/NetworkManager/conf.d/ 下的网卡配置文件10-globally-managed-devices.conf
问题配置:
[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma
修改后配置:
[keyfile]
unmanaged-devices=*,except:type:ethernet,except:type:gsm,except:type:cdma
分析:
ip变动是因为每个机器被分配ip时都会同时被分配一个租约,只要手动将系统的网络IP配置改为静态地址(手动)即可。
参考:https://blog.csdn.net/wangdk789/article/details/27052505
具体可看其他其他专栏内的文章
根据经验判断出系统使用nmcli配置的网络,使用nmcli命令修改即可,但是使用nmcli查看后发现正在使用的网络设备(eno1)处于不可用(unmanaged)的状态。
查看网络设备状态
root@yx-PowerEdge-R730:~# nmcli d
DEVICE TYPE STATE CONNECTION
eno1 ethernet unmanaged --
eno2 ethernet unavailable --
eno3 ethernet unavailable --
eno4 ethernet unavailable --
排查 NetworkManager(未解决)
NetworkManager服务正常运行
yx@yx-PowerEdge-R730:~$ sudo systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2024-10-21 15:26:09 CST; 1h 7min ago
Docs: man:NetworkManager(8)
Main PID: 2265593 (NetworkManager)
Tasks: 3 (limit: 38140)
Memory: 4.7M
CPU: 2.499s
CGroup: /system.slice/NetworkManager.service
└─2265593 /usr/sbin/NetworkManager --no-daemon
10月 21 15:33:19 yx-PowerEdge-R730 NetworkManager[2265593]: [1729495999.9665] device (eno1): state change: ip-check -> secondaries (reason ‘none’, sys-iface-state: ‘managed’)
10月 21 15:33:19 yx-PowerEdge-R730 NetworkManager[2265593]: [1729495999.9670] device (eno1): state change: secondaries -> activated (reason ‘none’, sys-iface-state: ‘managed’)
10月 21 15:33:19 yx-PowerEdge-R730 NetworkManager[2265593]: [1729495999.9674] manager: NetworkManager state is now CONNECTED_LOCAL
10月 21 15:33:19 yx-PowerEdge-R730 NetworkManager[2265593]: [1729495999.9678] manager: NetworkManager state is now CONNECTED_SITE
10月 21 15:33:19 yx-PowerEdge-R730 NetworkManager[2265593]: [1729495999.9679] policy: set ‘Ethernet connection 1’ (eno1) as default for IPv4 routing and DNS
10月 21 15:33:19 yx-PowerEdge-R730 NetworkManager[2265593]: [1729495999.9686] device (eno1): Activation: successful, device activated.
10月 21 15:33:21 yx-PowerEdge-R730 NetworkManager[2265593]: [1729496001.1261] manager: NetworkManager state is now CONNECTED_GLOBAL
10月 21 15:34:53 yx-PowerEdge-R730 NetworkManager[2265593]: [1729496093.0673] audit: op=“connection-update” uuid=“47c2edfc-46d1-4bc6-8147-19f6176d6784” name=“Ethernet connection 1”>
10月 21 15:50:43 yx-PowerEdge-R730 NetworkManager[2265593]: [1729497043.3171] audit: op=“connection-update” uuid=“47c2edfc-46d1-4bc6-8147-19f6176d6784” name=“Ethernet connection 1”>
10月 21 16:31:01 yx-PowerEdge-R730 NetworkManager[2265593]: [1729499461.5967] agent-manager: agent[64847d8001491db4,:1.2883/org.gnome.Shell.NetworkAgent/1000]: agent registered
排查2,桌面程序原因(未解决)
重启桌面程序,未解决
- 查看桌面程序类型,只有GNOME桌面有正确的返回值
GNOME桌面
root@yx-PowerEdge-R730:~# gnome-shell --version
GNOME Shell 42.9
KDE桌面
root@yx-PowerEdge-R730:~# kded5 --version
Command 'kded5' not found, but can be installed with:
apt install kded5
XFCE桌面
root@yx-PowerEdge-R730:~# xfce4-panel --version
Command 'xfce4-panel' not found, but can be installed with:
apt install xfce4-panel
- 重启桌面程序(GNOME桌面)
sudo service gdm3 restart
sudo systemctl restart gdm3
如果无法显示桌面,尝试先 stop,然后再 start:
sudo service gdm3 stop
sudo service gdm3 start
网卡配置原因(解决)
- 查看 /usr/lib/NetworkManager/conf.d/ 下的网卡配置文件10-globally-managed-devices.conf
root@yx-PowerEdge-R730:~# cat /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma
正在使用的网络设备为有线连接,但是这里显示类型为wifi设备。
- 修改 /usr/lib/NetworkManager/conf.d/ 下的网卡配置文件10-globally-managed-devices.conf
# 备份原配置文件
root@yx-PowerEdge-R730:~# cp /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf.bak
# 修改配置文件,将wifi修改为ethernet
root@yx-PowerEdge-R730:~# vi /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
[keyfile]
unmanaged-devices=*,except:type:ethernet,except:type:gsm,except:type:cdma
- 重启 NetworkManager 服务
systemctl restart NetworkManager
再次查看网络设备状态,设置界面内的网卡配置也已存在,问题解决
root@yx-PowerEdge-R730:~# nmcli d
DEVICE TYPE STATE CONNECTION
eno1 ethernet connected Ethernet connection 1
eno2 ethernet unavailable --
eno3 ethernet unavailable --
eno4 ethernet unavailable --