在我习惯了在笔记本电脑上使用netplan.io
之后的几年里,我经常会卸载它,转而使用ifupdown
。
这可能有些牵强,但由于它运行的是桌面前端(等离子),我想知道是否可以使用它同时使用两个不同的渲染器 - 一个用于以太网,一个用于wifi,因为我找不到GUI systemd-networkd
,但仍然希望能够使用GUI配置wifi。
例子:
"network": {
"version": 2,
"renderer": "networkd",
"ethernets": {
"enp0s31f6": {
"dhcp4": false,
"addresses": [
"192.168.1.28/24"
],
"routes": [
{
"to": "default",
"via": "192.168.1.1"
}
],
"nameservers": {
"addresses": [
"192.168.1.2", "192.168.1.3"
],
"search": [
"domain.com"
]
},
"dhcp6": true
}
},
"wifis": {
"wlan0": {
"renderer": "NetworkManager"
}
}
}
(我一直用 JSON 编写配置并使用 进行转换yq
,因为我喜欢 JSON 更明确一点的方式)
如果无法同时使用两个渲染器,那么是否有其他替代方案,NetworkManager
但具有类似的界面,使用ncurses
或Qt
,并将与 进行 wlan0
交互systemd-networkd
?
答案1
我偶然发现了英特尔的connman
软件包,它看起来运行得很好,并且有一个名为的 Qt 接口包cmst
。
我不认为它会与 一起工作systemd-networkd
,但它让我毫无问题地加入了本地 wifi 网络,事实上它控制着 的配置systemd-networkd
,正如它的单元文件所证明的那样:
$ sudo systemctl status systemd-networkd
● systemd-networkd.service - Network Configuration
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-01-31 23:04:42 PST; 22h ago
TriggeredBy: ● systemd-networkd.socket
Docs: man:systemd-networkd.service(8)
Main PID: 4537 (systemd-network)
Status: "Processing requests..."
Tasks: 1 (limit: 23746)
Memory: 2.0M
CPU: 5.559s
CGroup: /system.slice/systemd-networkd.service
└─4537 /lib/systemd/systemd-networkd
Feb 01 20:49:59 treygouty systemd-networkd[4537]: br-int: Gained carrier
Feb 01 20:50:00 treygouty systemd-networkd[4537]: ovs-system: Gained IPv6LL
Feb 01 20:50:00 treygouty systemd-networkd[4537]: br-int: Gained IPv6LL
Feb 01 20:50:02 treygouty systemd-networkd[4537]: enp0s31f6: Gained carrier
Feb 01 20:50:03 treygouty systemd-networkd[4537]: enp0s31f6: Gained IPv6LL
Feb 01 20:50:04 treygouty systemd-networkd[4537]: enp0s31f6: DHCPv6 address redacted/128 (valid for 4h, preferred for 2h 30min)
Feb 01 20:52:33 treygouty systemd-networkd[4537]: wlan0: Link UP
Feb 01 20:53:57 treygouty systemd-networkd[4537]: wlan0: Connected WiFi access point: happyhut (86:2a:a8:88:b5:21)
Feb 01 20:53:57 treygouty systemd-networkd[4537]: wlan0: Gained carrier
Feb 01 20:53:58 treygouty systemd-networkd[4537]: wlan0: Gained IPv6LL
connman
似乎本身就是一个不错的连接管理器,有一个名为的 CLI 助手connctl
- 以下是技术的识别,以及其 CLI 监视器的示例:
$ for i in state technologies monitor; do connmanctl $i; done
State = online
OfflineMode = False
SessionMode = False
/net/connman/technology/p2p
Name = P2P
Type = p2p
Powered = False
Connected = False
Tethering = False
/net/connman/technology/ethernet
Name = Wired
Type = ethernet
Powered = True
Connected = True
Tethering = False
/net/connman/technology/wifi
Name = WiFi
Type = wifi
Powered = True
Connected = True
Tethering = False
TetheringIdentifier = redacted
/net/connman/technology/bluetooth
Name = Bluetooth
Type = bluetooth
Powered = False
Connected = False
Tethering = False
Manager ServicesChanged = {
unchanged ethernet_c85b763c1a3d_cable
unchanged ethernet_4e09c1a325ae_cable
unchanged ethernet_7ab3c8ed895b_cable
unchanged wifi_e4b318e0de7c_6861707079687574_managed_psk
unchanged wifi_e4b318e0de7c_7866696e69747977696669_managed_none
unchanged wifi_e4b318e0de7c_4d4f544f37464441_managed_psk
unchanged wifi_e4b318e0de7c_4e4554474541523430_managed_psk
}, {
removed /net/connman/service/wifi_e4b318e0de7c_466c61707079_managed_psk
removed /net/connman/service/wifi_e4b318e0de7c_73616c6f6e333630_managed_psk
removed /net/connman/service/wifi_e4b318e0de7c_hidden_managed_ieee8021x
removed /net/connman/service/wifi_e4b318e0de7c_536861726a6f77696669_managed_psk
removed /net/connman/service/wifi_e4b318e0de7c_hidden_managed_psk
}
Manager ServicesChanged = {
unchanged ethernet_c85b763c1a3d_cable
unchanged ethernet_4e09c1a325ae_cable
unchanged ethernet_7ab3c8ed895b_cable
unchanged wifi_e4b318e0de7c_6861707079687574_managed_psk
}, {
removed /net/connman/service/wifi_e4b318e0de7c_4d4f544f37464441_managed_psk
removed /net/connman/service/wifi_e4b318e0de7c_7866696e69747977696669_managed_none
removed /net/connman/service/wifi_e4b318e0de7c_4e4554474541523430_managed_psk
}
但我真正想要的是 GUI。尽管看起来并不那么华丽,但它实际上似乎可以访问比通常更多的功能NetworkManager
:
好了,就是这样了。很高兴知道还有其他选择!
答案2
是的,可以将 NetworkManager 用于一组接口,将 networkd 用于另一组接口。如以下文档所述https://netplan.io/reference/:
renderer (scalar)
Use the given networking backend for this definition. Currently
supported are networkd and NetworkManager. This property can be
specified globally in network:, for a device type (in e. g.
ethernets:) or for a particular device definition. Default is
networkd.
虽然没有解释,但是如果每种类型都有多个接口,则可以为每个渲染器设置一个单独的文件,并renderer:
在文件的顶层声明,这样就不必为每个接口重复它。