dhcp请求分配ip地址(不同vlan中获取DHCP分配IP地址)
根据拓扑配置,要求PC1和PC2分别在不同的vlan中获取AR1这台DHCP分配的ip地址,并且在LSW1上开启dhcpsnpooping功能防止非法dhcp服务器接入网络和非法用户对于AR1的dhcp泛红攻击,在LSW1上开启中继代理功能为PC1和P2代理dhcp服务器的ip地址。
具体配置如下:
一、将AR1配置成dhcp服务器
<Huawei>system-view
[Huawei]sysname AR1
[AR1]dhcp enable
[AR1]ip pool pool1
[AR1-ip-pool-pool1]network192.168.10.0 mask 24
[AR1-ip-pool-pool1]gateway-list192.168.10.1
[AR1-ip-pool-pool1]dns-list114.114.114.114
[AR1-ip-pool-pool1]excluded-ip-address192.168.10.2
[AR1-ip-pool-pool1]quit
[AR1]ip pool pool2
[AR1-ip-pool-pool2]network192.168.20.0 mask 24
[AR1-ip-pool-pool2]gateway-list192.168.20.1
[AR1-ip-pool-pool2]dns-list114.114.114.114
[AR1-ip-pool-pool2]excluded-ip-address192.168.20.2
[AR1-ip-pool-pool2]quit
[AR1]interface g0/0/0
[AR1-GigabitEthernet0/0/0]ipaddress 12.1.1.2 24
[AR1-GigabitEthernet0/0/0]dhcpselect global
[AR1-GigabitEthernet0/0/0]quit
[AR1]ip route-static 0.0.0.00.0.0.0 12.1.1.1
二、配置LSW1成为dhcp中继代理为vlan10和vlan20中的客户端提供对应的dhcp中继代理服务,并配置dhcp-snooping功能防止非法的dhcp服务器分配ip地址给客户端。
<Huawei>system-view
[Huawei]sysnameLSW1
[LSW1]dhcp enable
[LSW1]interfaceVlanif 1
[LSW1-Vlanif1]ip address 12.1.1.1 24
[LSW1-Vlanif1]quit
[LSW1]vlan batch 10 20
[LSW1]intvlan 10
[LSW1-Vlanif10]ip address 192.168.10.1 24
[LSW1-Vlanif10]dhcp select relay
[LSW1-Vlanif10]dhcp relay server-ip 12.1.1.2
[LSW1-Vlanif10]quit
[LSW1]intvlan20
[LSW1-Vlanif20]ip address 192.168.20.1 24
[LSW1-Vlanif20]dhcp select relay
[LSW1-Vlanif20]dhcp relay server-ip 12.1.1.2
[LSW1-Vlanif20]quit
[LSW1]dhcp snooping enable
[LSW1]int g0/0/2
[LSW1-GigabitEthernet0/0/2]portlink-type access
[LSW1-GigabitEthernet0/0/2]portdefault vlan 10
[LSW1-GigabitEthernet0/0/2]dhcpsnooping enable
[LSW1-GigabitEthernet0/0/2]quit
[LSW1]int g0/0/3
[LSW1-GigabitEthernet0/0/3]portlink-type access
[LSW1-GigabitEthernet0/0/3]portdefault vlan20
[LSW1-GigabitEthernet0/0/3]dhcpsnooping enable
[LSW1-GigabitEthernet0/0/3]quit
[LSW1]ip route-static 0.0.0.00.0.0.0 12.1.1.2
三、完成配置后,可以再客户端pc1和pc2上使用ipconfig/renew来获取ip地址。
,
免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com