我正在尝试设置 VMware DCHP 服务器以将静态路由 (192.168.248.0/24 -> 192.168.248.225) 推送到连接到名为 的自定义接口的 DHCP 客户端 (VM) vmnet14
。我参考了此文档:https://fishilico.github.io/generic-config/etc-server/dhcp/dhcpd.conf.raw.html。
配置文件如下:
allow unknown-clients;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
option rfc3442-classless-static-routes code 121 = array of integer 8;
subnet 192.168.248.128 netmask 255.255.255.224 {
range 192.168.248.138 192.168.248.157;
option broadcast-address 192.168.248.159;
option domain-name-servers 192.168.248.129;
option domain-name localdomain;
option routers 192.168.248.129;
option static-routes 192.168.248.0 192.168.248.129;
option rfc3442-classless-static-routes 24, 192, 168, 248, 192, 168, 248, 225;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
}
host vmnet14 {
hardware ethernet XX:XX:XX:XX:XX:XX;
fixed-address 192.168.248.129;
option domain-name-servers 0.0.0.0;
option domain-name "";
option routers 0.0.0.0;
}
则vmware-networks-server
无法再启动。
然后我尝试通过运行进行调试:
sudo /usr/bin/vmnet-dhcpd \
-cf /etc/vmware/vmnet14/dhcpd/dhcpd.conf \
-lf /etc/vmware/vmnet14/dhcpd/dhcpd.leases \
-pf /var/run/vmnet-dhcpd-vmnet14.pid \
-f -d vmnet14
我得到了:
Internet Software Consortium DHCP Server 2.0
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.
Please contribute if you find this software useful.
For info, please visit http://www.isc.org/dhcp-contrib.html
/etc/vmware/vmnet14/dhcpd/dhcpd.conf line 26: no option named rfc3442-classless-static-routes
option rfc3442-classless-static-routes code
^
/etc/vmware/vmnet14/dhcpd/dhcpd.conf line 36: no option named rfc3442-classless-static-routes
option rfc3442-classless-static-routes 24,
^
Configuration file errors encountered -- exiting
exiting.
这个帖子:来自 dhcp 的静态路由设置很接近了,但答案只是说“我用过,而且有效”,但没有提供示例。它提供的链接也没有示例,比如在哪里添加这些选项。
答案1
该option ... code
语法仅在 ISC DHCP v3.0 中引入,但正如启动消息所示,ESXi 提供的 ISC DHCP v2.0 没有此功能。(而且我认为它根本不应该有 DHCP 服务器。)
在此版本中,未知选项被命名option-XXX
并始终指定为带引号的字符串或一系列字节:
option option-121 0:c0:a8:f8:81:18:c0:a8:f8:c0:a8:f8:e1;
不要忘记包含 0/0 路由,因为选项 121 取代了“路由器”选项。
旧版 Windows 要求使用选项 249,而不是 121。