一、实验拓扑
二、实验要求
1、按照图示配置IP地址
2、在R1和R3上配置默认路由使公网区域互通
3、在R1和R3上配置GRE VPN,使两端私网能够互相访问,Tunnel口IP地址如图
4、在R1和R3上配置RIPv2或者ospf或者静态,来传递两端私网路由
三、实验思路
1、给设备配置IP地址
2、实现公网、私网通
3、在公网通基础上创建GRE VPN
4、配置路由协议传递两端私网路由
四、实验配置
1、配置IP地址
R1:
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 24
R2:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.2.2.2 24
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.2.2.3 24
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.2.254 24
2、配置静态路由(静态缺省),实现公网通
[R1]ip route-static 0.0.0.0 0 100.1.1.2
[R3]ip route-static 0.0.0.0 0 100.2.2.2
测试:R3 ping R1
3、配置GRE VPN,创建隧道
R1:
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 192.168.3.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]source 100.1.1.1
[R1-Tunnel0/0/0]destination 100.2.2.3
R3:
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 192.168.3.3 24
[R3-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]source 100.2.2.3
[R3-Tunnel0/0/0]destination 100.1.1.1
用ping -a测试,确定源目IP地址
4、方法一:配置静态路由,实现私网路由互通
[R1]ip route-static 192.168.2.0 24 192.168.3.3
[R3]ip route-static 192.168.1.0 24 192.168.3.1
测试:
查看路由表可得传递两端私网路由的途径:
5、方法二:配置RIPv2,实现私网路由互通
[R1]undo ip route-static 192.168.2.0 24 192.168.3.3
[R3]undo ip route-static 192.168.1.0 24 192.168.3.1
R1:
[R1]rip 1
[R1-rip-1]v 2
[R1-rip-1]undo summary
[R1-rip-1]network 192.168.3.0
[R1-rip-1]network 192.168.1.0
R3:
[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]undo summary
[R3-rip-1]network 192.168.3.0
[R3-rip-1]network 192.168.2.0
6、方法三:配置静态路由,实现私网路由互通
[R1]undo rip 1
[R3]undo rip 1
R1:
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
R3:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255