GRE VPN和MGRE VPN综合练习
- 实验拓扑

- 实验要求
1、R5为ISP,只能进行IP地址配置,其所有地址均配为公有IP地址;
2、R1和R5间使用PPP的PAP认证,R5为主认证方;
R2与R5之间使用ppp的CHAP认证,R5为主认证方;
R3与R5之间使用HDLC封装;
3、R1、R2、R3构建一个MGRE环境,R1为中心站点,R1、R4间为点到点的GRE;
4、整个私有网络基本RIP全网可达,
5、所有Pc设置私有IP为源IP,可以访问R5环回,达到全网通。
三、实验思路
1、对四台PC和五台路由器进行IP地址的配置
2、R1和R5间使用PPP的PAP认证,R5为主认证方 R5上配置aaa服务创建用户及密码R1在接口上选择身份验证模式PAP
3、R2与R5之间使用ppp的CHAP认证,R5为主认证方 R5上配置aaa R2在接口上选择身份验证模式CHAP
4、分别在R3R5上做HDLC封装
5、将公网内的网络实现全网通
6、R1、R2、R3构建一个MGRE环境,R1为中心站点,
7、R1、R4间为点到点的GRE
8、使用rip动态路由协议使所有私网地址和隧道地址进行路由学习
9、在R1\R2\R3\R4上做NAT地址转换技术(一对多)
四、实验步骤
1、IP地址配置
R1
r1\]int g0/0/0 \[r1-GigabitEthernet0/0/0\]ip add 192.168.1.254/24 \[r1-GigabitEthernet0/0/0\]int s3/0/0 \[r1-Serial3/0/0\]ip add 15.1.1.1 24 R2 \[r2\]int g 0/0/0 \[r2-GigabitEthernet0/0/0
r2-GigabitEthernet0/0/0\]ip add 192.168.2.254 24 \[r2-GigabitEthernet0/0/0\]int s 3/0/1 \[r2-Serial3/0/1\]ip add 25.1.1.1 24 R3 \[r3\]int g 0/0/0 \[r3-GigabitEthernet0/0/0\]ip add 192.168.3.254 24 \[r3-GigabitEthernet0/0/0\]int s 4/0/0 \[r3-Serial4/0/0\]ip add 35.1.1.1 24 R4 \[r4\]int g 0/0/0 \[r4-GigabitEthernet0/0/0\]ip add 192.168.4.254 24 \[r4-GigabitEthernet0/0/0\]int g 0/0/1 \[r4-GigabitEthernet0/0/1\]ip add 45.1.1.1 24 R5 \[ISP\]int Serial 3/0/0 \[ISP-Serial3/0/0\]ip add 15.1.1.2 24 \[ISP-Serial3/0/0\]int s 3/0/1 \[ISP-Serial3/0/1\]ip add 25.1.1.2 24 \[ISP-Serial3/0/1\]int s 4/0/0 \[ISP-Serial4/0/0\]ip add 35.1.1.2 24 \[ISP-Serial4/0/0\]int g 0/0/1 \[ISP-GigabitEthernet0/0/1\]ip add 45.1.1.2 24 \[ISP-GigabitEthernet0/0/1\]int l 0 \[ISP-LoopBack0\]ip add 5.5.5.5 24 2、R1和R5间使用PPP的PAP认证,R5为主认证方 首先需要在R5上通过aaa服务建立用户和密码,进入对应接口选择身份验证模式 \[ISP\]aaa \[ISP-aaa\]local-user liu password cipher 111 \[ISP-aaa\]local-user liu service-type ppp \[ISP\]int Serial 3/0/0 \[ISP-Serial3/0/0\]ppp authentication-mode pap 然后我们先不在R1上做认证,重启链路看看效果  可以看到因为R1上没做pap认证导致接口的链路层协议down 所以在R1上也要做pap认证 \[r1-Serial3/0/0\]ppp pap local-user liu password cipher 111 然后我们再来测试一下  这里我们可以很明显的观察到物理层和数据链路层双up 3、R2与R5之间使用ppp的CHAP认证,R5为主认证方 首先需要在R5上通过aaa服务建立用户和密码,进入对应接口选择身份验证模式 \[ISP\]aaa \[ISP-aaa\]local-user liu password cipher 111 \[ISP-aaa\]local-user liu service-type ppp \[ISP\]int s 3/0/1 \[ISP-Serial3/0/1\]ppp authentication-mode chap 然后再R2上做chap认证 \[r2\]int s 3/0/1 \[r2-Serial3/0/1\]ppp chap user liu \[r2-Serial3/0/1\]ppp chap password cipher 111 4、R3与R5之间使用HDLC封装 \[ISP\]int s 4/0/0 \[ISP-Serial4/0/0\]link-protocol hdlc Warning: The encapsulation protocol of the link will be changed. Continue? \[Y/N
:y
r3\]int s 4/0/0 \[r3-Serial4/0/0\]link-protocol hdlc Warning: The encapsulation protocol of the link will be changed. Continue? \[Y/N
:y
5、将公网内的网络实现全网通
在R1\R2\R3\R4做一条指向公网的缺省路由
r1\]ip route-static 0.0.0.0 0 15.1.1.2 \[r2\]ip route-static 0.0.0.0 0 25.1.1.2 \[r3\]ip route-static 0.0.0.0 0 35.1.1.2 \[r4\]ip route-static 0.0.0.0 0 45.1.1.2 6、R1、R2、R3构建一个MGRE环境,R1为中心站点, 1)首先要分别在R1\\R2\\R3上做隧道接口 R1 \[r1\]int Tunnel 0/0/0 \[r1-Tunnel0/0/0\]ip add 10.1.1.1 24 \[r1-Tunnel0/0/0\]tunnel-protocol \[r1-Tunnel0/0/0\]tunnel-protocol gre p2mp \[r1-Tunnel0/0/0\]source 15.1.1.1 Jul 25 2024 21:32:15-08:00 r1 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. \[r1-Tunnel0/0/0\]nhrp network-id 100 R2、 \[r2\]int Tunnel 0/0/0 \[r2-Tunnel0/0/0\]ip add 10.1.1.2 24 \[r2-Tunnel0/0/0\]tunnel-protocol gre p2mp \[r2-Tunnel0/0/0\]source Serial 3/0/1 Jul 25 2024 21:34:48-08:00 r2 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. \[r2-Tunnel0/0/0\]nhrp network-id 100 \[r2-Tunnel0/0/0\]nhrp entry 10.1.1.1 15.1.1.1 register R3、 \[r3\]int Tunnel 0/0/0 \[r3-Tunnel0/0/0\]ip add 10.1.1.3 24 \[r3-Tunnel0/0/0\]tunnel-protocol gre p2mp \[r3-Tunnel0/0/0\]source Serial 4/0/0 Jul 25 2024 21:39:50-08:00 r3 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. \[r3-Tunnel0/0/0\]nhrp network-id 100 \[r3-Tunnel0/0/0\]nhrp entry 10.1.1.1 15.1.1.1 register 2)用rip动态路由协议将私网网段搞通 \[r2\]rip 1 \[r2-rip-1\]v 2 \[r2-rip-1\]undo summary \[r2-rip-1\]network 192.168.2.0 \[r2-rip-1\]network 10.0.0.0 其他同上 3)在R1上开启伪广播 \[r1\]int Tunnel 0/0/0 \[r1-Tunnel0/0/0\]nhrp entry multicast dynamic 4)关闭rip的水平分割 \[r1-Tunnel0/0/0\]undo rip split-horizon 7、R1、R4间为点到点的GRE 1)配置gre所需的隧道接口 \[r1\]int Tunnel 0/0/1 \[r1-Tunnel0/0/1\]ip add 10.1.2.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 Jul 25 2024 23:27:01-08:00 r1 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state. R4 \[r4\]int Tunnel 0/0/1 \[r4-Tunnel0/0/1\]ip add 10.1.2.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 Jul 25 2024 23:28:05-08:00 r4 %%01IFNET/4/LINK_STATE(l)\[0\]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state. 8、所有Pc设置私有IP为源IP,可以访问R5环回,达到全网通。 1)使用NAT技术,将私网转换成公网(一对多) 2)首先需要抓取私网流量 R1 \[r1\]acl 2000 \[r1-acl-basic-2000\]rule permit source 192.168.1.0 0.0.0.255 \[r1-acl-basic-2000\]q \[r1\]int s 3/0/0 \[r1-Serial3/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-acl-basic-2000\]q \[r2\]int s 3/0/1 \[r2-Serial3/0/1\]nat outbound 2000 R3 \[r3\]acl 2000 \[r3-acl-basic-2000\]rule permit source 192.168.3.0 0.0.0.255 \[r3-acl-basic-2000\]q \[r3\]int s 4/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-acl-basic-2000\]q \[r4\]int g 0/0/1 \[r4-GigabitEthernet0/0/1\]nat outbound 2000 测试: 