2014年7月24日 星期四

dhcpd.conf 裡自訂 option 時的格式定義鳥問題

為這個困擾自己三個小時的鳥問題做個記錄:

想用 dhcpd 做更多事的人難免要自訂 options
翻開 dhcpd-options 說明檔會看到一段敘述

The int32 data type specifies a signed 32-bit integer. The uint32 data type specifies an unsigned 32-bit integer. The int16 and uint16 data types specify signed and unsigned 16-bit integers. The int8 and uint8 data types specify signed and unsigned 8-bit integers. Unsigned 8-bit integers are also sometimes referred to as octets.

說得很好,馬上動手改 dhcpd.conf 加入這條定義

(前略) 
option tr069_agent_switch code 200 = uint8;
(後略)

啟動 dhcp server 
/etc/init.d/dhcpd start
啊~ 錯誤!!!

/var/log/messages 多了這行
Jul 22 02:55:16 cento58 dhcpd: /etc/dhcpd.conf line 13: unknown data type uint8

照說明檔裡的順序逐一試了 int32, unit32, int16....結果是這樣
unknown data type int32
unknown data type uint32
unknown data type int16
unknown data type uint16
unknown data type int8


更怪的是貼錯誤訊息問 google,清一色是 man 檔裡的廢話

直到救星出現 http://ipxe.org/howto/dhcpd


原來要寫成這樣


(前略)
option tr069_agent_switch code 200 = unsigned integer 8;
(後略)

可以跑了....

應該是自己悟性不夠,慚愧又無奈地冷笑兩聲  

動起來就好...