目录
实验要求:
实验配置思路:
实验配置过程:
一、按照图式配置所有设备的IP地址
(1)首先配置每个接口的IP地址
(2)配置静态路由使公网可通
二、在公网的基础上创建GRE VPN隧道(Tunnel)接口及其IP地址
(1)静态路由协议
(2)动态路由协议
[1]RIP协议
[2]OSPF协议:
实验要求:
- 按照图式配置IP地址
- 在R1和R3上配置默认路由使公网区域互通
- 在R1和R3上配置GRE VPN,使两端私网能够互相访问,Tunnel口的IP地址如图所示
- 在R1和R3上配置RIPv2、OSPF或者静态路由传递两端私网路由
实验图式如下:
实验配置思路:
1、先配IP
2、搞通公网、私网
3、在公网通基础上创建GRE VPN
4、配置路由协议传递两端私网路由
两边配置一样,配置完了注意添加路由。之后内网之间便可以ping通了,可以用ping -a测试。
实验配置过程:
一、按照图式配置所有设备的IP地址
(1)首先配置每个接口的IP地址
PC1:
PC2:
R1:
<Huawei>sys
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 24
[R1-GigabitEthernet0/0/1]q
[R1]dis ip int bri
R2:
[Huawei]sysn R2
[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
[R2-GigabitEthernet0/0/1]q
[R2]dis ip int bri
R3:
<Huawei>sys
[Huawei]sysn R3
[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
[R3-GigabitEthernet0/0/1]q
[R3]dis ip int bri
(2)配置静态路由使公网可通
R1:
[R1]ip route-static 0.0.0.0 0 100.1.1.2
R3:
[R3]ip route-static 0.0.0.0 0 100.2.2.2
测试一下公网是否通了:
R1 ping R3:
[R1]ping 100.2.2.3
PING 100.2.2.3: 56 data bytes, press CTRL_C to break
20.00% packet loss
R3 ping R1:
[R3]ping 100.1.1.1
PING 100.1.1.1: 56 data bytes, press CTRL_C to break
0.00% packet loss
测试通过!!!
二、在公网的基础上创建GRE VPN隧道(Tunnel)接口及其IP地址
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
测试创建的GRE VPN隧道是否通了:
R1的隧道接口 ping R3的隧道接口:
[R1]ping -a 100.1.1.1 100.2.2.3
PING 100.2.2.3: 56 data bytes, press CTRL_C to break
0.00% packet loss
R3的隧道接口 ping R1的隧道接口:
[R3]ping -a 100.2.2.3 100.1.1.1
PING 100.1.1.1: 56 data bytes, press CTRL_C to break
0.00% packet loss
测试通过!!!
三、在R1和R3上配置路由协议传递两端私网路由
(1)静态路由协议
R1:
[R1]ip route-static 192.168.2.0 24 192.168.3.3
R3:
[R3]ip route-static 192.168.1.0 24 192.168.3.1
测试一下私网与公网是否互通:
PC1 ping PC2:
PC>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
0.00% packet loss
测试通过!!!
(2)动态路由协议
[1]RIP协议
首先先删除静态路由配置信息:
[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
再配置RIP协议:
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 192.168.3.0
R3:
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]undo summary
[R3-rip-1]network 192.168.2.0
[R3-rip-1]network 192.168.3.0
测试一下公网与私网是否互通:
PC1 ping PC2:
PC>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
20.00% packet loss
测试通过!!!
[2]OSPF协议:
首先先删除RIPv2 协议配置信息:
[R1]undo rip 1
Warning: The RIP process will be deleted. Continue?[Y/N]y
[R3]undo rip 1
Warning: The RIP process will be deleted. Continue?[Y/N]y
再配置OSPF协议
R1:
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 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
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]
R3:
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]are 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
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]
测试一下公网与私网是否互通:
PC>ping 192.168.2.1
Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
20.00% packet loss
测试通过!!!