我编辑了目录中的 netplan yaml 文件以在接口/etc/netplan
上设置静态 ip 。ens1f0
network:
ethernets:
eno1:
addresses:
- 163.239.14.35/24
gateway4: 163.239.14.1
nameservers:
addresses: [163.239.1.1, 8.8.8.8]
search: []
ens1f0:
addresses:
- 172.16.10.7/12
gateway4: 172.16.10.1
ens1f1:
dhcp4: true
version: 2
但是,即使我运行了“netplan apply”命令,Netplan 也没有应用。
ifconfig
告诉我 ens1f1 上的 ip 未应用。
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 163.239.14.35 netmask 255.255.255.0 broadcast 163.239.14.255
inet6 fe80::ec4:7aff:fed9:17ea prefixlen 64 scopeid 0x20<link>
ether 0c:c4:7a:d9:17:ea txqueuelen 1000 (Ethernet)
RX packets 214589 bytes 265226422 (265.2 MB)
RX errors 0 dropped 2757 overruns 0 frame 0
TX packets 49502 bytes 4862456 (4.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfb120000-fb13ffff
ens1f0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 90:e2:ba:c4:67:c4 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
ens1f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 90:e2:ba:c4:67:c5 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
netplan --debug apply
显示如下一些类似错误的消息。
DEBUG:ens1f0 not found in {'eno1': {'addresses': ['163.239.14.35/24'], 'gateway4': '163.239.14.1', 'nameservers': {'addresses': ['163.239.1.1', '8.8.8.8'], 'search': []}}}
DEBUG:ens1f1 not found in {'eno1': {'addresses': ['163.239.14.35/24'], 'gateway4': '163.239.14.1', 'nameservers': {'addresses': ['163.239.1.1', '8.8.8.8'], 'search': []}}, 'ens1f0': {'addresses': ['172.16.10.7/12'], 'gateway4': '172.16.10.1'}}
这可能是什么问题?我花了整个周末来解决这个问题。
操作系统版本:ubuntu 20.04(服务器)