c.【华为设备mstp+vrrp 配置】
拓扑图
DHCP 交换机配置
dhcp enable
ip pool vlan10
gateway-list 192.168.10.1
network 192.168.10.0 mask 255.255.255.0
dns-list 114.114.114.114 8.8.8.8
domain-name zjql.com
#
ip pool vlan20
gateway-list 192.168.20.1
network 192.168.20.0 mask 255.255.255.0
dns-list 114.114.114.114 8.8.8.8
domain-name qunli-test.com
ip route-static 22.1.1.0 255.255.255.0 12.1.1.2
ip route-static 192.168.0.0 255.255.0.0 12.1.1.2
interface Ethernet0/0/0
ip address 12.1.1.1 255.255.255.0
dhcp select global
R2配置
interface Ethernet0/0/0
ip address 12.1.1.2 255.255.255.0
#
interface Ethernet0/0/1
ip address 22.1.1.1 255.255.255.0
ip route-static 192.168.0.0 255.255.0.0 22.1.1.2
交换机配置
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 12.1.1.1
#
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
dhcp select relay
dhcp relay server-ip 12.1.1.1
#
interface Vlanif220
ip address 22.1.1.2 255.255.255.0
#
dhcp 可选配置
R2:
ip pool a
excluded-ip-address 192.168.8.250 192.168.8.254
给固定该的mac地址分配固定的ip地址:
ip pool a
static-bind ip-address 192.168.8.8 mac-address 5489-987d-4dff
注意:如果指令报冲突错误,需要在用户端ipconfig /release 即可。
防止非法的dhcp 服务器 (防止饿死攻击)
dhcp snooping :
dhcp enable
dhcp snooping enable
int e0/0/2 将上联口设置为信任接口(默认所有的接口都是非信任口)
dhcp snooping trusted
防止DHCP饿死攻击,客户端源mac是否与chaddr 的mac 地址是否相同(比较边客户端缘端口mac地址的唯一性,防止mac 地址欺骗。)
gi 0/0/1 dhcp snooping check dhcp-chaddr enable #开启chaddr检测
[] arp dhcp-snooping-detect enable
dhcp 安全防护 禁止用户手动配置静态ip地址,防止ip地址冲突(模拟器不支 持) 利用dhcp snooping 建立ip-mac-接口 的检查映射表项(适合 企业用户采用动态ip获取的企业)
接入交换机:
dis dhcp snooping user-bind all
s2700 EI(V100R005)
dis user-bind all
s3700(V200R001)
dis dhcp static user-bind all
int e0/0/1 (连接用户的接口)
ipsg 说明 :严格按照mac地址表项,如果mac 地址与IP地址及vlan编号还有接口不在mac地址表项中,则任为地址不合法。防止用户伪装其它用户攻击内网服务器。
ip source check user-bind enable(可以在接口下,可以在vlan 模式下使用, | check-item| ip| mac| vlan| interface )
注意在这种模式下,用户手动配置的IP是不允许的。
静态添加一个绑定(全局下)
user-bind static ip-address 192.168.31.7 mac-address 0021-cccf-1d28 interface Ethernet0/0/2 vlan 10
即可 接在e0/0/2口的PC 只能是31.7 mac是1d28 才可以 通过 e0/0/2口 若ip和mac 不匹配则报文将被直接丢弃 (模拟器bug 不支持)。
interface Ethernet0/0/2 ip source check user-bind enable
可选配置: 将dhcp snooping 动态绑定表项 保存到flash 防止重启丢失
[JIERU-SW1]dhcp snooping user-bind autosave flash:/backup.tbl |write-delay 5000
点击加载更多