DHCP的基本配置:服務器
拓撲見QQ收藏:ide
DHCP服務器的配置:
[DHCP Server]int g0/0
[DHCP Server-GigabitEthernet0/0]ip add 12.1.1.1 24
[DHCP Server-GigabitEthernet0/0]un sh
[DHCP Server]dhcp enable 開啓DHCP功能
[DHCP Server]dhcp server ip-pool H3C 定義地址池名爲H3C
[DHCP Server-dhcp-pool-H3C]network 192.168.1.0 mask 255.255.255.0
[DHCP Server-dhcp-pool-H3C]gateway-list 192.168.1.254
[DHCP Server-dhcp-pool-H3C]dns-list 5.5.5.5
[DHCP Server-dhcp-pool-H3C]expired day 5 租期5天
[DHCP Server]dhcp server forbidden-ip 192.168.1.100 192.168.1.254 排除地址spa
DHCP中繼的配置:
[R2]vlan 10
[R2-vlan10]port g1/0/1
[R2-vlan10]port g1/0/2
[R2-vlan10]int vlan 10
[R2-Vlan-interface10]ip add 192.168.1.254 24
[R2-Vlan-interface10]un sh
[R2]int g1/0/3
[R2-GigabitEthernet1/0/3]port link-mode route
[R2-GigabitEthernet1/0/3]ip add 12.1.1.2 24
[R2-GigabitEthernet1/0/3]un sh
[R2]dhcp enable
[R2]int vlan 10
[R2-Vlan-interface10]dhcp select relay 開啓中繼
[R2-Vlan-interface10]dhcp relay server-address 12.1.1.1 服務器的接口地址server