記錄在ubuntu 12.04上實做dhcp並帶option 121的功能.
/etc/dhcp/dhcpd.conf
ddns-update-style none; default-lease-time 6000; max-lease-time 72000; log-facility local7; option rfc3442-classless-static-routes code 121 = array of integer 8;#option ms-classless-static-routes code 249 = array of integer 8; subnet 192.168.100.0 netmask 255.255.255.0{ range 192.168.100.2 192.168.100.250; #option routers 192.168.100.1; #option sip-servers 01:C0:A8:64:01; #option domain-name-servers 172.24.1.2; option rfc3442-classless-static-routes 24, 172, 17, 220, 192, 168, 100, 1, 24, 172, 17, 235, 192, 168, 100, 1, 24, 172, 17, 225, 192, 168, 100, 1; #option ms-classless-static-routes 24, 172, 17, 220, 192, 168, 100, 1; } |
基本上rule的寫法就是前遮罩,中網段,後經由的位置.然零可以省略.
所以如果要加一條路由是”172.17.220.0/24 via 192.168.100.1″的寫法就是”24, 172, 17, 220, 192, 168, 100, 1″
要幾條rule就把設定接下去長,如上列的範例.
也可以由option121的欄位直接設定default gateway,設計路由是”0.0.0.0/0 via 192.168.100.1″
於是格式就轉成”0, 192, 168, 100, 1″
啟用指令由服務巨集開啟
tecom@ZyXEL-OLT-test-PC:~$ service isc-dhcp-server start |
refer:
http://ercpe.de/blog/pushing-static-routes-with-isc-dhcp-server
http://hanymc.wordpress.com/2013/02/23/how-to-add-client-static-route-using-dhcp-option-121/
http://www.cyberciti.biz/faq/howto-ubuntu-debian-squeeze-dhcp-server-setup-tutorial/
http://dragonspring.pixnet.net/blog/post/37398356-%5B%E7%AD%86%E8%A8%98%5D-ubuntu-12.04-%E5%AE%89%E8%A3%9D-dhcp-server
Facebook Comments