实验一:配置GRE隧道,并在隧道上运行静态路由实现互通
拓扑图
配置要求
AR1、AR2、AR3属于VPN骨干网,它们之间运行OSPF。
AR2和AR3之间使用三层隧道协议GRE,实现PC1和PC2互联。
PC1和PC2上分别指定AR2、AR3为自己的缺省网关。
操作步骤
- 配置AR2
#
interface GigabitEthernet0/0/0 //配置公网出接口
ip address 20.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1 //配置私网出接口
ip address 10.1.1.2 255.255.255.0
#
//配置Tunnel接口,Tunnel的源地址是发出报文的实际接口IP地址,目的地址是接收报文的实际接口IP地址
interface Tunnel0/0/1
ip address 10.3.1.1 255.255.255.0
tunnel-protocol gre
source 20.1.1.1
destination 30.1.1.2
#
//配置公网路由-ospf
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
#
//配置私网静态路由,下一条接口为Tunnel接口
ip route-static 10.2.1.0 255.255.255.0 Tunnel0/0/1
#
- 配置AR2
interface GigabitEthernet0/0/0
ip address 20.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 30.1.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.255
- 配置AR3
#
interface GigabitEthernet0/0/0
ip address 30.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.2.1.2 255.255.255.0
#
interface Tunnel0/0/1
ip address 10.3.1.2 255.255.255.0
tunnel-protocol gre
source 30.1.1.2
destination 20.1.1.1
#
ospf 1
area 0.0.0.0
network 30.1.1.0 0.0.0.255
#️
ip route-static 10.1.1.0 255.255.255.0 tunnel0/0/1
- 验证:
dis ip int brief
PC设置
- PC1:
- IP 地址:
10.1.1.1
- 子网掩码:
255.255.255.0
- 默认网关:
10.1.1.2
- IP 地址:
- PC2:
- IP 地址:
10.2.1.1
- 子网掩码:
255.255.255.0
- 默认网关:
10.2.1.2
- IP 地址:
实验二:GRE IPV6 to IPV4
组网需求
RouterA、RouterB、RouterC之间通过IPv4网络互连。
RouterA和RouterC分别连接到IPv6网络,且下挂IPv6主机PC1和PC2。
客户希望在RouterA和RouterC之间配置IPv6 over IPv4 GRE隧道,实现PC1和PC2间互通。
拓扑图
实验步骤
1.配置RA
ipv6
#
interface GigabitEthernet0/0/1
ip address 10.1.1.1 255.255.255.0 //配置接口的IPv4地址
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address FC01::1/64 //配置接口的IPv6地址
#
interface Tunnel0/0/1
ipv6 enable
ipv6 address FC02::1/64
tunnel-protocol gre
source 10.1.1.1
destination 10.1.2.2
#
ip route-static 10.1.2.0 255.255.255.0 10.1.1.2 //配置IPv4静态路由,确保RouterA到RouterC路由可达
#
ipv6 route-static FC03:: 64 Tunnel0/0/1 //配置IPv6静态路由,确保RouterA到PC2路由可达
- 配置RB
#
interface GigabitEthernet0/0/0
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.2.1 255.255.255.0
#
- 配置RC
ipv6
#
interface GigabitEthernet0/0/0
ipv6 enable
ipv6 address FC03::1/64
#
interface GigabitEthernet0/0/1
ip address 10.1.2.2 255.255.255.0
#
interface Tunnel0/0/1
ipv6 enable
ipv6 address FC02::2/64
tunnel-protocol gre
source 10.1.2.2
destination 10.1.1.1
#
ip route-static 10.1.1.0 255.255.255.0 10.1.2.1 //配置IPv4静态路由,确保RouterC到RouterA路由可达
#
ipv6 route-static FC01:: 64 Tunnel0/0/01 //配置IPv6静态路由,确保RouterC到PC1路由可达
- 验证:
实验三:配置GRE隧道,并在隧道上运行OSPF实现互通的示例
组网需求
AR1、AR2、AR3属于VPN骨干网,它们之间运行OSPF。
AR2和AR3之间使用三层隧道协议GRE,实现PC1和PC2互联。
PC1和PC2上分别指定AR2、AR3为自己的缺省网关。
Tunnel接口启用动态路由协议OSPF。VPN骨干网上使用OSPF进程1,用户接入部分使用OSPF进程2。
实验步骤
- AR2-RA
#
interface GigabitEthernet0/0/0
ip address 20.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.1.2 255.255.255.0
#
interface Tunnel0/0/1
ip address 10.3.1.1 255.255.255.0
tunnel-protocol gre
source 20.1.1.1
destination 30.1.1.2
#
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
#
ospf 2
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.3.1.0 0.0.0.255
#
- AR1-RB
#
interface GigabitEthernet0/0/0
ip address 20.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 30.1.1.1 255.255.255.0
#
#
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.255
#
- AR3-RC
#
interface GigabitEthernet0/0/0
ip address 30.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.2.1.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 30.1.1.0 0.0.0.255
#
ospf 2
area 0.0.0.0
network 10.2.1.0 0.0.0.255
network 10.3.1.0 0.0.0.255
#
interface Tunnel0/0/1
ip address 10.3.1.2 255.255.255.0
tunnel-protocol gre
source 30.1.1.2
destination 20.1.1.1
#
- 验证:
dis ip routing-table
PC>ping 10.2.1.1
Ping 10.2.1.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 10.2.1.1: bytes=32 seq=2 ttl=126 time=31 ms
From 10.2.1.1: bytes=32 seq=3 ttl=126 time=32 ms
From 10.2.1.1: bytes=32 seq=4 ttl=126 time=15 ms
From 10.2.1.1: bytes=32 seq=5 ttl=126 time=32 ms
--- 10.2.1.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/27/32 ms
PC>