首页 > 其他分享 >思科CCNP学习DHCP协议与DHCP中继的配置解析

思科CCNP学习DHCP协议与DHCP中继的配置解析

时间:2022-10-20 19:32:56浏览次数:41  
标签:R4 CCNP 1.1 R3 ip 思科 dhcp DHCP

感谢关注WOLFLAB网络实验室,我们陆续都会发布更多CCNP相关技术!

思科CCNP学习DHCP协议与DHCP中继的配置解析

思科CCNP学习DHCP协议与DHCP中继的配置解析_mac地址

需求描述

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

Rack 99   192.168.9.99      

Rack 98   192.168.9.98

Rack 100  192.168.9.100

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

2.      在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开始分配。

3.      配置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  

 

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

4.      在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    //sw1F0/1接口连接合法的DHCP Server,配置为信任的接口。

R1 R2:

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

5.      将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  

 

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

6.      在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

7.      如果此时配置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

8.      在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上的绑定表一致。

9.      在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

关注WOLFLAB网络实验室,了解更多CCNP相关技术!

标签:R4,CCNP,1.1,R3,ip,思科,dhcp,DHCP
From: https://blog.51cto.com/u_14530179/5780466

相关文章

  • 华为AirEngine 5760-22W Web示例(V200R021C00SPC200版本):NAT网关模式(DHCP方式入网)【
    说明:此版本存在一些默认的WLAN无线业务配置,AP上电启动后,默认创建名称为“HUAWEI-XXXX”的SSID,其中XXXX是APMAC地址的后四位。默认无线业务覆盖使用无认证方式,用户搜索到该......
  • DHCP
    视频:https://www.bilibili.com/video/BV1dv41187jb/?spm_id_from=333.337.search-card.all.click&vd_source=3bdaecff10bd344788cc194461374709介绍  组成  报......
  • 思科设备routing policy配置命令
    1.修改EIGRP路由条目的AD值Cisco(config)#access-list1permit2.2.2.2Cisco(config)#routereigrp90Cisco(config-router)#distance13012.1.1.20.0.0.01 Cisc......
  • Wireshark Lab: DHCP v7.0
    0.实验文件地址WiresharkLab:DHCPv7.0DHCP:动态主机配置协议。允许主机自动获取(被分配)一个IP地址(即插即用)。还允许一台主机得知其他信息,例如它的子网掩码、它的第一跳......
  • 思科aspire对话
    Welcome.It'sgreattoseeyouWe'vebeensobusyremodelingthatwehaven'thadtimetogetthePCssetup.Woulditbetoomuchtoaskyoutogetthemandset......
  • 思科3850交换机从16.3.x到16.x安装模式下固件升级
    今天收到一个需求,把一台思科交换机3850做一个固件升级,这个活咱都干过N多次了,都不叫事。常规操作,但是故事就发生了。先说过程吧,确认设备的具体型号。Showversion其实那个型......
  • DHCP原理与配置
    一、DHCP服务1.DHCP DynamicHostConfigurationProtocol,动态主机配置协议专门用于为TCP/IP网络中的计算机自动分配TCP/IP参数的协议2.DHCP的优点•减少管理员的......
  • 思科设备路由重发布配置命令
    Cisco(config)#routereigrp90Cisco(config-router)#redistributeospf110metric100000100025511500 //将OSPF重发布到EIGRPCisco(config)#routerospf110Ci......
  • 思科与华为设备OSPF配置命令对比
    思科与华为设备OSPF配置命令对比[Huawei]ospf1//启动OSPF进程,进入OSPF视图Cisco(config)#routerospf110[Huawei]ospf1router-id10.1.1.1//启动OSPF进程,进入OSPF......
  • 思科设备OSPF配置命令
    Cisco(config)#routerospf110 Cisco(config-router)#router-id1.1.1.1 Cisco(config-router)#network20.1.1.00.0.0.255area0Cisco#showipospfneighborCis......