【HCL】dhcp

这个任务主要是做DHCP Snooping。
DHCP服务器在路由器上,而SWA上有3个VLAN,分属于3个不同网段,
DHCP的请求报文是广播,因此必须在SWA上设置中继才能够传到路由器。
伪DHCP Server已经配置好,将发布172.22.1.1-99的地址池,网关172.22.1.254,DNS 9.9.9.9

配置步骤
(1) # 配置路由器。
<H3C> system-view
[H3C] interface g 0/0
[[H3C-GigabitEthernet0/0]] ip address 10.1.1.2 30
[[H3C-GigabitEthernet0/0]] quit
#启用 DHCP 服务。
[H3C] dhcp enable

#配置 DHCP 地址池 1,为来自 192.168.1.0/24网段内的客户端分配地址。
[H3C] dhcp server ip-pool 1
[H3C-dhcp-pool-0] network 192.168.10.0 mask 255.255.255.0
[H3C-dhcp-pool-0] dns-list 8.8.8.8
[H3C-dhcp-pool-0] gateway-list 192.168.10.254
[H3C-dhcp-pool-0] quit

#配置DHCP 地址池 2,为来自 192.168.20.0/24网段内的客户端分配地址。
[H3C] dhcp server ip-pool 2
[H3C-dhcp-pool-0] network 192.168.20.0 mask 255.255.255.0
[H3C-dhcp-pool-0] dns-list 8.8.8.8
[H3C-dhcp-pool-0] gateway-list 192.168.20.254
[H3C-dhcp-pool-0] quit

配置DHCP 地址池 3,为来自 192.168.30.0/24网段内的客户端分配地址。
[H3C] dhcp server ip-pool 3
[H3C-dhcp-pool-0] network 192.168.30.0 mask 255.255.255.0
[H3C-dhcp-pool-0] dns-list 8.8.8.8
[H3C-dhcp-pool-0] gateway-list 192.168.30.254
[H3C-dhcp-pool-0] quit

#配置静态路由到192.168.0.0/16网段
[H3C]ip route-static 192.168.0.0 16 10.1.1.1

(2)# 配置 SWA交换机。
#建立vlan,并且配置各接口的 IP 地址。
<H3C> system-view
[H3C]vlan 10
[H3C-vlan10]quit
[H3C]vlan 20
[H3C-vlan20]quit
[H3C]vlan 30
[H3C-vlan30]quit

[H3C]inter range g 1/0/1 to g 1/0/5
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 10
[H3C-if-range]quit
[H3C]inter range g 1/0/6 to g 1/0/10
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 20
[H3C-if-range]quit
[H3C]inter range g 1/0/11 to g 1/0/15
[H3C-if-range]port link-type access
[H3C-if-range]port access vlan 30
[H3C-if-range]quit

[H3C]inter vlan 10
[H3C-Vlan-interface10]ip add 192.168.10.254 24
[H3C-Vlan-interface10]quit
[H3C]inter vlan 20
[H3C-Vlan-interface20]ip add 192.168.20.254 24
[H3C-Vlan-interface20]quit
[H3C]inter vlan 30
[H3C-Vlan-interface30]ip add 192.168.30.254 24
[H3C-Vlan-interface30]quit
[H3C]
[H3C]inter g 1/0/23
[H3C-GigabitEthernet1/0/23]port link-t
[H3C-GigabitEthernet1/0/23]ip add 10.1.1.1 30
[H3C-GigabitEthernet1/0/23]quit

(3)#配置DHCP中继(SWA交换机)
#启用 DHCP 服务。
[H3C] dhcp enable

#配置 VLAN 接口 10 工作在 DHCP 中继模式。
[H3C] interface vlan-interface 10
[H3C-Vlan-interface10] dhcp select relay
#配置 DHCP 服务器的地址。
[H3C-Vlan-interface10] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface10] quit
【HCL】dhcp

#配置 VLAN 接口 20 工作在 DHCP 中继模式。
[H3C] interface vlan-interface 20
[H3C-Vlan-interface20] dhcp select relay
[H3C-Vlan-interface20] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface20] quit

#配置 VLAN 接口 30 工作在 DHCP 中继模式。
[H3C] interface vlan-interface 30
[H3C-Vlan-interface30] dhcp select relay
[H3C-Vlan-interface30] dhcp relay server-address 10.1.1.2
[H3C-Vlan-interface30] quit

(4)#配置DHCP Snooping(SWB交换机)
#启用DHCP Snooping 功能。
[H3C] dhcp snooping enable
#设置GigabitEthernet1/0/21 端口为信任端口。
[H3C] interface GigabitEthernet 1/0/21
[H3C-GigabitEthernet1/0/21] dhcp snooping trust
[H3C-GigabitEthernet1/0/21] quit
#在GigabitEthernet1/0/1 上启用 DHCP Snooping 表项功能。
[H3C] interface GigabitEthernet 1/0/1
[H3C-GigabitEthernet1/0/1] dhcp snooping binding record
[H3C-GigabitEthernet1/0/1] quit

解决IP地址冲突的完美方法--DHCP SNOOPING 使用的方法是采用DHCP方式为用户分配IP,然后限定这些用户只能使用动态IP的方式,如果改成静态IP的方式则不能连接上网络;也就是使用了DHCP SNOOPING功能。 例子: version 12.1 no service pad service timestamps debug uptime service timestamps log uptime no service password-encryption service compress-config ! hostname C4-2_4506 ! enable password xxxxxxx! clock timezone GMT 8 ip subnet-zero no ip domain-lookup ! ip dhcp snooping vlan 180-181 // 对哪些VLAN 进行限制 ip dhcp snooping ip arp inspection vlan 180-181 ip arp inspection validate src-mac dst-mac ip errdisable recovery cause udld errdisable recovery cause bpduguard errdisable recovery cause security-violation errdisable recovery cause channel-misconfig errdisable recovery cause pagp-flap errdisable recovery cause dtp-flap errdisable recovery cause link-flap errdisable recovery cause l2ptguard errdisable recovery cause psecure-violation errdisable recovery cause gbic-invalid errdisable recovery cause dhcp-rate-limit errdisable recovery cause unicast-flood errdisable recovery cause vmps errdisable recovery cause arp-inspection errdisable recovery interval 30 spanning-tree extend system-id ! ! interface GigabitEthernet2/1 // 对该端口接入的用户进行限制,可以下联交换机 ip arp inspection limit rate 100 arp timeout 2 ip dhcp snooping limit rate 100 ! interface GigabitEthernet2/2 ip arp inspection limit rate 100 arp timeout 2 ip dhcp snooping limit rate 100 ! interface GigabitEthernet2/3 ip arp inspection limit rate 100 arp timeout 2 ip dhcp snooping limit rate 100 ! interface GigabitEthernet2/4 ip arp inspection limit rate 100 arp timeout 2 ip dhcp snooping limit rate 100 --More-- 编者注:对不需要明确地址的所有人的时候是一个很好的解决办法。另外,可以查看www.cisco.com的 IP Source Guard Similar to DHCP snooping, this feature is enabled on a DHCP snooping untrusted Layer 2 port. Initially, all IP traffic on the port is blocked except for DHCP packets that are captured by the DHCP snooping process. When a client receives a valid IP address from the DHCP server, or when a static IP source binding is configured by the user, a per-port and VLAN Access Control List (PACL) is installed on the port. This process restricts the client IP traffic to those source IP addresses configured in the binding; any IP traffic with a source IP address other than that in the IP source binding will be filtered out. This filtering limits a host's ability to attack the network by claiming neighbor host's IP address.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值