实验拓扑图
需求
R1和R3互通,R4和R5互通
实验步骤
-
先配置R1 R3 R4 R5 的ip地址
[R1]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.12.1/24 up up
LoopBack0 192.168.1.1/24 up up(s)
[R3]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.23.3/24 up up
LoopBack0 192.168.2.1/24 up up(s)
[R4]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.24.4/24 up up
LoopBack0 192.168.1.1/24 up up(s)
[R5]
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.25.3/24 up up
LoopBack0 192.168.2.1/24 up up(s)
-
在R1 R3 R4 R5中开启ospf,并在GigabitEthernet0/0/0 和LoopBack0 下开启ospf功能,另外一个方法就是可以在区域中宣告自己的ip,这里演示第一中方法
R1 R3 R4 R5分别启动ospf进程,进程号为1,进入区域0。
[R1][R3][R4][R5]
ospf 1
area 0.0.0.0
在GigabitEthernet0/0/0 和LoopBack0 下开启ospf功能
[R1][R3][R4][R5]
interface GigabitEthernet0/0/0
ospf enable 1 area 0.0.0.0
interface LoopBack0
ospf enable 1 area 0.0.0.0
-
在R1 R3 R4 R5的LoopBack0 中配置OSPF 网络类型 ,设置为broadcast类型
[R1][R3][R4][R5]
interface LoopBack0
ospf network-type broadcast
-
在isp路由器中配置vpn实列。
[isp]
ip vpn-instance 1
ipv4-family
route-distinguisher 1:1
#
ip vpn-instance 2
ipv4-family
route-distinguisher 2:2
-
在isp路由器中的接口下绑定vpn实列,并配置ip地址。
[isp]
interface GigabitEthernet0/0/0
ip binding vpn-instance 1
ip address 192.168.12.5 24
#
interface GigabitEthernet0/0/1
ip binding vpn-instance 1
ip address 192.168.23.5 24
#
interface GigabitEthernet0/0/2
ip binding vpn-instance 2
ip address 192.168.24.5 24
#
interface GigabitEthernet5/0/0
ip binding vpn-instance 2
ip address 192.168.25.5 24
-
在isp路由器中启动多个ospf进程,并绑定VPN实列。
[isp]
ospf 1 router-id 2.2.2.2 vpn-instance 1
area 0.0.0.0
#
ospf 2 router-id 2.2.2.2 vpn-instance 2
area 0.0.0.0
-
在isp路由器的接口下启动ospf功能。
[isp]
interface GigabitEthernet0/0/0
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/2
ospf enable 2 area 0.0.0.0
#
interface GigabitEthernet5/0/0
ospf enable 2 area 0.0.0.0
-
验证实验结果。
<r1>ping 192.168.2.1
PING 192.168.2.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.2.1: bytes=56 Sequence=5 ttl=254 time=30 ms
<r4>ping 192.168.2.1
PING 192.168.2.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 192.168.2.1: bytes=56 Sequence=5 ttl=254 time=20 ms
<r4>tracert 192.168.2.1
traceroute to 192.168.2.1(192.168.2.1), max hops: 30 ,packet length: 40,press CTRL_C to break
1 192.168.24.5 20 ms 20 ms 10 ms
2 192.168.25.3 20 ms 20 ms 30 ms
<r1>tracert 192.168.2.1
traceroute to 192.168.2.1(192.168.2.1), max hops: 30 ,packet length: 40,press CTRL_C to break
1 192.168.12.5 40 ms 10 ms 10 ms
2 192.168.23.3 20 ms 20 ms 20 ms
-
符合实验需求,实验完成。