11-DHCP Snooping典型配置舉例
本章節下載: 11-DHCP Snooping典型配置舉例 (174.86 KB)
H3C S6890產品DHCP Snooping典型配置舉例
資料版本:6W100-20190628
Copyright © 2019 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本文檔介紹了DHCP Snooping相關應用的配置舉例。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文假設您已了解DHCP相關特性。
如圖1所示,某科研機構有三個項目組,分布在不同的樓層中,通過樓層間的DHCP Snooping設備與DHCP Server相連。
為了方便管理,希望通過DHCP服務器統一分配IP地址,同時要求:
· 根據項目組的規模,分配不同範圍的IP地址,為group1分配192.168.0.2~192.168.0.39之間的IP地址,為group2分配192.168.0.40~192.168.0.99之間的IP地址,為group3分配192.168.0.100~192.168.0.200之間的IP地址;
· 保證客戶端從合法的服務器獲取IP地址;
· 禁止用戶通過配置靜態IP地址的方式接入網絡。
圖1 DHCP Snooping配置組網圖
· 在多個DHCP Snooping設備級聯的網絡中,為了節省係統資源,不需要每台DHCP Snooping設備都記錄所有DHCP客戶端的IP地址和MAC地址的綁定信息,隻需在與客戶端直接相連的不信任端口上記錄綁定信息。間接與DHCP客戶端相連的不信任端口不需要記錄IP地址和MAC地址綁定信息,需要配置綁定關係的不信任端口,請參見圖2中所示。
· 在DHCP Snooping設備上指向合法的DHCP服務器方向的端口需要設置為信任端口,以便DHCP Snooping設備正常轉發DHCP服務器的應答報文,保證DHCP客戶端能夠從合法的DHCP服務器獲取IP地址,具體需要配置為信任端口的端口,請參見圖2中所示。
· 為防止非法用戶通過配置靜態IP地址的方式接入網絡,在用戶所在VLAN內啟用ARP Detection功能(本例為缺省VLAN 1內),基於DHCP Snooping表項對用戶進行合法性檢查,保證合法用戶可以正常轉發報文。
· 配置DHCP Snooping支持Option82功能,並在DHCP服務器上配置根據Option82的分配策略,從而實現為每個區域分配特定範圍內的IP地址。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的軟件版本。
缺省情況下,本設備的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 使能DHCP Snooping功能。
<DeviceA> system-view
[DeviceA] dhcp snooping enable
# 在Ten-GigabitEthernet1/0/1上啟用DHCP Snooping表項記錄功能。
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] dhcp snooping binding record
# 為使Option 82功能正常使用,需要在DHCP服務器和DHCP Snooping上都進行相應配置。如下為DHCP Snooping上的相關配置:
# 在Ten-GigabitEthernet1/0/1上配置DHCP Snooping支持Option 82功能,並配置Circuit ID填充內容為group1。
[DeviceA-Ten-GigabitEthernet1/0/1] dhcp snooping information enable
[DeviceA-Ten-GigabitEthernet1/0/1] dhcp snooping information circuit-id string group1
[DeviceA-Ten-GigabitEthernet1/0/1] quit
# 配置Ten-GigabitEthernet1/0/2端口為信任端口。
[DeviceA] interface ten-gigabitethernet 1/0/2
[DeviceA-Ten-GigabitEthernet1/0/2] dhcp snooping trust
[DeviceA-Ten-GigabitEthernet1/0/2] quit
# 使能ARP Detection功能,對用戶合法性進行檢查。
[DeviceA] vlan 1
[DeviceA-vlan1] arp detection enable
[DeviceA-vlan1] quit
# 端口狀態缺省為非信任狀態,上行端口配置為信任狀態,下行端口按缺省配置。
[DeviceA] interface ten-gigabitethernet 1/0/2
[DeviceA-Ten-GigabitEthernet1/0/2] arp detection trust
[DeviceA-Ten-GigabitEthernet1/0/2] quit
# 使能DHCP Snooping功能。
<DeviceB> system-view
[DeviceB] dhcp snooping enable
# 在Ten-GigabitEthernet1/0/1上啟用DHCP Snooping表項記錄功能。
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] dhcp snooping binding record
# 為使Option 82功能正常使用,需要在DHCP服務器和DHCP Snooping上都進行相應配置。如下為DHCP Snooping上的相關配置:
# 在Ten-GigabitEthernet1/0/1上配置DHCP Snooping支持Option 82功能,並配置Circuit ID填充內容為group2。
[DeviceB-Ten-GigabitEthernet1/0/1] dhcp snooping information enable
[DeviceB-Ten-GigabitEthernet1/0/1] dhcp snooping information circuit-id string group2
[DeviceB-Ten-GigabitEthernet1/0/1] quit
# 配置Ten-GigabitEthernet1/0/2端口為信任端口。
[DeviceB] interface ten-gigabitethernet 1/0/2
[DeviceB-Ten-GigabitEthernet1/0/2] dhcp snooping trust
[DeviceB-Ten-GigabitEthernet1/0/2] quit
# 在Ten-GigabitEthernet1/0/3上啟用DHCP Snooping表項記錄功能。
[DeviceB] interface ten-gigabitethernet 1/0/3
[DeviceB-Ten-GigabitEthernet1/0/3] dhcp snooping binding record
# 為使Option 82功能正常使用,需要在DHCP服務器和DHCP Snooping上都進行相應配置。如下為DHCP Snooping上的相關配置:
# 在Ten-GigabitEthernet1/0/3上配置DHCP Snooping支持Option 82功能,並配置Circuit ID填充內容為group3。
[DeviceB-Ten-GigabitEthernet1/0/3] dhcp snooping information enable
[DeviceB-Ten-GigabitEthernet1/0/3] dhcp snooping information circuit-id string group3
[DeviceB-Ten-GigabitEthernet1/0/3] quit
# 使能ARP Detection功能,對用戶合法性進行檢查。
[DeviceB] vlan 1
[DeviceB-vlan1] arp detection enable
[DeviceB-vlan1] quit
# 端口狀態缺省為非信任狀態,上行端口配置為信任狀態,下行端口按缺省配置。
[DeviceB] interface Ten-GigabitEthernet 1/0/2
[DeviceB-Ten-GigabitEthernet1/0/2] arp detection trust
[DeviceB-Ten-GigabitEthernet1/0/2] quit
# 使能DHCP Snooping功能。
<DeviceC> system-view
[DeviceC] dhcp snooping enable
# 配置Ten-GigabitEthernet1/0/2端口為信任端口。
[DeviceC] interface ten-gigabitethernet 1/0/2
[DeviceC-Ten-GigabitEthernet1/0/2] dhcp snooping trust
[DeviceC-Ten-GigabitEthernet1/0/2] quit
# 配置VLAN接口2的IP地址。
<DeviceD> system-view
[DeviceD] vlan 2
[DeviceD-vlan2] port ten-gigabitethernet 1/0/1
[DeviceD-vlan2] quit
[DeviceD] interface vlan-interface 2
[DeviceD-Vlan-interface2] ip address 192.168.0.1 24
[DeviceD-Vlan-interface2] quit
# 使能DHCP服務。
[DeviceD] dhcp enable
# 配置VLAN接口2工作在DHCP服務器模式。
[DeviceD] interface vlan-interface 2
[DeviceD-Vlan-interface2] dhcp select server
[DeviceD-Vlan-interface2] quit
# 為使Option 82功能正常使用,需要在DHCP服務器和DHCP中繼上都進行相應配置。如下為DHCP服務器上的相關配置:
# 創建DHCP用戶類group1,匹配請求報文中包含Option 82選項,並且該選項的第3字節到第8字節為0x67726F757031(表示Circuit ID子選項內容為group1)的客戶端。
[DeviceD] dhcp class group1
[DeviceD-dhcp-class-group1] if-match rule 1 option 82 hex 67726F757031 offset 2 length 6
[DeviceD-dhcp-class-group1] quit
# 創建DHCP用戶類group2,匹配請求報文中包含Option 82選項,並且該選項的第3字節到第8字節為0x67726F757032(表示Circuit ID子選項內容為group2)的客戶端。
[DeviceD] dhcp class group2
[DeviceD-dhcp-class-group2] if-match rule 1 option 82 hex 67726F757032 offset 2 length 6
[DeviceD-dhcp-class-group2] quit
# 創建DHCP用戶類group3,匹配請求報文中包含Option 82選項,並且該選項的第3字節到第8字節為0x67726F757033(表示Circuit ID子選項內容為group3)的客戶端。
[DeviceD] dhcp class group3
[DeviceD-dhcp-class-group3] if-match rule 1 option 82 hex 67726F757033 offset 2 length 6
[DeviceD-dhcp-class-group3] quit
# 配置DHCP地址池1。
[DeviceD] dhcp server ip-pool 1
# 配置地址池動態分配的主網段。
[DeviceD-dhcp-pool-1] network 192.168.0.0 mask 255.255.255.0
# 配置DHCP地址池為DHCP用戶類group1動態分配的IP地址範圍。
[DeviceD-dhcp-pool-1] class group1 range 192.168.0.2 192.168.0.39
# 配置DHCP地址池為DHCP用戶類group2動態分配的IP地址範圍。
[DeviceD-dhcp-pool-1] class group2 range 192.168.0.40 192.168.0.99
# 配置DHCP地址池為DHCP用戶類group3動態分配的IP地址範圍。
[DeviceD-dhcp-pool-1] class group3 range 192.168.0.100 192.168.0.200
# 配置VLAN接口2引用地址池1。
[DeviceD] interface vlan-interface 2
[DeviceD-Vlan-interface2] dhcp server apply ip-pool 1
[DeviceD-Vlan-interface2] quit
# 在group2中的某一用戶PC上輸入如下命令,可查看申請到的IP地址。按照同樣的方式,可以確認group 1和 group 3中的用戶也得到指定範圍內的地址。
C:\Documents and Settings\Administrator>ipconfig
Windows IP Configuration
Ethernet adapter bb:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.0.44
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
# 假設group2裏的非法用戶配置了一個192.168.0.66的IP地址,會發現無法訪問外部網絡。
· Device A
#
dhcp snooping enable
#
vlan 1
arp detection enable
#
interface Ten-GigabitEthernet1/0/1
dhcp snooping binding record
dhcp snooping information enable
dhcp snooping information circuit-id string group1
#
interface Ten-GigabitEthernet1/0/2
arp detection trust
dhcp snooping trust
#
· Device B
#
dhcp snooping enable
#
vlan 1
arp detection enable
#
interface Ten-GigabitEthernet1/0/1
dhcp snooping binding record
dhcp snooping information enable
dhcp snooping information circuit-id string group2
#
interface Ten-GigabitEthernet1/0/2
arp detection trust
dhcp snooping trust
#
interface Ten-GigabitEthernet1/0/3
dhcp snooping binding record
dhcp snooping information enable
dhcp snooping information circuit-id string group3
#
· Device C
#
dhcp snooping enable
#
interface Ten-GigabitEthernet1/0/2
dhcp snooping trust
#
· Device D
#
dhcp enable
#
vlan 2
#
dhcp class group1
if-match rule 1 option 82 hex 67726f757031 offset 2 length 6
#
dhcp class group2
if-match rule 1 option 82 hex 67726f757032 offset 2 length 6
#
dhcp class group3
if-match rule 1 option 82 hex 67726f757033 offset 2 length 6
#
dhcp server ip-pool 1
network 192.168.0.0 mask 255.255.255.0
class group1 range 192.168.0.2 192.168.0.39
class group2 range 192.168.0.40 192.168.0.99
class group3 range 192.168.0.100 192.168.0.200
#
interface Vlan-interface2
ip address 192.168.0.1 255.255.255.0
dhcp server apply ip-pool 1
#
· H3C S6890係列交換機 三層技術-IP業務配置指導(R27xx)
· H3C S6890係列交換機 三層技術-IP業務命令參考(R27xx)
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!