DHCP 在實際應用中比較廣泛,今天將配置DHCP思路及過程寫下來。大家相互學習!
1、實驗拓撲及描述:以AR1作為DHCP伺服器,三層交換機(LSW1)作為DHCP中繼裝置,建立兩個介面組將它們接入到不同的vlan,在vlanif10和vlanif20配置兩個網段的閘道器,且使能DHCP中繼,使用rip協議互通。
G0/0/2--G0/0/10介面劃分到VLAN 10,G0/0/11--G0/0/19介面劃分到VLAN20
DHCP伺服器AR1配置
<Huawei>sys
[Huawei]undo info en
[Huawei]sysname AR1
[AR1]dhcp enable
[AR1]ip pool vlan10
[AR1-ip-pool-vlan10]gateway-list 192.168.10.254
[AR1-ip-pool-vlan10]network 192.168.10.0 mask 24
[AR1-ip-pool-vlan10]q
[AR1-ip-pool-vlan20]gateway-list 192.168.20.254
[AR1-ip-pool-vlan20]network 192.168.20.0 mask 24
[AR1-ip-pool-vlan20]q
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.30.2 24
[AR1-GigabitEthernet0/0/0]dhcp select global
[AR1-GigabitEthernet0/0/0]q
[AR1]rip
[AR1-rip-1]version 2
[AR1-rip-1]network 192.168.30.0
[AR1-rip-1]q
交換機配置
<Huawei>sys
[Huawei]undo info en
[Huawei]sysname LSW1
[LSW1]dhcp enable
[LSW1]vlan b 10 20 30
[LSW1]port-group vlan10
[LSW1-port-group-vlan10]group-member g 0/0/2 to g 0/0/10
[LSW1-port-group-vlan10]port link-type access
[LSW1-port-group-vlan10]port default vlan 10
[LSW1-port-group-vlan10]q
[LSW1]int vlanif 10
[LSW1-Vlanif10]ip address 192.168.10.254 24
[LSW1-Vlanif10]dhcp select relay
[LSW1-Vlanif10]dhcp relay server-ip 192.168.30.2
[LSW1-Vlanif10]int vlanif20
[LSW1-Vlanif20]ip address 192.168.20.254 24
[LSW1-Vlanif20]dhcp select relay
[LSW1-Vlanif20]dhcp relay server-ip 192.168.30.2
[LSW1-Vlanif20]q
[LSW1]port-group vlan20
[LSW1-port-group-vlan20]group-member g 0/0/11 to g 0/0/20
[LSW1-port-group-vlan20]port link-type access
[LSW1-port-group-vlan20]port default vlan 20
[LSW1-port-group-vlan20]q
[LSW1]int vlanif 30
[LSW1-Vlanif30]ip address 192.168.30.1 24
[LSW1-Vlanif30]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 30
[LSW1-GigabitEthernet0/0/1]q
[LSW1]rip
[LSW1-rip-1]version 2
[LSW1-rip-1]network 192.168.10.0
[LSW1-rip-1]network 192.168.20.0
[LSW1-rip-1]network 192.168.30.0
[LSW1-rip-1]q
AR1上檢視地址池使用情況