12-跨網段動態分配IP地址典型配置舉例
本章節下載: 12-跨網段動態分配IP地址典型配置舉例 (176.26 KB)
資料版本:6W100-20190628
Copyright © 2019 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本文檔介紹了通過DHCP服務器和DHCP中繼為用戶動態分配IP地址的配置舉例。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文假設您已了解DHCP相關特性。
如圖1所示,公司總部和分支機構處於不同的網段,網關DeviceA充當DHCP服務器,要求:
· 為總部分配10.1.1.2~10.1.1.100之間的IP地址;
· 為分支機構分配10.1.3.2~10.1.3.100之間的IP地址,其中10.1.3.2~10.1.3.48之間的IP地址分配給分支機構1,10.1.3.49~10.1.3.100之間的IP地址分配給分支機構2;
· 指定DNS服務器的固定IP地址為10.1.1.3/24,TFTP服務器的固定IP地址為10.1.1.4/24;
· 分配DNS服務器、TFTP服務器和網關等配置信息。
網關DeviceB充當DHCP中繼,要求:
· 通過配置DHCP中繼功能,使得DHCP服務器能夠為分支機構分配IP地址、DNS服務器、TFTP服務器和網關等配置信息;
· 防止分支機構中存在非法主機配置靜態IP地址訪問網絡;
· 為每個區域分配特定範圍內的IP地址。
圖1 跨網段動態分配IP地址配置組網圖
IP地址 |
IP地址 |
||||
Device A |
Vlan-int3 |
10.1.1.1/24 |
Device B |
Vlan-int3 |
10.1.3.1/24 |
|
Vlan-int2 |
10.1.2.1/24 |
|
Vlan-int2 |
10.1.2.2/24 |
· DHCP Server分配IP地址時,不能將DNS Server和TFTP Server的IP地址分配出去,所以需要將這兩台服務器的IP地址配置為不參與自動分配的IP地址。
· 啟用DHCP中繼的用戶地址表項記錄功能,通過與IP Source Guard配合,實現隻允許匹配用戶地址表項中綁定關係的報文通過DHCP中繼。
· 配置DHCP中繼支持Option82功能,並在DHCP服務器上配置根據Option82的分配策略,從而實現為每個區域分配特定範圍內的IP地址。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的軟件版本。
缺省情況下,本設備的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 配置VLAN接口2的IP地址。
<DeviceA> system-view
[DeviceA] vlan 2
[DeviceA-vlan2] port ten-gigabitethernet 1/0/2
[DeviceA-vlan2] quit
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] ip address 10.1.2.1 24
[DeviceA-Vlan-interface2] quit
# 配置VLAN接口3的IP地址。
[DeviceA] vlan 3
[DeviceA-vlan3] port ten-gigabitethernet 1/0/1
[DeviceA-vlan3] quit
[DeviceA] interface vlan-interface 3
[DeviceA-Vlan-interface3] ip address 10.1.1.1 24
[DeviceA-Vlan-interface3] quit
# 使能DHCP服務。
[DeviceA] dhcp enable
# 配置VLAN接口2工作在DHCP服務器模式。
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] dhcp select server
[DeviceA-Vlan-interface2] quit
# 配置VLAN接口3工作在DHCP服務器模式。
[DeviceA] interface vlan-interface 3
[DeviceA-Vlan-interface3] dhcp select server
[DeviceA-Vlan-interface3] quit
# 配置DHCP地址池1。
[DeviceA] dhcp server ip-pool 1
# 配置地址池動態分配的主網段和IP地址範圍。
[DeviceA-dhcp-pool-1] network 10.1.1.0 mask 255.255.255.0
[DeviceA-dhcp-pool-1] address range 10.1.1.2 10.1.1.100
# 配置DHCP客戶端使用的DNS服務器地址、TFTP服務器地址、域名後綴和網關地址。
[DeviceA-dhcp-pool-1] dns-list 10.1.1.3
[DeviceA-dhcp-pool-1] tftp-server ip-address 10.1.1.4
[DeviceA-dhcp-pool-1] domain-name com
[DeviceA-dhcp-pool-1] gateway-list 10.1.1.1
# 配置DHCP地址池中不參與自動分配的IP地址。
[DeviceA-dhcp-pool-1] forbidden-ip 10.1.1.3 10.1.1.4
[DeviceA-dhcp-pool-1] quit
# 配置VLAN接口3引用地址池1。
[DeviceA] interface vlan-interface 3
[DeviceA-Vlan-interface3] dhcp server apply ip-pool 1
[DeviceA-Vlan-interface3] quit
# 為使Option 82功能正常使用,需要在DHCP服務器和DHCP中繼上都進行相應配置。如下為DHCP服務器上的相關配置:
# 創建DHCP用戶類aa,匹配請求報文中包含Option 82選項,並且該選項的第5字節到第6字節為0x0001(表示連接端口為XGE1/0/1)的客戶端。
[DeviceA] dhcp class aa
[DeviceA-dhcp-class-aa] if-match rule 1 option 82 hex 0001 offset 4 length 2
[DeviceA-dhcp-class-aa] quit
# 創建DHCP用戶類bb,匹配請求報文中包含Option 82選項,並且該選項的第5字節到第6字節為0x0003(表示連接端口為XGE1/0/3)的客戶端。
[DeviceA] dhcp class bb
[DeviceA-dhcp-class-bb] if-match rule 1 option 82 hex 0003 offset 4 length 2
[DeviceA-dhcp-class-bb] quit
# 配置DHCP地址池2。
[DeviceA] dhcp server ip-pool 2
# 配置地址池動態分配的主網段。
[DeviceA-dhcp-pool-2] network 10.1.3.0 mask 255.255.255.0
# 配置DHCP地址池為DHCP用戶類aa動態分配的IP地址範圍。
[DeviceA-dhcp-pool-2] class aa range 10.1.3.2 10.1.3.48
# 配置DHCP地址池為DHCP用戶類bb動態分配的IP地址範圍。
[DeviceA-dhcp-pool-2] class bb range 10.1.3.49 10.1.3.100
# 配置DHCP客戶端使用的DNS服務器地址、TFTP服務器地址、域名後綴和網關地址。
[DeviceA-dhcp-pool-2] tftp-server ip-address 10.1.1.4
[DeviceA-dhcp-pool-2] dns-list 10.1.1.3
[DeviceA-dhcp-pool-2] domain-name com
[DeviceA-dhcp-pool-2] gateway-list 10.1.3.1
[DeviceA-dhcp-pool-2] quit
# 配置VLAN接口2引用地址池2。
[DeviceA] interface vlan-interface 2
[DeviceA-Vlan-interface2] dhcp server apply ip-pool 2
[DeviceA-Vlan-interface2] quit
# 配置到10.1.3.0網段的靜態路由。
[DeviceA] ip route-static 10.1.3.0 24 10.1.2.2
# 配置VLAN接口2的IP地址。
<DeviceB> system-view
[DeviceB] vlan 2
[DeviceB-vlan2] port ten-gigabitethernet 1/0/2
[DeviceB-vlan2] quit
[DeviceB] interface vlan-interface 2
[DeviceB-Vlan-interface2] ip address 10.1.2.2 24
[DeviceB-Vlan-interface2] quit
# 配置VLAN接口3的IP地址。
[DeviceB] vlan 3
[DeviceB-vlan3] port ten-gigabitethernet 1/0/1
[DeviceB-vlan3] port ten-gigabitethernet 1/0/3
[DeviceB-vlan3] quit
[DeviceB] interface vlan-interface 3
[DeviceB-Vlan-interface3] ip address 10.1.3.1 24
[DeviceB-Vlan-interface3] quit
# 使能DHCP服務。
[DeviceB] dhcp enable
# 配置VLAN接口3工作在DHCP中繼模式。
[DeviceB] interface vlan-interface 3
[DeviceB-Vlan-interface3] dhcp select relay
# 指定DHCP服務器的地址。
[DeviceB-Vlan-interface3] dhcp relay server-address 10.1.2.1
# 為使Option 82功能正常使用,需要在DHCP服務器和DHCP中繼上都進行相應配置。如下為DHCP中繼上的相關配置:
# 使能DHCP中繼支持Option82功能。
[DeviceB-Vlan-interface3] dhcp relay information enable
[DeviceB-Vlan-interface3] quit
# 開啟DHCP中繼用戶地址表項記錄功能。
[DeviceB] dhcp relay client-information record
# 配置IPv4動態綁定功能。
[DeviceB] interface vlan-interface 3
[DeviceB-Vlan-interface3] ip verify source ip-address mac-address
[DeviceB-Vlan-interface3] quit
# 配置到10.1.1.0網段的靜態路由。
[DeviceB] ip route-static 10.1.1.0 24 10.1.2.1
# 顯示IP地址10.1.3.3的DHCP地址綁定信息,可以查看到該地址已經被分配出去。
<DeviceA> display dhcp server ip-in-use ip 10.1.3.3
IP address Client identifier/ Lease expiration Type
Hardware address
10.1.3.3 0033-6365-352e-6136- Jan 2 00:34:02 2016 Auto(C)
6466-2e65-3133-392d-
5465-6e2d-4769-6761-
6269-7445-7468-6572-
6e65-7431-2f30-2f35-
31
# 在分支機構1中的某一用戶PC上輸入如下命令,可查看申請到的IP地址。按照同樣的方式,可以確認分支機構2中的用戶也得到指定範圍內的地址。
C:\Documents and Settings\aa>ipconfig
Windows IP Configuration
Ethernet adapter aa:
Connection-specific DNS Suffix . : domain-name com
IP Address. . . . . . . . . . . . : 10.1.3.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
IPv6 Address. . . . . . . . . . . : fe80::20f:3dff:fe80:2b38%4
Default Gateway . . . . . . . . . : 10.1.3.1
# 假設分支機構2裏的非法用戶配置了一個10.1.3.87的IP地址,會發現無法訪問TFTP服務器。
(1) Device A
#
dhcp enable
#
vlan 2 to 3
#
dhcp class aa
if-match rule 1 option 82 hex 0001 offset 4 length 2
#
dhcp class bb
if-match rule 1 option 82 hex 0003 offset 4 length 2
#
dhcp server ip-pool 1
network 10.1.1.0 mask 255.255.255.0
address range 10.1.1.2 10.1.1.100
dns-list 10.1.1.3
domain-name com
forbidden-ip 10.1.1.3
forbidden-ip 10.1.1.4
gateway-list 10.1.1.1
tftp-server ip-address 10.1.1.4
#
dhcp server ip-pool 2
network 10.1.3.0 mask 255.255.255.0
class aa range 10.1.3.2 10.1.3.48
class bb range 10.1.3.49 10.1.3.100
dns-list 10.1.1.3
domain-name com
gateway-list 10.1.3.1
tftp-server ip-address 10.1.1.4
#
interface Vlan-interface2
ip address 10.1.2.1 255.255.255.0
dhcp server apply ip-pool 2
#
interface Vlan-interface3
ip address 10.1.1.1 255.255.255.0
dhcp server apply ip-pool 1
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 3
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
ip route-static 10.1.3.0 24 10.1.2.2
#
#
dhcp enable
dhcp relay client-information record
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 10.1.2.2 255.255.255.0
#
interface Vlan-interface3
ip address 10.1.3.1 255.255.255.0
dhcp select relay
dhcp relay information enable
dhcp relay server-address 10.1.2.1
ip verify source ip-address mac-address
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 3
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port access vlan 3
#
ip route-static 10.1.1.0 24 10.1.2.1
#
· H3C S6890係列交換機 三層技術-IP業務配置指導(R27xx)
· H3C S6890係列交換機 三層技術-IP業務命令參考(R27xx)
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!