WOLF-LAB沃尔夫网络实验室中国网络精英的发源地!
24小时咨询热线:173-1636-2402

技术文档

Technical documentation

您当前位置: 首页 > 技术文档 > 详情

EI CCNP怎么学DHCP欺骗攻击解决方案dhcp snooping-沃尔夫CCIE

发布日期:2022-04-14 浏览次数:1730 来源:杨广成

EI CCNP怎么学DHCP欺骗攻击解决方案dhcp snooping-沃尔夫CCIE

官方微信同电话:17316362402,可加EI CCNP培训学习群

WOLF-LAB沃尔夫提供免费CCNP培训基础课学习视频+资料+模拟器,联系客服获取


需求描述

1.      实验室交换机架登陆:

EI CCNP.png

Rack 99   192.168.9.99      

Rack 98   192.168.9.98

Rack 100  192.168.9.100

做实验之前,请重启设备,做完实验后,请勿保存。想要通过外网登陆机架请联系WOLFLAB,获取登陆方式。

1.      在sw1-sw2之间封装Trunk,配置R1的接口地址为1.1.1.1/24,配置R2的接口地址为1.1.1.2/24。在R1和R2上配置DHCP,默认网关分别指向R1和R2的接口地址。

SW1 SW2:

interface range f0/11-12

switchport trunk encapsulation dot1q

 switchport mode trunk

R1:

interface Ethernet0/0

 no shutdown

 ip address 1.1.1.1 255.255.255.0

 

ip dhcp pool POOL1        //假设R1作为合法的DHCP Server

   network 1.1.1.0 255.255.255.0

   default-router 1.1.1.1

   dns-server 8.8.8.8

 

ip dhcp excluded-address 1.1.1.100 1.1.1.254

R2:

interface Ethernet0

 no shutdown

 ip address 1.1.1.2 255.255.255.0

 

ip dhcp pool POOL2       //假设R2作为非法的DHCP Server

   network 1.1.1.0 255.255.255.0

   default-router 1.1.1.2

   dns-server 9.9.9.9

 

ip dhcp excluded-address 1.1.1.1 1.1.1.100   //R2 DHCP Server,向Client分地址,从1.1.1.101开始分配。

2.      配置R3和R4,作为DHCP的Client,观察R3和R4获取的ip地址。

R3 R4:

interface Ethernet0

 no shutdown

 ip address dhcp

 

R3#show ip inter brief

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0                  1.1.1.2         YES DHCP   up                    up 

 

R4#show ip inter brief

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0                  1.1.1.101         YES DHCP   up                    up  

 

解析:将R3和R4的接口shutwn/no shutdown多试几次,R3 R4获取的IP地址,可能是合法的DHCP Server R1分配的,也可能是非法的DHCP Server R2分配的。

3.      在sw1和sw2上配置dhcp snooping ,来解决DHCP的欺骗攻击。确保R3和R4获取的IP地址一定是合法的DHCP Server分配的地址。

SW1 SW2:

ip dhcp snooping

ip dhcp snooping vlan 1

 

interface range f0/11-12

 ip dhcp snooping trust    //配置SW1-SW2之间的Trunk为信任的接口

SW1:

interface f0/1

 ip dhcp snooping trust    //sw1的F0/1接口连接合法的DHCP Server,配置为信任的接口。

R1 R2:

ip dhcp relay information trust-all    //让R1 R2信任被中继的DHCP的消息。

4.      将R3和R4的接口shutwn/no shutdown,观察R3和R4获取的ip地址。

R3 R4:

interface Ethernet0

 no shutdown

 ip address dhcp

 

R3#show ip inter brief

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0                  1.1.1.5         YES DHCP   up                    up 

 

R4#show ip inter brief

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0                  1.1.1.6         YES DHCP   up                    up  

 

解析:此时R3和R4获取的IP地址,一定是合法的DHCP Server R1分配的地址。

5.      在sw2的F0/1接口开启IP源保护。

SW2:

interface FastEthernet0/1

 ip verify source   

//开启源保护后,检查从F0/1接口收到数据包的源IP地址,与SW2上的绑定表中的IP地址是否一致,一致转发,不一致,Drop掉。

 

interface FastEthernet0/1

 switchport mode access

 switchport port-security

 ip verify source port-security

//此种方法开启源保护,检查从F0/1接口收到数据包的源IP地址与Mac地址,与SW2上的绑定表中的IP地址与Mac地址是否一致,一致转发,不一致,Drop掉。

 

SW2#show ip source binding    //通过DHCP Snooping动态形成的绑定表

MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface

------------------  ---------------  ----------  -------------  ----  --------------------

00:50:73:6B:CD:2A   1.1.1.5          86385       dhcp-snooping   1     FastEthernet0/1

00:10:7B:80:47:C5    1.1.1.6          86385       dhcp-snooping   1     FastEthernet0/2

6.      如果此时配置R3的接口IP地址为1.1.1.30/24,此时在R3上ping R4的地址,是否可以通信?在SW2上静态绑定,在R3上ping R4可以通信。

R3:

interface Ethernet0

 ip address 1.1.1.30 255.255.255.0

 

R3#ping 1.1.1.6

Type escape sequence to abort.

.....       //此时是不通的。

SW2#

ip source binding 0050.736b.cd2a vlan 1 1.1.1.30 interface f0/1      //静态绑定

 

SW2#show ip source binding

MacAddress          IpAddress        Lease(sec)  Type           VLAN  Interface

------------------  ---------------  ----------  -------------  ----  --------------------

00:50:73:6B:CD:2A   1.1.1.30         infinite    static          1     FastEthernet0/1

00:10:7B:80:47:C5   1.1.1.6          85893     dhcp-snooping   1     FastEthernet0/2

7.      在sw2上启用DAI。配置R1接口的MAC地址为a.a.a,此时在R3上ping R4的地址,是否可以通信?

SW2:

ip arp inspection vlan 1

 

04:33:53: %SW_DAI-4-DHCP_SNOOPING_DENY: 1 Invalid ARPs (Req) on Fa0/1, vlan 1.([000a.000a.000a/1.1.1.30/0000.0000.0000/1.1.1.6/04:33:53 UTC Mon Mar 1 1993])

 

//此时是不通的。SW2上启用DAI后,接口均变成unstrust接口,SW2检查从untrust接口收到的ARP的消息是否与SW2上的绑定表一致。

8.      在sw1和sw2上配置RSPAN,监控sw1的F0/1接口双向流量,在sw2上将监控流量推送至F0/10接口。

SW1:

vlan 200

 remote-span

 

monitor session 1 source interface Fa0/1

monitor session 1 destination remote vlan 200 reflector-port Fa0/30

SW2:

vlan 200

 remote-span

 

monitor session 1 source remote vlan 200

monitor session 1 destination interface f0/10

欢迎关注WOLF-LAB:

我们会陆续更新思科CCNA,CCNP,EI CCIE;华为HCIA,HCIP,HCIE Datacom等培训考试学习视频,IT技术,学习技巧等

视频转码、资料等问题,可联系WOLF-LAB(沃尔夫)实验室进行更新!

http://www.wolf-lab.com/

返回目录
在线咨询