Доброго часу доби. Сьогодні хотілося б розповісти про те, що не давало нам жити, підривав нам мозок довгий час - Mikrotik і OSPF.
Mikrotik сама по собі непогана залізка, з низькою вартістю, купою можливістю, але на жаль, не без недоліків.
У нас наступна схема мережі:
ROU1 — Cisco c3845
ROU2 — Cisco c3845
МТ1 - Mikrotik 1100Ahx2
МТ2 - Mikrotik 1100Ahx2
c3550 — Cisco c3550
GW68 — MikroTik RB751U-2HnD
GW69 — MikroTik RB751U-2HnD
На ROU1 і ROU2 у нас тунелі до MT1 і до MT2 (IPSec пропущу), заведений процес OSPF для backbone. Віддається підсіти 10.0.0.0/19:
Налаштування ROU1 і ROU2
#ROU1
interface Tunnel100641
description # XXX_IRK64_YYY #
ip address 172.20.64.1 255.255.255.252
ip access-group DMZ_IN in
ip access-group DMZ_OUT out
ip mtu 1450
ip ospf network point-to-point
ip ospf cost 10
ip ospf mtu-ignore
ip ospf 1 area 0.0.0.0
tunnel source 194.x.x.x
tunnel mode ipip
tunnel destination 195.x.x.x
router ospf 1
router-id 255.255.255.255
redistribute ospf 100 metric-type 1 subnets route-map OSPF_100_to_BB
network 172.20.64.0 0.0.0.3 area 0.0.0.0
#ROU2
interface Tunnel100642
description # XXX_IRK64_YYY#
ip address 172.20.64.5 255.255.255.252
ip access-group DMZ_IN in
ip access-group DMZ_OUT out
ip mtu 1450
ip ospf network point-to-point
ip ospf cost 40
ip ospf mtu-ignore
ip ospf 1 area 0.0.0.0
tunnel source 109.x.x.x
tunnel mode ipip
tunnel destination 85.x.x.x
router ospf 1
router-id 255.255.255.254
redistribute ospf 100 metric-type 1 subnets route-map OSPF_100_to_BB
network 172.20.64.4 0.0.0.3 area 0.0.0.0
На MT1 та MT2 адреси тунелів відповідно 172.20.64.2 та 172.20.64.6. Area backbone там вже є за замовчуванням.
Налаштування MT1 і MT2
#MT1
# Створіть тунель
/interface ipip add comment=YYY_VL03_ROU1 disabled=no local-address=195.x.x.x mtu=1450 name=ipip_yyy_vl03_rou1 remote-address=194.x.x.x
# Повісимо на нього адресу
/ip address add address=172.20.64.2/30 comment=YYY_VL03_XXX interface=ipip_yyy_vl03_rou1
# Виправимо instance, додавши фільтри та id
/routing ospf instance set [ find default=yes ] in-filter=ospf-default-in out-filter=ospf-default-out redistribute-other-ospf=as-type-1 router-id=30.0.64.1
# Додамо підмережу в area backbone
/routing ospf network add area=backbone comment=«Backbone Network VL» network=172.20.64.0/30
# Зробимо фільтри
/routing filter add action=accept chain=ospf-default-out prefix=10.0.64.0/19
/routing filter add action=accept chain=ospf-default-out prefix=172.20.64.0/19
/routing filter add action=discard chain=ospf-default-out
/routing filter add action=accept chain=ospf-default-in prefix=10.0.0.0/19
/routing filter add action=accept chain=ospf-default-in prefix=172.20.0.0/19
/routing filter add action=discard chain=ospf-default-in
# Створити інтефейс OSPF
/routing ospf interface add authentication-key=0 interface=ipip_yyy_vl03_rou1 network-type=point-to-point priority=255
#MT2
# Створіть тунель
/interface ipip add comment=YYY_VL03_ROU2 disabled=no local-address=85.x.x.x mtu=1450 name=ipip_yyy_vl03_rou2 remote-address=109.x.x.x
# Повісимо на нього адресу
/ip address add address=172.20.64.6/30 comment=YYY_VL03_ROU2 interface=ipip_yyy_vl03_rou2
# Виправимо instance, додавши фільтри та id
/routing ospf instance set [ find default=yes ] in-filter=ospf-default-in out-filter=ospf-default-out redistribute-other-ospf=as-type-1 router-id=30.0.64.2
# Додамо підмережу в area backbone
/routing ospf network add area=backbone comment=«Backbone Network VL» network=172.20.64.4/30
# Зробимо фільтри
/routing filter add action=accept chain=ospf-default-out prefix=10.0.64.0/19
/routing filter add action=accept chain=ospf-default-out prefix=172.20.64.0/19
/routing filter add action=discard chain=ospf-default-out
/routing filter add action=accept chain=ospf-default-in prefix=10.0.0.0/19
/routing filter add action=accept chain=ospf-default-in prefix=172.20.0.0/19
/routing filter add action=discard chain=ospf-default-in
# Створити інтефейс OSPF
/routing ospf interface add authentication-key=0 cost=40 interface=ipip_yyy_vl03_rou2 network-type=point-to-point priority=200
Але у нас повинен бути ще зв'язок між МТ1 і МТ2 безпосередньо.
Для цього у нас використовується нова area IRK. Cisco c3550 у нас не тільки сувій, він у нас кореневий пристрій, на ньому заведені всі влани, через нього прокинуті провайдери, на ньому створений vrf і т. д. (якщо буде цікаво, то потім опишу всю організацію мережі)
Створимо на c3550 area IRK і два vlan для з'єднання з MT1 і MT2. Area IRK - це головна область РУ - регіонального вузла, в якій працюють всі підключені до РУ роутери.
Налаштування c3550
interface Vlan66
description # MGM 1 VLAN #
ip address 172.20.64.98 255.255.255.252
ip policy route-map test
ip ospf cost 10
ip ospf hello-interval 5
ip ospf dead-interval 10
ip ospf priority 100
!
interface Vlan67
description # MGM 2 VLAN #
ip address 172.20.64.102 255.255.255.252
ip ospf cost 10
ip ospf hello-interval 5
ip ospf dead-interval 10
ip ospf priority 50
router ospf 100
router-id 10.0.64.0
log-adjacency-changes
redistribute connected metric-type 1 subnets
redistribute static metric-type 1 subnets
network 172.20.64.96 0.0.0.3 area 10.0.64.0
network 172.20.64.100 0.0.0.3 area 10.0.64.0
# Два нульроути
ip route 10.0.64.0 255.255.224.0 Null0 250
ip route 172.20.64.0 255.255.224.0 Null0 250
Тепер приймемо на МТ1 і МТ2 ці vlan, і заведемо новий ospf instance і area, додамо лінк між MT1 і МТ2 і навішаємо адресу.
Налаштування MT1 і MT2
# МТ1
# Приймаємо vlan
/interface vlan add interface=ether1 l2mtu=1594 name=vlan_66_mgm vlan-id=66
# Створюємо area
/routing ospf area add area-id=10.0.64.0 instance=IRK name=IRK
# Створюємо instance
/routing ospf instance add distribute-default=if-installed-as-type-1 name=IRK redistribute-other-ospf=as-type-1 redistribute-static=as-type-1 router-id=10.0.64.1
# Вішаємо IP
/ip address add address=172.20.64.97/30 comment=MGM_Interface interface=vlan_66_mgm
/ip address add address=172.20.64.105/30 comment=MT-MT_Interface interface=ether2
# Додаємо підмережі до area IRK
/routing ospf network add area=IRK network=172.20.64.96/30
/routing ospf network add area=IRK network=172.20.64.104/30
# Створюємо ospf interface
/routing ospf interface add dead-interval=10s hello-interval=5s interface=vlan_66_mgm network-type=broadcast priority=255
# МТ2
# Приймаємо vlan
/interface vlan add interface=ether1 l2mtu=1594 name=vlan_67_mgm vlan-id=67
# Створюємо area
/routing ospf area add area-id=10.0.64.0 instance=IRK name=IRK
# Створюємо instance
/routing ospf instance add distribute-default=if-installed-as-type-1 name=IRK redistribute-other-ospf=as-type-1 redistribute-static=as-type-1 router-id=10.0.64.2
# Вішаємо IP
/ip address add address=172.20.64.101/30 comment=MGM_Interface interface=vlan_67_mgm
/ip address add address=172.20.64.106/30 comment=MT-MT_Interface interface=ether2
# Додаємо підмережі до area IRK
/routing ospf network add area=IRK network=172.20.64.100/30
/routing ospf network add area=IRK network=172.20.64.104/30
# Створюємо ospf interface
/routing ospf interface add dead-interval=10s hello-interval=5s interface=vlan_67_mgm network-type=broadcast priority=200
Начебто нічого не забув, що ми отримали:
1. У нас є два тунелі до центральних роутерів, з кожного мікротика по одному.
2. Cost 10 і 40 відповідно. Тобто при живому основному роутері (провайдері) MT1, роут з backbone 10.0.0.0/19 ми отримаємо через тунель до ROU1, при мертвому через тунель до ROU2
3. У нас є прямий лінк між MT1 і MT2, для того щоб не ганяти трафік завжди через c3550.
Налаштували, поставили. Все працює:
#MT1
ADo dst-address=10.0.0.0/19 gateway=172.20.64.1 gateway-status=172.20.64.1 reachable
