本文主要介绍通过RouterOS V7的IP-Tunnel来实现OSPF异地组网。
一、组网准备
1、RouterOS v7.x 2个,这边使用的版本是7.8 (stable)
2、有公网IPv4的外网2个,我这边使用内网环境模拟
二、网络拓扑
地区1:R1路由外网IP:222.93.16.197 绑定域名:r1.77bx.com 内网:10.10.1.1/24 IP-Tunnel:10.255.255.1/24
地区2:R2路由外网IP:49.64.230.3 绑定域名:r2.77bx.com 内网:10.10.2.1/24 IP-Tunnel:10.255.255.2/24
三、基础配置
1、配置R1和R2上网,这边我就不详细写了,可以看看我以前的教程,已经写的很多了。
四、IP Tunnel配置
1、配置R1和R2的IP Tunnel,Interfaces -> Interface -> + -> IP Tunnel ,设置Name和Remote Address,其他的默认即可。
R1 Name:ipip-tunnel-r1,Remote Address:r2.77bx.com
R2 Name:ipip-tunnel-r2,Remote Address:r1.77bx.com
2、配置R1和R2的IP Tunnel IP地址,IP -> Address -> + , 设置Address和Interface
R1 Address:10.255.255.1/24,Network:10.255.255.0,Interface:ipip-tunnel-r1
R2 Address:10.255.255.2/24,Network:10.255.255.0,Interface:ipip-tunnel-r2
以下是IP Tunnel设置的所有操作命令:
[admin@R1] > interface ipip add name=ipip-tunnel-r1 remote-address=r2.77bx.com [admin@R1] > ip address add address=10.255.255.1/24 interface=ipip-tunnel-r1 [admin@R2] > interface ipip add name=ipip-tunnel-r2 remote-address=r1.77bx.com [admin@R2] > ip address add address=10.255.255.1/24 interface=ipip-tunnel-r2
五、OSPF设置
1、R1和R2的Router ID设置,Routing -> Router ID -> + ,设置Name,ID和Select Dynamic ID
R1 Name:rid-r1,ID:0.0.0.1,Select Dynamic ID:only static
R2 Name:rid-r2,ID:0.0.0.2,Select Dynamic ID:only static
2、R1和R2的Instances设置。Routing -> OSPF -> Interfaces -> + ,设置Name和Router ID,其他的默认即可。
R1 Name:ospf-instance-r1,Router ID:rid-r1
R2 Name:ospf-instance-r2,Router ID:rid-r2
3、R1和R2的Areas设置。设置Name、Interface和Area ID,其他的默认即可。
R1 Name:ospf-area-r1,Instance:ospf-instance-r1,Area ID:0.0.0.0
R2 Name:ospf-area-r2,Instance:ospf-instance-r2,Area ID:0.0.0.0
4、R1和R2的Interface Templates设置。设置Interfaces、Area和Networks,其他的默认即可。
R1 Interface:all,Area:ospf-area-r1,Networks:10.255.255.0/24,10.1.0.0/24
R2 Interface:all,Area:ospf-area-r2,Networks:10.255.255.0/24,10.2.0.0/24
5、查看Interfaces,可以看到宣告的网段已经成功
6、查看Neighbors,可以看到OSPF关系已经建立。
7、查看路由表。IP -> Routes
以下是OSPF设置的所有命令
[admin@R1] > routing id add name=rid-r1 id=0.0.0.1 select-dynamic-id=only-static [admin@R1] > routing ospf instance add name=ospf-instance-r1 router-id=rid-r1 [admin@R1] > routing ospf area add name=ospf-area-r1 area-id=0.0.0.0 instance=ospf-instance-r1 [admin@R2] > routing ospf interface-template add area=ospf-area-r1 interfaces=all networks=10.255.255.0/24,10.1.0.0/24 [admin@R2] > routing id add name=rid-r2 id=0.0.0.2 select-dynamic-id=only-static [admin@R2] > routing ospf instance add name=ospf-instance-r2 router-id=rid-r2 [admin@R2] > routing ospf area add name=ospf-area-r2 area-id=0.0.0.0 instance=ospf-instance-r2 [admin@R2] > routing ospf interface-template add area=ospf-area-r2 interfaces=all networks=10.255.255.0/24,10.2.0.0/24
到此R1和R2已经组网成功,可以相互访问了。
评论(0)