Linux 中的 DHCP 选项自定义配置
一 基础概念与常用选项
二 服务器端自定义选项 ISC DHCPd
option space VENDOR-A;
option VENDOR-A.code code 43;
option VENDOR-A.string "myserver.example.com";
option VENDOR-A.hex 43:0C:6D:79:73:65:72:76:65:72:2E:65:78:61:6D:70:6C:65:2E:63:6F:6D;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
vendor-option-space VENDOR-A;
}
option rfc3442-classless-static-routes code 121 = array of integer 8;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
option rfc3442-classless-static-routes
24, 10,0,0, 192.168.10.1, # 10.0.0.0/24 via 192.168.10.1
0, 0,0,0, 192.168.1.1; # 默认路由 via 192.168.1.1
}
三 客户端自定义选项 dhclient
request subnet-mask, broadcast-address, routers,
domain-name, domain-name-servers, domain-search, host-name;
supersede domain-name-servers 8.8.8.8, 8.8.4.4;
prepend domain-name-servers 1.1.1.1;
timeout 60;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;
send host-name "myhost.example.com";
send dhcp-client-identifier "my-client-id";
四 验证与排错