Loading... <div class="tip share">请注意,本文编写于 309 天前,最后修改于 309 天前,其中某些信息可能已经过时。</div> 两台主机PVE主机互通,高性能主机使用10.0.2.0/22网段,小主机和物理网络使用10.0.0.0/22网段。各自使用RouterOS系统,偶尔出现DHCP抢答现象。 现在RouterOS搭建kea-dhcp4服务器,根据MAC分配地址。 高性能主机配置 只响应bc2411前缀MAC地址 ``` { "Dhcp4": { "subnet4": [ { "id": 1, "subnet": "10.0.2.0/22", "client-class": "pve", "pools": [ { "pool": "10.0.2.100-10.0.2.200", "option-data": [ { "name": "domain-name-servers", "data": "10.0.2.1" }, { "name": "routers", "data": "10.0.2.1" } ] } ], "relay": { "ip-addresses": [ "192.168.10.1" ] } } ], "client-classes": [ { "name": "pve", "test": "substring(hexstring(pkt4.mac,''),0,6) == 'bc2411'" }, { "name": "DROP", "test": "not (substring(hexstring(pkt4.mac,''),0,6) == 'bc2411')" } ], "interfaces-config": { "interfaces": [ "eth0/192.168.10.7" ], "service-sockets-max-retries": 5, "service-sockets-require-all": true }, "control-socket": { "socket-type": "unix", "socket-name": "/run/kea/control_socket_4" }, "renew-timer": 1000, "rebind-timer": 2000, "valid-lifetime": 4000, "loggers": [ { "name": "kea-dhcp4", "output_options": [ { "output": "stdout" } ], "severity": "WARN" } ], "lease-database": { "type": "memfile" } } } ``` 物理网络kea配置 只响应非bc2411前缀MAC地址 ``` { "Dhcp4": { "subnet4": [ { "id": 1, "subnet": "10.0.0.0/22", "client-class": "others", "pools": [ { "pool": "10.0.0.100-10.0.0.200", "option-data": [ { "name": "domain-name-servers", "data": "10.0.0.1" }, { "name": "routers", "data": "10.0.0.1" } ] } ], "relay": { "ip-addresses": [ "192.168.10.1" ] } } ], "client-classes": [ { "name": "DROP", "test": "substring(hexstring(pkt4.mac,''),0,6) == 'bc2411'" }, { "name": "others", "test": "not (substring(hexstring(pkt4.mac,''),0,6) == 'bc2411')" } ], "interfaces-config": { "interfaces": [ "eth0/192.168.10.7" ], "service-sockets-max-retries": 5, "service-sockets-require-all": true }, "control-socket": { "socket-type": "unix", "socket-name": "/run/kea/control_socket_4" }, "renew-timer": 1000, "rebind-timer": 2000, "valid-lifetime": 4000, "loggers": [ { "name": "kea-dhcp4", "output_options": [ { "output": "stdout" } ], "severity": "WARN" } ], "lease-database": { "type": "memfile" } } } ``` 最后修改:2024 年 07 月 18 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 1 如果觉得我的文章对你有用,请随意赞赏