我正在 vmware 上创建具有两个网络接口的 18.04 机器。192.168 和 10.100。
我有一个 ubuntu vm 设置作为两个网络的 dhcp 服务器 - 我在 DHCP 方面遇到了严重的问题,因为具有不同 MAC 地址的不同机器获得了相同的 IP 地址。
在下面的列表中你可以看到192.168.1.206已经发给了4台机器!
这尤其奇怪,因为路由器上的 DHCP 也遇到了类似的问题。我以前从未见过这样的事情。
哒,
安德鲁
ubuntu@admin-workstation:~/git/kubeone$ dhcp-lease-list
To get manufacturer names please download http://standards.ieee.org/regauth/oui/oui.txt to /usr/local/etc/oui.txt
Reading leases from /var/lib/dhcp/dhcpd.leases
MAC IP hostname valid until manufacturer
===============================================================================================
00:50:56:01:00:00 10.100.0.201 WIN-69FSNR02U2 2020-02-18 17:42:40 -NA-
00:50:56:86:04:35 192.168.1.206 andrew-4-cp-1 2020-02-18 17:40:34 -NA-
00:50:56:86:15:a3 10.100.0.203 andrew-4-cp-1 2020-02-18 17:38:57 -NA-
00:50:56:86:88:d1 10.100.0.202 andrew-3-cp-1 2020-02-18 17:45:06 -NA-
00:50:56:86:98:6d 192.168.1.206 andrew-2-cp-1 2020-02-18 17:39:13 -NA-
00:50:56:86:a0:37 192.168.1.206 pappsabi-0-cp- 2020-02-18 17:41:17 -NA-
00:50:56:86:cc:d4 192.168.1.206 andrew-3-cp-1 2020-02-18 17:41:51 -NA-
00:50:56:86:e8:40 10.100.0.202 pappsabi-0-cp- 2020-02-18 17:41:21 -NA-
00:50:56:86:eb:44 10.100.0.200 andrew-2-cp-1 2020-02-18 17:48:21 -NA-
ubuntu@admin-workstation:~/git/kubeone$ 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: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:86:f3:c7 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.150/24 brd 192.168.1.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe86:f3c7/64 scope link
valid_lft forever preferred_lft forever
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:86:70:bf brd ff:ff:ff:ff:ff:ff
inet 10.100.0.150/24 brd 10.100.0.255 scope global ens224
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe86:70bf/64 scope link
valid_lft forever preferred_lft forever
ubuntu@admin-workstation:~/git/kubeone$ arp -a
? (10.100.0.214) at 00:50:56:86:88:d1 [ether] on ens224
? (10.100.0.202) at 00:50:56:86:88:d1 [ether] on ens224
? (192.168.1.205) at 00:50:56:86:cc:d4 [ether] on ens192
? (10.100.0.212) at 00:50:56:86:88:d1 [ether] on ens224
? (192.168.1.254) at 00:09:0f:09:08:22 [ether] on ens192
? (10.100.0.200) at 00:50:56:86:88:d1 [ether] on ens224
? (10.100.0.219) at 00:50:56:86:6c:42 [ether] on ens224
? (10.100.0.206) at 00:50:56:11:11:01 [ether] on ens224
? (10.100.0.217) at 00:50:56:86:88:d1 [ether] on ens224
? (10.100.0.204) at 00:50:56:12:12:01 [ether] on ens224
? (192.168.1.214) at 00:50:56:86:fd:c2 [ether] on ens192
? (192.168.1.202) at 00:50:56:86:25:50 [ether] on ens192
? (192.168.1.200) at 00:50:56:86:98:6d [ether] on ens192
? (10.100.0.211) at 00:50:56:86:eb:44 [ether] on ens224
host01.scrat.local (192.168.1.1) at a0:d3:c1:f6:45:78 [ether] on ens192
? (192.168.1.206) at 00:50:56:86:cc:d4 [ether] on ens192
? (10.100.0.209) at 00:50:56:86:eb:44 [ether] on ens224
? (192.168.1.204) at 00:50:56:86:98:6d [ether] on ens192
vc01.scrat.local (192.168.1.10) at 00:0c:29:b1:99:34 [ether] on ens192
? (10.100.0.215) at 00:50:56:86:eb:44 [ether] on ens224
? (10.100.0.203) at 00:50:56:86:eb:44 [ether] on ens224
? (10.100.0.218) at 00:50:56:86:15:a3 [ether] on ens224
? (10.100.0.213) at 00:50:56:86:eb:44 [ether] on ens224
? (10.100.0.201) at 00:50:56:01:00:00 [ether] on ens224
? (10.100.0.216) at 00:50:56:86:6c:42 [ether] on ens224
? (10.100.0.207) at 00:50:56:12:12:01 [ether] on ens224
? (10.100.0.205) at 00:50:56:86:61:e3 [ether] on ens224
? (10.100.0.220) at 00:50:56:86:88:d1 [ether] on ens224
? (192.168.1.203) at 00:50:56:86:cc:d4 [ether] on ens192
_gateway (10.100.0.254) at 00:09:0f:09:08:22 [ether] on ens224
? (10.100.0.210) at 00:50:56:86:88:d1 [ether] on ens224
? (192.168.1.201) at 00:50:56:86:cc:d4 [ether] on ens192
dc01.scrat.local (192.168.1.101) at 00:0c:29:69:5f:f5 [ether] on ens192
? (10.100.0.208) at 00:50:56:86:61:e3 [ether] on ens224
ubuntu@admin-workstation:~/git/kubeone$ sudo cat /etc/dhcp/dhcpd.conf | grep -v "#"
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option domain-search "scrat.local";
option domain-name-servers 192.168.1.101;
range 192.168.1.200 192.168.1.220;
}
subnet 10.100.0.0 netmask 255.255.255.0 {
option routers 10.100.0.254;
option subnet-mask 255.255.255.0;
option domain-name-servers 10.100.0.254;
range 10.100.0.200 10.100.0.220;
}
答案1
由于某种原因 - DHCP 不再像以前那样工作。ubuntu 发送的不是基于 MAC 地址的地址,而是 /etc/machine-id - 启动时生成的字母数字字符串。
看来我遇到这个问题是因为我的机器上有重复的 /etc/machine-id - 它们都是从设置了此值的同一个图像克隆出来的。
从其他干净图像克隆的机器不会出现此问题。
如果您遇到这个问题,只需将文件清零> /etc/machine-id
- 不要删除它,否则一切都会破坏!
答案2
对于 Ubuntu 20.04,以下命令似乎创建了一个新的 id systemd-machine-id-setup。
您可能仍需要手动删除 /etc/machine-id