一、實驗拓撲
二、實驗要求
1、按照圖示配置IP地址
2、在R1和R3上配置默認路由使公網區域互通
3、在R1和R3上配置GRE VPN,使兩端私網能夠互相訪問,Tunnel口IP地址如圖
4、在R1和R3上配置RIPv2或者ospf或者靜態,來傳遞兩端私網路由
三、實驗步驟
1、配置IP地址部分
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.2 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.1.2 24
[R2-GigabitEthernet0/0/0]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-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.2.3 24
?
2、在R1和R3上配置默認路由使公網區域互通
[R1]ip route-static 100.2.2.0 24 100.1.1.2
[R3]ip route-static 100.1.1.0 24 100.2.2.2
3、在R1和R3上配置GRE VPN,使兩端私網能夠互相訪問,Tunnel口IP地址如圖
分析:根據需求,需要在R1和R3上創建GRE Tunnel口,配置源地址和目的地址為本端公網地址和對端公網地址。
Step 1:在R1上創建Tunnel口,設置隧道協議為GRE,源地址:本端公網地址,目的地址:對端公網地址
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]tunnel-protocol gre
R1-Tunnel0/0/0]ip add 192.168.3.1 24
[R1-Tunnel0/0/0]source 100.1.1.1
[R1-Tunnel0/0/0]destination 100.2.2.3
[R1]dis ip int b
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.2/24 up up
GigabitEthernet0/0/1 100.1.1.1/24 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
Tunnel0/0/0 192.168.3.1/24 up up
?Step2:在R3上創建Tunnel口,模式為GRE,源地址:本端公網地址,目的地址為:對端公網地址。
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip address 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
[R3]dis ip int br
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 100.2.2.3/24 up up
GigabitEthernet0/0/1 192.168.2.3/24 up up
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
Tunnel0/0/0 192.168.3.3/24 up up
4、在R1和R3上配置RIPv2或者ospf或者靜態,來傳遞兩端私網路由
分析:R1和R3通過RIP來傳遞私網路路由,由于私網報文要通過VPN隧道口傳輸,所以需要把Tunnel口宣告進RIP,使R1和R3通過Tunnel口傳遞路由.
Step1:在R1上配置RIP,宣告業務網段和Tunnel口網段
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]undo summary
[R1-rip-1]network 192.168.1.0
[R1-rip-1]net 192.168.3.0
[R1-rip-1]quit
Step2:在R3上配置RIP,宣告業務網段和Tunnel口網段
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]undo summary
[R3-rip-1]net 192.168.3.0
[R3-rip-1]net 192.168.2.0
[R3-rip-1]quit
效果測試:在PC1上Ping PC2,可以Ping通
在R1上pingR3的隧道口,可以ping通
實驗中需要注意的是:在配置RIPv2的過程中,需刪除對匯總進行刪除,以防止路由環路。