一、通过DHCP接口复制实现IP地址分配。
[Huawei]dhcp enab //开启路由器dhcp功能
[Huawei]int g0/0/0.1
[Huawei-GigabitEthernet0/0/0.1]dhcp select interface
[Huawei-GigabitEthernet0/0/0.1]dhcp server dns-list 125.70.254.242
[Huawei-GigabitEthernet0/0/0.1]dhcp server lease day 2
[Huawei-GigabitEthernet0/0/0.1]dhcp server excluded-ip-address 192.168.1.253 192.168.1.253
二、通过DHCP地址池实现IP地址分配。
[Huawei]ip pool vlan20
[Huawei-ip-pool-vlan20]network 192.168.2.0 mask 24
[Huawei-ip-pool-vlan20]gateway-list 192.168.2.254
[Huawei-ip-pool-vlan20]dns-list 8.8.8.8
[Huawei-ip-pool-vlan20]lease day 7 //租约时间
[Huawei-ip-pool-vlan20]excluded-ip-address 192.168.1.199
[Huawei-ip-pool-vlan20]int g0/0/0.2
[Huawei-GigabitEthernet0/0/0.2]dhcp select global
三、通过中继技术实现DHCP Server分配IP地址。
路由器另一个接口连接"云",云桥接vmnet 1
VMware虚拟机开启 windows server 2016服务器,网卡为vmnet1
服务器配置:
安装DHCP
配置到dhcp地址池 网段范围为 :192.168.4.0/24
增加PC3 连接至交换机的e0/0/4口,并将该接口加入vlan30
另外需要在交换机上行口允许vlan30流量通过
[Huawei]vlan 30
[Huawei-vlan30]int e0/0/4
[Huawei-Ethernet0/0/4]port link-type access
[Huawei-Ethernet0/0/4]port default vlan 30
[Huawei-Ethernet0/0/4]int e0/0/3
[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 30
路由器配置:
[Huawei]int g0/0/0.3
[Huawei-GigabitEthernet0/0/0.3]dot1q termination vid 30
[Huawei-GigabitEthernet0/0/0.3]ip add 192.168.4.254 255.255.255.0
[Huawei-GigabitEthernet0/0/0.3]arp broadcast enable
[Huawei-GigabitEthernet0/0/0.3]dhcp select relay
[Huawei-GigabitEthernet0/0/0.3]dhcp relay server-ip 192.168.3.1
PC3客户端IP获取方式设置为DHCP 验证文章来源:https://www.toymoban.com/news/detail-477229.html
打开DHCP snooping功能:
[Huawei]dhcp enable
[Huawei]dhcp snooping enable
防御饿死攻击:
[Huawei-Ethernet0/0/1]dhcp snooping check dhcp-chaddr enable
防御仿冒攻击:
[Huawei-Ethernet0/0/1]dhcp snooping trusted
[Huawei-Ethernet0/0/4]undo dhcp snooping trusted //设置非信任接口
防止中间人攻击:
[Huawei]arp dhcp-snooping-detect enable 文章来源地址https://www.toymoban.com/news/detail-477229.html
到了这里,关于DHCP三种配置方法及命令的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!