我尝试在 redhat 环境中通过 dhcp 推送静态路由。我已经激活了选项 rfc3442-classless-static-routes。dhcp 客户端也配置为请求此选项,如中所述 https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/6.1_Technical_Notes/ar01s04s05.html
我的问题是 dhcp.lease 包含我的选项,我可以在这里看到它。
[root@pDb1 dhclient]# cat dhclient-eth0.leases
lease {
interface "eth0";
fixed-address 10.1.0.100;
filename "/pxelinux.0";
option subnet-mask 255.255.255.0;
option routers 10.1.0.3;
option dhcp-lease-time 43200;
option dhcp-message-type 5;
option dhcp-server-identifier 10.1.0.240;
option rfc3442-classless-static-routes 8,10,0,0,10,1,0,240;
option host-name "pDb1";
renew 1 2012/11/12 14:42:54;
rebind 1 2012/11/12 19:43:30;
expire 1 2012/11/12 21:13:30;
}
但它不会更新路由表。
[root@pDb1 dhclient]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.1.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 10.1.0.3 0.0.0.0 UG 0 0 0 eth0