第一步
给PC1配置:
先给PC2配置:
第二部
给R1的接口配置ip
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.252 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip ad 100.1.1.1 24
给R2的接口配置IP
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad 100.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip ad 100.2.2.2 24
给R3的接口配置IP
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad 100.2.2.3 24
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip ad 192.168.2.252 24
弄公网通
给R1和R3配置静态路由
[R1]ip ro
[R1]ip route-s
[R1]ip route-static 0.0.0.0 0 100.1.1.2
[R3]ip rou
[R3]ip route-s
[R3]ip route-static 0.0.0.0 0 100.2.2.2
建立隧道口
[R1]int t
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip ad 192.168.3.1 24
[R3]int t
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip ad 192.168.3.3 24
[R3-Tunnel0/0/0]
配置隧道模式:
[R1-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]tunnel-protocol gre
定义公网的源和目的IP地址
[R1-Tunnel0/0/0]source 100.1.1.1
[R1-Tunnel0/0/0]des
[R1-Tunnel0/0/0]dest
[R1-Tunnel0/0/0]destination 100.2.2.3
[R3-Tunnel0/0/0]sou
[R3-Tunnel0/0/0]source 100.2.2.3
[R3-Tunnel0/0/0]dest
[R3-Tunnel0/0/0]destination 100.1.1.1
配置静态路由协议:
[R1]ip rou
[R1]ip route-s
[R1]ip route-static 192.168.2.0 24 192.168.3.3
[R3]ip rou
[R3]ip route-s
[R3]ip route-static 192.168.1.0 24 192.168.3.1
随后在PC2上ping 192.168.1.1就可以通了