我想通过192.168.178.10将静态路由添加到dhcpd服务器的D1中。不幸的是,这似乎是疯狂的复杂。
我尝试了以下几点:
option static-routes 10.13.0.1 192.168.178.10;但是,这将通过10.0.0.0/8添加一条通过192.168.178.10的路由,这是不需要的。我也试过:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option ms-classless-static-routes 32, 10, 13, 0, 1, 192, 168, 178, 10;这将导致dhcpd不再启动:
Feb 13 20:49:30 csh-gw dhcpd[32042]: For info, please visit https://www.isc.org/software/dhcp/
Feb 13 20:49:30 csh-gw dhcpd[32042]: /var/lib/dhcp//etc/dhcpd.conf line 63: unknown option dhcp.ms-classless-static-routes
Feb 13 20:49:30 csh-gw dhcpd[32042]: option ms-classless-static-routes 32,
Feb 13 20:49:30 csh-gw dhcpd[32042]: ^
Feb 13 20:49:30 csh-gw dhcpd[31870]: Starting ISC DHCPv4 Server
Feb 13 20:49:30 csh-gw dhcpd[31870]: please see /var/log/rc.dhcpd.log for details ..failed对这个问题进行谷歌搜索只会产生向整个网络添加路由的结果,包括默认网关,我不想这样做。
发布于 2019-02-14 06:23:56
你试过这个吗?
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option rfc3442-classless-static-routes 32, 10, 13, 0, 1, 192, 168, 178, 10;发布于 2022-12-03 10:50:54
您需要启用两个不同的选项,因为Microsoft使用的选项与RFC 3442中定义的选项不同:
# Enable sending of static routes
option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;然后定义这两个选项,幸运的是,它们在ISC dhcpd.conf文件中使用相同的语法。首先是目标IP掩码,它还将定义需要给出多少字节的IP。在您的示例中,对于一个掩码为32的单个IP,您将给出所有4个IP字节:
# Route to 10.13.0.1/32 through 192.168.178.10;
# ┌────────────┘
# | | | | |
option rfc3442-classless-static-routes 32,10,13,0,1, 192,168,178,10;
option ms-classless-static-routes 32,10,13,0,1, 192,168,178,10;对于24位网络的路由(所有IP都在10.13.0.1和10.13.0.255之间),您只给出网络的3个字节。看起来是这样的:
# Route to 10.13.0.1/24 through 192.168.178.10;
# ┌────────────┘
# | | | |
option rfc3442-classless-static-routes 24,10,13,0, 192,168,178,10;
option ms-classless-static-routes 24,10,13,0, 192,168,178,10;发布于 2023-02-07 08:23:47
其他答案很可能是错误的。虽然这可能会将所需的路由推送到DHCP客户端,但在我的测试中,客户端将不再有默认路由。
因此,在部署建议之前,请确保客户端网络配置实际上是正确的!
https://unix.stackexchange.com/questions/500480
复制相似问题