H3C模擬器 DHCP Snooping 、中繼 實例配置
阿新 • • 發佈:2019-04-18
src 屬於 eba 不同網段 動態綁定 image cto term 路由器 1.DHCP 實例配置
## 配置步驟(在路由器上配置) ### (1) # 配置接口的 IP 地址。 <H3C> system-view [H3C] interface g 0/0 [[H3C-GigabitEthernet0/0]] ip address 192.168.1.254 24 [[H3C-GigabitEthernet0/0]] quit ### (2)# 啟用 DHCP 服務。 [H3C] dhcp enable ### (3) # 配置不參與自動分配的 IP 地址。 [H3C] dhcp server forbidden-ip 192.168.1.10 [H3C] dhcp server forbidden-ip 192.168.1.254 (4)# 配置 DHCP 地址池 0,采用動態綁定方式分配 IP 地址。 可分配的網段為 192.168.1.0/24,租約有效期限為 10 天,DNS 服務器地址為 192.168.1.10。 [H3C] dhcp server ip-pool 0 [H3C-dhcp-pool-0] network 192.168.1.0 mask 255.255.255.0 [H3C-dhcp-pool-0] expired day 10 [H3C-dhcp-pool-0] dns-list 192.168.1.10 [H3C-dhcp-pool-0] gateway-list 192.168.1.254 [H3C-dhcp-pool-0] quit
2.DHCP中繼
DHCP服務器在路由器上,而SWA上有3個VLAN,分屬於3個不同網段,
DHCP的請求報文是廣播,因此必須在SWA上設置中繼才能夠傳到路由器。
配置步驟 (1) # 配置路由器。 <H3C> system-view [H3C] interface g 0/0 [[H3C-GigabitEthernet0/0]] ip address 10.1.1.2 30 [[H3C-GigabitEthernet0/0]] quit # 啟用 DHCP 服務。 [H3C] dhcp enable # 配置 DHCP 地址池 1,為來自 192.168.1.0/24網段內的客戶端分配地址。 [H3C] dhcp server ip-pool 1 [H3C-dhcp-pool-0] network 192.168.10.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.10.254 [H3C-dhcp-pool-0] quit # 配置 DHCP 地址池 2,為來自 192.168.20.0/24網段內的客戶端分配地址。 [H3C] dhcp server ip-pool 2 [H3C-dhcp-pool-0] network 192.168.20.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.20.254 [H3C-dhcp-pool-0] quit # 配置 DHCP 地址池 3,為來自 192.168.30.0/24網段內的客戶端分配地址。 [H3C] dhcp server ip-pool 3 [H3C-dhcp-pool-0] network 192.168.30.0 mask 255.255.255.0 [H3C-dhcp-pool-0] dns-list 8.8.8.8 [H3C-dhcp-pool-0] gateway-list 192.168.30.254 [H3C-dhcp-pool-0] quit # 配置靜態路由到192.168.0.0/16網段 [H3C]ip route-static 192.168.0.0 16 10.1.1.1
(2)# 配置 SWA交換機。
建立vlan,並且配置各接口的 IP 地址。
<H3C> system-view [H3C]vlan 10 [H3C-vlan10]quit [H3C]vlan 20 [H3C-vlan20]quit [H3C]vlan 30 [H3C-vlan30]quit [H3C]inter range g 1/0/1 to g 1/0/5 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 10 [H3C-if-range]quit [H3C]inter range g 1/0/6 to g 1/0/10 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 20 [H3C-if-range]quit [H3C]inter range g 1/0/11 to g 1/0/15 [H3C-if-range]port link-type access [H3C-if-range]port access vlan 30 [H3C-if-range]quit [H3C]inter vlan 10 [H3C-Vlan-interface10]ip add 192.168.10.254 24 [H3C-Vlan-interface10]quit [H3C]inter vlan 20 [H3C-Vlan-interface20]ip add 192.168.20.254 24 [H3C-Vlan-interface20]quit [H3C]inter vlan 30 [H3C-Vlan-interface30]ip add 192.168.30.254 24 [H3C-Vlan-interface30]quit [H3C] [H3C]inter g 1/0/23 [H3C-GigabitEthernet1/0/23]port link-m r [H3C-GigabitEthernet1/0/23]ip add 10.1.1.1 30 [H3C-GigabitEthernet1/0/23]quit
(3)#配置DHCP中繼(SWA交換機)
# 啟用 DHCP 服務。
[H3C] dhcp enable
# 配置 VLAN 接口 10 工作在 DHCP 中繼模式。
[H3C] interface vlan-interface 10
[H3C-Vlan-interface10] dhcp select relay
# 配置 DHCP 服務器的地址。
[H3C-Vlan-interface10] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface10] quit
# 配置 VLAN 接口 20 工作在 DHCP 中繼模式。
[H3C] interface vlan-interface 20
[H3C-Vlan-interface20] dhcp select relay
[H3C-Vlan-interface20] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface20] quit
# 配置 VLAN 接口 30 工作在 DHCP 中繼模式。
[H3C] interface vlan-interface 30
[H3C-Vlan-interface30] dhcp select relay
[H3C-Vlan-interface30] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface30] quit
3.DHCP Snooping
DHCP服務器在路由器上,而SWA上有3個VLAN,分屬於3個不同網段,
DHCP的請求報文是廣播,因此必須在SWA上設置中繼才能夠傳到路由器。
偽DHCP Server已經配置好,將發布172.22.1.1-99的地址池,網關172.22.1.254,DNS 9.9.9.9
配置步驟
(1) # 配置路由器。
<H3C> system-view
[H3C] interface g 0/0
[[H3C-GigabitEthernet0/0]] ip address 10.1.1.2 30
[[H3C-GigabitEthernet0/0]] quit
# 啟用 DHCP 服務。
[H3C] dhcp enable
# 配置 DHCP 地址池 1,為來自 192.168.1.0/24網段內的客戶端分配地址。
[H3C] dhcp server ip-pool 1
[H3C-dhcp-pool-0] network 192.168.10.0 mask 255.255.255.0
[H3C-dhcp-pool-0] dns-list 8.8.8.8
[H3C-dhcp-pool-0] gateway-list 192.168.10.254
[H3C-dhcp-pool-0] quit
# 配置 DHCP 地址池 2,為來自 192.168.20.0/24網段內的客戶端分配地址。
[H3C] dhcp server ip-pool 2
[H3C-dhcp-pool-0] network 192.168.20.0 mask 255.255.255.0
[H3C-dhcp-pool-0] dns-list 8.8.8.8
[H3C-dhcp-pool-0] gateway-list 192.168.20.254
[H3C-dhcp-pool-0] quit
# 配置 DHCP 地址池 3,為來自 192.168.30.0/24網段內的客戶端分配地址。
[H3C] dhcp server ip-pool 3
[H3C-dhcp-pool-0] network 192.168.30.0 mask 255.255.255.0
[H3C-dhcp-pool-0] dns-list 8.8.8.8
[H3C-dhcp-pool-0] gateway-list 192.168.30.254
[H3C-dhcp-pool-0] quit
# 配置靜態路由到192.168.0.0/16網段
[H3C]ip route-static 192.168.0.0 16 10.1.1.1
(2)# 配置 SWA交換機。
# 建立vlan,並且配置各接口的 IP 地址。
<H3C> system-view
[H3C]vlan 10
[H3C-vlan10]quit
[H3C]vlan 20
[H3C-vlan20]quit
[H3C]vlan 30
[H3C-vlan30]quit
[H3C]inter range g 1/0/1 to g 1/0/5
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 10
[H3C-if-range]quit
[H3C]inter range g 1/0/6 to g 1/0/10
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 20
[H3C-if-range]quit
[H3C]inter range g 1/0/11 to g 1/0/15
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 30
[H3C-if-range]quit
[H3C]inter vlan 10
[H3C-Vlan-interface10]ip add 192.168.10.254 24
[H3C-Vlan-interface10]quit
[H3C]inter vlan 20
[H3C-Vlan-interface20]ip add 192.168.20.254 24
[H3C-Vlan-interface20]quit
[H3C]inter vlan 30
[H3C-Vlan-interface30]ip add 192.168.30.254 24
[H3C-Vlan-interface30]quit
[H3C]
[H3C]inter g 1/0/23
[H3C-GigabitEthernet1/0/23]port link-t
[H3C-GigabitEthernet1/0/23]ip add 10.1.1.1 30
[H3C-GigabitEthernet1/0/23]quit
(3)#配置DHCP中繼(SWA交換機)
# 啟用 DHCP 服務。
[H3C] dhcp enable
# 配置 VLAN 接口 10 工作在 DHCP 中繼模式。
[H3C] interface vlan-interface 10
[H3C-Vlan-interface10] dhcp select relay
# 配置 DHCP 服務器的地址。
[H3C-Vlan-interface10] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface10] quit
# 配置 VLAN 接口 20 工作在 DHCP 中繼模式。
[H3C] interface vlan-interface 20
[H3C-Vlan-interface20] dhcp select relay
[H3C-Vlan-interface20] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface20] quit
# 配置 VLAN 接口 30 工作在 DHCP 中繼模式。
[H3C] interface vlan-interface 30
[H3C-Vlan-interface30] dhcp select relay
[H3C-Vlan-interface30] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface30] quit
(4)#配置DHCP Snooping(SWB交換機)
# 啟用 DHCP Snooping 功能。
[H3C] dhcp snooping enable
# 設置 GigabitEthernet1/0/21 端口為信任端口。
[H3C] interface GigabitEthernet 1/0/21
[H3C-GigabitEthernet1/0/21] dhcp snooping trust
[H3C-GigabitEthernet1/0/21] quit
# 在 GigabitEthernet1/0/1 上啟用 DHCP Snooping 表項功能。
[H3C] interface GigabitEthernet 1/0/1
[H3C-GigabitEthernet1/0/1] dhcp snooping binding record
[H3C-GigabitEthernet1/0/1] quit
H3C模擬器 DHCP Snooping 、中繼 實例配置