在 Ubuntu 22.04 中,我创建了一个名为的 NetworkManager 配置文件netplan-enp2s0.nmconnection
:
[connection]
id=netplan-enp2s0
uuid=7ea6f90b-3495-3533-948a-ef0035687c34
type=ethernet
interface-name=enp2s0
permissions=
timestamp=1634026237
[ethernet]
mac-address-blacklist=
wake-on-lan=0
[ipv4]
address1=192.168.0.100/16,192.168.0.254
dns=192.168.0.254;8.8.8.8;4.4.4.4;
dns-search=
ignore-auto-dns=true
method=manual
[ipv6]
addr-gen-mode=eui64
dns-search=
method=ignore
[proxy]
配置文件已启用并处于活动状态:
$ nmcli con show
NAME UUID TYPE DEVICE
netplan-enp2s0 7ea6f90b-3495-3533-948a-ef0035687c34 ethernet enp2s0
但即使发出:
$ sudo nmcli con up netplan-enp2s0
其内容被忽略:
$ 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: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:30:18:05:87:36 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.17/16 brd 192.168.255.255 scope global dynamic noprefixroute enp2s0
valid_lft 82426sec preferred_lft 82426sec
inet6 fe80::230:18ff:fe05:8736/64 scope link
valid_lft forever preferred_lft forever
并且 GUI 还显示过时的设置:
如果我更改 GUI 中的设置,它会创建一个新的配置文件而不是更新现有的配置文件。
我的错误是什么?
更新
以下是与 GUI 创建的配置文件的差异(右侧):
$ sudo diff netplan-enp2s0.nmconnection netplan-enp2s0-7ea6f90b-3495-3533-948a-ef0035687c34.nmconnection
6,7c6
< permissions=
< timestamp=1634026237
---
> timestamp=1666184508
10d8
< mac-address-blacklist=
15,17d12
< dns-search=
< ignore-auto-dns=true
22d16
< dns-search=