GRE和MGRE综合实验

一、实验拓扑图

二、实验需求

  1. R5为ISP,只能进行IP地址配置;其所有地址均配为公有IP地址;

  2. R1和R5间使用PPP的PAP认证,R5为主认证方;

R2与R5之间使用PPP的chap认证,R5为主认证方;

R3与R5之间使用HDLC封装;

  1. R1/R2/R3构建一个MGRE环境,R1为中心站点;R1、R4间为点到点的GRE;

  2. 整个私有网络基于RIP全网可达;

  3. 所有PC设置私有IP为源IP,可以访问R5环回。

三、实验思路

1、配置IP及环回口;

2、配置缺省路由,使公网能互通;

3、R1和R5之间使用PPP的PAP认证,R5为主认证方;

4、R2和R5之间使用PPP的CHAP认证,R5为主认证方;

5、R3与R5之间使用HDLC封装;

6、 构建MGRE、GRE环境;

7、 整个私有网络基于RIP全网可达;

8、所有PC设置私有IP为源IP,可以访问R5环回。----做easy IP

四、实验步骤

1、配IP

PC1

PC2

PC3

PC4

R1

R1\]int g0/0/0 \[R1-GigabitEthernet0/0/0\]ip add 192.168.1.1 24 \[R1-GigabitEthernet0/0/0\]int s4/0/0 \[R1-Serial4/0/0\]ip add 15.1.1.1 24 查看: ![](https://i-blog.csdnimg.cn/direct/2d7b83fdd1434665a97fee52a90ed9bc.png) R2 \[R2\]int g0/0/0 \[R2-GigabitEthernet0/0/0\]ip add 192.168.2.1 24 \[R2-GigabitEthernet0/0/0\]int s4/0/0 \[R2-Serial4/0/0\]ip add 25.1.1.1 24 查看: ![](https://i-blog.csdnimg.cn/direct/e77fc171f0904994bd1c3213c424acd8.png) R3 \[R3\]int g0/0/0 \[R3-GigabitEthernet0/0/0\]ip add 192.168.3.1 24 \[R3-GigabitEthernet0/0/0\]int s4/0/0 \[R3-Serial4/0/0\]ip add 35.1.1.1 24 查看: ![](https://i-blog.csdnimg.cn/direct/8d8fb06bea8c4905a279b40e690f8643.png) R4 \[R4\]int g0/0/0 \[R4-GigabitEthernet0/0/0\]ip add 192.168.4.1 24 \[R4-GigabitEthernet0/0/0\]int g0/0/1 \[R4-GigabitEthernet0/0/1\]ip add 45.1.1.1 24 查看: ![](https://i-blog.csdnimg.cn/direct/99f2aabf267643afa13faaa8cdc82e4e.png) R5 \[R5\]int g0/0/0 \[R5-GigabitEthernet0/0/0\]ip add 45.1.1.2 24 \[R5\]int s4/0/0 \[R5-Serial4/0/0\]ip add 35.1.1.2 24 \[R5-Serial4/0/0\]int s3/0/0 \[R5-Serial3/0/0\]ip add 15.1.1.2 24 \[R5-Serial3/0/0\]int s3/0/1 \[R5-Serial3/0/1\]ip add 25.1.1.2 24 查看: ![](https://i-blog.csdnimg.cn/direct/833f158569414e81ae98417902cebab5.png) **2、配环回口** R5 \[R5\]int l 0 \[R5-LoopBack0\]ip add 5.5.5.5 24 查看: ![](https://i-blog.csdnimg.cn/direct/3912f971f358418a84f4266f2082d06d.png) **3、配缺省** R1 \[R1\]ip route-static 0.0.0.0 0 15.1.1.2 R2 \[R2\]ip route-static 0.0.0.0 0 25.1.1.2 R3 \[R3\]ip route-static 0.0.0.0 0 35.1.1.2 R4 \[R4\]ip route-static 0.0.0.0 0 45.1.1.2 **4、使R1和R5(ISP)之间使用PPP的PAP认证,并且R5为主认证方** ![](https://i-blog.csdnimg.cn/direct/a6d1d0f6128f4b38bc2dc44e0db454c3.png) ![](https://i-blog.csdnimg.cn/direct/61b9da435b084c0f95cecf522ed371a4.png) 可以看到华为设备默认采用了PPP协议 主认证方配置(R5): \[ISP\]aaa \[ISP-aaa\]local-user wangdaye password cipher 123456 \[ISP-aaa\]local-user wangdaye service-type ppp----进入aaa,创建认证使用的用户和密码 \[ISP-aaa\]q \[ISP\]int s 3/0/0 \[ISP-Serial3/0/0\]ppp authentication-mode pap----配置PAP 被认证方配置(R1): \[R1\]int s4/0/0 \[R1-Serial4/0/0\]ppp pap local-user wangdaye password cipher 123456 测试: 断开ISP(R5)会话,重启启动认证(因为R5已经建立了会话连接): \[ISP\]int s3/0/0 \[ISP-Serial3/0/0\]shutdown \[ISP-Serial3/0/0\]undo shutdown ping 15.1.1.1测试: ![](https://i-blog.csdnimg.cn/direct/0baa249d5f784b829b7cef39597f03ec.png) ping 15.1.1.2测试: ![](https://i-blog.csdnimg.cn/direct/38f82e2479a545e582fb73d6852db968.png) **5、使R2和R5之间使用PPP的CHAP认证,R5为主认证方** 主认证方的配置: R5因为刚刚已经创建了认证使用的用户名和密码,所以不用再次创建 \[ISP\]int s3/0/1 \[ISP-Serial3/0/1\]ppp authentication-mode chap 被认证方的配置: \[R2\]int s4/0/0 \[R2-Serial4/0/0\]ppp chap user wangdaye \[R2-Serial4/0/0\]ppp chap password cipher 123456 测试: \[ISP\]int s3/0/1 \[ISP-Serial3/0/1\]shutdown \[ISP-Serial3/0/1\]undo shutdown ping 25.1.1.1测试: ![](https://i-blog.csdnimg.cn/direct/16dbc4ba87ee445e9b5e3144ce24196c.png) ping 25.1.1.2测试: ![](https://i-blog.csdnimg.cn/direct/c81288c783b04e0f9062fd616102e964.png) **6、让R3与R5之间使用HDLC封装** 只需修改双方接口的协议即可,两边接口必须相同才能通信,否则不会进行通信 R5(ISP) \[ISP\]int s4/0/0 \[ISP-Serial4/0/0\]link-protocol hdlc 查看: ![](https://i-blog.csdnimg.cn/direct/83df812410d54082b5f5e8c4149a563e.png) ![](https://i-blog.csdnimg.cn/direct/32ff5ce80a974780b049e730e3941537.png) R3 \[R3\]int s4/0/0 \[R3-Serial4/0/0\]link-protocol hdlc 查看: ![](https://i-blog.csdnimg.cn/direct/4186cf36646048ad99997c6e0588a08e.png) ![](https://i-blog.csdnimg.cn/direct/b45333a426494a16bee2794eb1968792.png) 测试: ![](https://i-blog.csdnimg.cn/direct/3d7cd2c441c546c587a658f6924292da.png) ![](https://i-blog.csdnimg.cn/direct/cd212466d57243d48df566b312151f82.png) **7、 构建MGRE、GRE环境** **(1)R1/R2/R3构建一个MGRE环境,R1为中心站点** **R1/R2/R3MGRE配置使用10.1.2.0/24网段** 配置总部与分部之间的隧道: R1(中心站点,2.1/24) \[R1\]int Tunnel 0/0/0----创建隧道接口 \[R1-Tunnel0/0/0\]ip add 10.1.2.1 24----配置IP地址 \[R1-Tunnel0/0/0\]tunnel-protocol gre p2mp ----选择配置方法 \[R1-Tunnel0/0/0\]source 15.1.1.1----定义源IP地址(也可以直接用接口来代替) R2(2.2/24) \[R2\]int Tunnel 0/0/0 \[R2-Tunnel0/0/0\]ip add 10.1.2.2 24 \[R2-Tunnel0/0/0\]tunnel-protocol gre p2mp \[R2-Tunnel0/0/0\]source 25.1.1.1 R3(2.3/24) \[R3\]int Tunnel 0/0/0 \[R3-Tunnel0/0/0\]ip add 10.1.2.3 24 \[R3-Tunnel0/0/0\]tunnel-protocol gre p2mp \[R3-Tunnel0/0/0\]source 35.1.1.1 NHRP的配置: R1(中心站点) \[R1\]int Tunnel 0/0/0 \[R1-Tunnel0/0/0\]nhrp network-id 100----创建NHRP域,获取目标IP R2 \[R2-Tunnel0/0/0\]nhrp network-id 100 \[R2-Tunnel0/0/0\]nhrp entry 10.1.2.1 15.1.1.1 register R3 \[R3-Tunnel0/0/0\]nhrp network-id 100 \[R3-Tunnel0/0/0\]nhrp entry 10.1.2.1 15.1.1.1 register 查看NHRP注册信息: ![](https://i-blog.csdnimg.cn/direct/f05f65df78484546a13c8c20432ef27a.png) **(2)R1、R4间为点到点的GRE** **R1和R4之间GRE配置使用10.1.1.0/24网段** R1(10.1.1.1/24) \[R1\]int Tunnel 0/0/1 \[R1-Tunnel0/0/1\]ip add 10.1.1.1 24 \[R1-Tunnel0/0/1\]tunnel-protocol gre \[R1-Tunnel0/0/1\]source 15.1.1.1 \[R1-Tunnel0/0/1\]destination 45.1.1.1----这里的source和destination是真实的物理线路 R4(10.1.1.2/24) \[R4\]int Tunnel 0/0/1 \[R4-Tunnel0/0/1\]ip add 10.1.1.2 24 \[R4-Tunnel0/0/1\]tunnel-protocol gre \[R4-Tunnel0/0/1\]source 45.1.1.1 \[R4-Tunnel0/0/1\]destination 15.1.1.1----这里不要写成description **8、 整个私有网络基于RIP全网可达** **(1)MGRE** R1 \[R1\]rip 1 \[R1-rip-1\]version 2 \[R1-rip-1\]undo summary \[R1-rip-1\]network 192.168.1.0 \[R1-rip-1\]network 10.0.0.0----RIP要求宣告主类网络地址 R2 \[R2\]rip 1 \[R2-rip-1\]version 2 \[R2-rip-1\]undo summary \[R2-rip-1\]network 192.168.2.0 \[R2-rip-1\]network 10.0.0.0 R3 \[R3\]rip 1 \[R3-rip-1\]version 2 \[R3-rip-1\]undo summary \[R3-rip-1\]network 192.168.3.0 \[R3-rip-1\]network 10.0.0.0 开启伪广播 当我们配置好了过后我们发现除了R1有路由外,R2和R3都没有路由,这是为什么呢? 这是因为我们的MGRE构建出来这个网络类似一个NBMA网络,它是不支持广播和组播的。 ****解决方法:在中心上开启伪广播,目的:告诉分支站点,中心站点及其他分支站点的私网网段信息。**** \[R1\]interface Tunnel 0/0/0 \[R1-Tunnel0/0/0\]nhrp entry multicast dynamic 关闭水平分割 发现其他路由表都只有R1的路由表中的信息,这是因为华为设备默认RIP的环回机制----水平分割导致的,我们只需要关闭它即可。 \[R1-Tunnel0/0/0\]undo rip split-horizon \[R2-Tunnel0/0/0\]undo rip split-horizon \[R3-Tunnel0/0/0\]undo rip split-horizon 查看: ![](https://i-blog.csdnimg.cn/direct/db13c75e9ce54004b0a322a241ae646a.png) ![](https://i-blog.csdnimg.cn/direct/068da42e69c94e9d822212c052cb49d7.png) ![](https://i-blog.csdnimg.cn/direct/25f29d805cd142009e36234e96b83948.png) 测试: ![](https://i-blog.csdnimg.cn/direct/eeb9cc8fea454058ae2e09a9b8c7691a.png) ![](https://i-blog.csdnimg.cn/direct/d1c620cfe2c94a6784ccaf1c11c11e6c.png) ![](https://i-blog.csdnimg.cn/direct/c3e6d58215e14ad3b7a04b96d7406d38.png) **(2)GRE** R1在MGRE时已经配置RIP,R4的主类网络地址也已宣告,如果R4是其他的主类网络地址则需宣告。 R4 \[R4\]rip 1 \[R4-rip-1\]version 2 \[R4-rip-1\]undo summary \[R4-rip-1\]network 192.168.4.0 \[R4-rip-1\]network 10.0.0.0 注:这里只宣告私有网段 查看: ![](https://i-blog.csdnimg.cn/direct/40d5b53177fe4f2a8a5b4312ddafdbdc.png) 测试: ![](https://i-blog.csdnimg.cn/direct/f8a80552af9c461992d754c48b2f68ca.png) **9、所有PC设置私有IP为源IP,可以访问R5环回** R1 \[R1\]acl 2000 \[R1-acl-basic-2000\]rule permit source 192.168.1.0 0.0.0.255 \[R1\]int s4/0/0 \[R1-Serial4/0/0\]nat outbound 2000 R2 \[R2\]acl 2000 \[R2-acl-basic-2000\]rule permit source 192.168.2.0 0.0.0.255 \[R2\]int s4/0/0 \[R2-Serial4/0/0\]nat outbound 2000 R3 \[R3\]acl 2000 \[R3-acl-basic-2000\]rule permit source 192.168.3.0 0.0.0.255 \[R3\]int s4/0/0 \[R3-Serial4/0/0\]nat outbound 2000 R4 \[R4\]acl 2000 \[R4-acl-basic-2000\]rule permit source 192.168.4.0 0.0.0.255 \[R4\]int g0/0/1 \[R4-GigabitEthernet0/0/1\]nat outbound 2000 测试: ![](https://i-blog.csdnimg.cn/direct/72fc572338b04366ba4c3cb5f71fc61f.png) ![](https://i-blog.csdnimg.cn/direct/3b8d1116824144a69c161ec0f3d57af2.png) ![](https://i-blog.csdnimg.cn/direct/7009518fad8c449694b7defc0366bae5.png) ![](https://i-blog.csdnimg.cn/direct/b34a151bbf6547adae9d0253ce839e2a.png)