DHCP中继(实验操作)
实验拓扑:
实验配置:
#DHCP服务器基础配置 sys sys AR1 int g0/0/0 ip add 192.168.12.1 24 ip route-static 192.168.10.0 24 192.168.12.2 ip route-static 192.168.20.0 24 192.168.12.2
#DHCP中继基础配置 sys sys SW1 vlan batch 10 20 int g0/0/1 p l a p d v 10 int g0/0/2 p l a p d v 20 int vlanif 10 ip add 192.168.10.254 24 int vlanif 20 ip add 192.168.20.254 24 int vlanif 1 ip add 192.168.12.2 24
#DHCP服务器配置全局地址池 #开启全局DHCP [AR1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [AR1] #配置vlan10 地址池 [AR1]ip pool vlan10 Info: It's successful to create an IP address pool. [AR1-ip-pool-vlan10]network 192.168.10.0 mask 24 [AR1-ip-pool-vlan10]gateway-list 192.168.10.254 [AR1-ip-pool-vlan10]dns-list 114.114.114.114 [AR1-ip-pool-vlan10]dis thi [V200R003C00] # ip pool vlan10 gateway-list 192.168.10.254 network 192.168.10.0 mask 255.255.255.0 dns-list 114.114.114.114 # return [AR1-ip-pool-vlan10] #配置vlan20 地址池 [AR1]ip pool vlan20 Info: It's successful to create an IP address pool. [AR1-ip-pool-vlan20] [AR1-ip-pool-vlan20] gateway-list 192.168.20.254 [AR1-ip-pool-vlan20] [AR1-ip-pool-vlan20] network 192.168.20.0 mask 255.255.255.0 [AR1-ip-pool-vlan20] [AR1-ip-pool-vlan20] dns-list 114.114.114.114 [AR1-ip-pool-vlan20] [AR1-ip-pool-vlan20]dis thi [V200R003C00] # ip pool vlan20 gateway-list 192.168.20.254 network 192.168.20.0 mask 255.255.255.0 dns-list 114.114.114.114 # return [AR1-ip-pool-vlan20] #进入接口,开启全局DHCP服务功能 [AR1]interface GigabitEthernet 0/0/0 [AR1-GigabitEthernet0/0/0]dhcp select global #查询DHCP地址池 [AR1]display ip pool ----------------------------------------------------------------------- Pool-name : vlan10 Pool-No : 0 Position : Local Status : Unlocked Gateway-0 : 192.168.10.254 Mask : 255.255.255.0 VPN instance : -- ----------------------------------------------------------------------- Pool-name : vlan20 Pool-No : 1 Position : Local Status : Unlocked Gateway-0 : 192.168.20.254 Mask : 255.255.255.0 VPN instance : -- IP address Statistic Total :506 Used :0 Idle :506 Expired :0 Conflict :0 Disable :0 [AR1]
#DHCP中继 [SW1]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done. [SW1] [SW1]dhcp server group office Info:It's successful to create a DHCP server group. [SW1-dhcp-server-group-office]dhcp-server 192.168.12.1 [SW1]interface Vlanif 10 [SW1-Vlanif10]dhcp select relay [SW1-Vlanif10]dhcp relay server-select office [SW1-Vlanif10]dis thi # interface Vlanif10 ip address 192.168.10.254 255.255.255.0 dhcp select relay dhcp relay server-select office # return [SW1-Vlanif10] [SW1]interface Vlanif20 [SW1-Vlanif20] ip address 192.168.20.254 255.255.255.0 Error: The address already exists. [SW1-Vlanif20] dhcp select relay [SW1-Vlanif20] dhcp relay server-select office [SW1-Vlanif20]dis thi # interface Vlanif20 ip address 192.168.20.254 255.255.255.0 dhcp select relay dhcp relay server-select office # return [SW1-Vlanif20]
#主机自动获取DHCP IP地址 #vlan 10 PC1 PC>ipconfig /renew IP Configuration Link local IPv6 address...........: fe80::5689:98ff:fe35:5abc IPv6 address......................: :: / 128 IPv6 gateway......................: :: IPv4 address......................: 192.168.10.253 Subnet mask.......................: 255.255.255.0 Gateway...........................: 192.168.10.254 Physical address..................: 54-89-98-35-5A-BC DNS server........................: 114.114.114.114 #vlan20 PC2 PC>ipconfig Link local IPv6 address...........: fe80::5689:98ff:fe98:45b7 IPv6 address......................: :: / 128 IPv6 gateway......................: :: IPv4 address......................: 192.168.20.253 Subnet mask.......................: 255.255.255.0 Gateway...........................: 192.168.20.254 Physical address..................: 54-89-98-98-45-B7 DNS server........................: 114.114.114.114 PC>