DHCP Server Configuration:如何新增靜態路由


  1. In DHCP management console, right click the server name and select "Set Predefined Options".
  2. In "Option Class", select "DHCP Standard Options". Click Add. In the popup box, input the following information:
    Name: classless static routes
    Data type: Binary
    Code: 249
    Description: classless static routes
  3. after the option is added, you can see it in either Scope Options or Server Options. However, there's no user interface on Windows 2000 DHCP server to configure network address/mask/gateway. Instead, you have to calculate the binary data by yourself and then input it.
    For example, if we'd like to add such a static route:

    Network Destination     Netmask              Gateway                  

    We set the data for this option as: 18 01 01 01 0b 0c 0d 0e

The first octot indicates the mask length. Here the lengh is 24, so we type 18 (HEX).The ensuing is the network address, and the lengh varies according to the mask. Here the mask length is 18, so the network address consists of 3 octots in HEX. We type 01 01 01 here. The last octot 00 is omitted. The last 4 octots belongs to the gateway, in HEX as well. 0b 0c 0d 0e just matches

The classless static routes option is only recognizable by Windows XP and Windows Server 2003. Windows 2000 DHCP clients will ignore that option.

另外,針對Windows 2000 client僅能以logon script

請參考以下VB script

Dim objShell 
dim strCommand
dim strResult
Set objShell = CreateObject("WScript.Shell")
strCommand="route add mask"

PS:紅色部分是需要自訂的地方。務必先測試route add這個指令是不是正常。

附註:如何將Script套用到Domain Policy?

  1. 將上面的Script另存為 routeadd.vbs
  2. 開啟Active Directory user and computer
  3. 新增一個OU
  4. 點選OU內容/[群組原則]/[新物件](若是您使用已存在的群組原則僅直接點選編輯即可)
  5. 編輯群組原則
  6. 找到使用者設定/Windows 設定/指令檔(登入/登出)
  7. 點兩下右邊視窗的登入
  8. 按一下[顯示檔案]
  9. 將routeadd.vbs複製到該路徑,關閉視窗
  10. 點選[新增]/[瀏覽],找到您剛剛複製的檔案
  11. 指令檔參數為您所要修改的參數(這裡不需要下參數,請忽略此步驟)
  12. 按下[確定]/[套用]離開
  13. 將所要套用的user移至該OU
  14. 強迫立即生效:
    secedit /refreshpolicy user_policy /enforce

還想多看看?相關的主題文章包含在 Tawiwan CSS Newletter Issue 1之中,您可以參考看看。


Comments (0)

Skip to main content