由于某种原因,我的 Ubuntu 服务器“窃取”了 DHCP 池地址,尽管它应该只有一个静态地址。有趣的是,甚至无法看出ifconfig
存在虚假地址。但该盒子肯定可以通过该 IP 访问,并且它当然会在 dhcp 服务器中显示和刷新。
我猜测是 cloud.cfg 中的设置导致了这个问题,但即使我是 netplan 新手,我似乎也按照建议的方法来禁用它……?!
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
是否配置
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1438
inet 10.0.1.128 netmask 255.255.254.0 broadcast 10.0.1.255
inet6 fe80::250:56ff:fe95:df1f prefixlen 64 scopeid 0x20<link>
ether 00:50:56:95:df:1f txqueuelen 1000 (Ethernet)
RX packets 3853208 bytes 2793921154 (2.7 GB)
RX errors 0 dropped 1170 overruns 0 frame 0
TX packets 907823 bytes 750573388 (750.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 661271 bytes 106863136 (106.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 661271 bytes 106863136 (106.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens160:
dhcp4: no
dhcp6: no
addresses: [10.0.1.128/23]
gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.5]
猫/etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
ens160:
addresses: []
dhcp4: true
optional: true
version: 2
cat /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
network: {config: disabled}