VRRP - проблема работы нескольких интерфейсов

Обсуждение ПО и его настройки
Ответить
DeLL
Сообщения: 74
Зарегистрирован: 05 июн 2014, 00:24

Сразу же хочу предупредить - считайте данный пост жалобой на реализацию протокола VRRP у микротика)

Взвыло у меня в одном месте настроить два RB2011UiAS-RM в качестве основного и резервного шлюза для небольшой сети с тремя VLAN'ами (уже спрашивал недавно на форуме)
Так вот, пришло оборудование и у меня дошли руки поиграться с настройками.
После различных экспериментов столкнулся с одной проблемой, которая встала перед пользователями еще в 2011 году (судя по оф. форуму), а может быть и еще раньше. И решения, как я понял, до сих нет. Кто как решает различными скриптами.
Вообщем ситуация такова:
 Конфиг роутера 1
/interface bridge
add admin-mac=4C:5E:0C:56:23:69 auto-mac=no l2mtu=1598 name=bridge-local
/interface ethernet
set [ find default-name=ether1 ] name=ether1-gateway
set [ find default-name=ether6 ] name=ether6-master-local
set [ find default-name=ether7 ] master-port=ether6-master-local name=\
ether7-slave-local
set [ find default-name=ether8 ] master-port=ether6-master-local name=\
ether8-slave-local
set [ find default-name=ether9 ] master-port=ether6-master-local name=\
ether9-slave-local
set [ find default-name=ether10 ] master-port=ether6-master-local name=\
ether10-slave-local
set [ find default-name=sfp1 ] name=sfp1-gateway
/interface vrrp
add interface=bridge-local interval=100ms name=vrrp1 vrid=49
add interface=ether1-gateway interval=100ms name=vrrp2-gw vrid=22
/ip neighbor discovery
set ether1-gateway discover=no
set sfp1-gateway discover=no
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=bridge-local lease-time=\
10m name=default
/port
set 0 name=serial0
/interface bridge port
add bridge=bridge-local interface=ether2
add bridge=bridge-local interface=ether3
add bridge=bridge-local interface=ether4
add bridge=bridge-local interface=ether5
add bridge=bridge-local interface=ether6-master-local
/ip address
add address=192.168.88.2/24 comment="default configuration" interface=\
bridge-local network=192.168.88.0
add address=192.168.88.3/24 interface=vrrp1 network=192.168.88.0
add address=192.168.33.250/24 interface=ether1-gateway network=192.168.33.0
add address=192.168.33.250/24 interface=vrrp2-gw network=192.168.33.0
/ip dhcp-client
add comment="default configuration" dhcp-options=hostname,clientid disabled=\
no interface=sfp1-gateway
add comment="default configuration" dhcp-options=hostname,clientid interface=\
ether1-gateway
/ip dhcp-server network
add address=192.168.88.0/24 comment="default configuration" dns-server=\
192.168.88.3 gateway=192.168.88.3
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add chain=input comment="default configuration" disabled=yes protocol=icmp
add chain=input comment="default configuration" connection-state=established \
disabled=yes
add chain=input comment="default configuration" connection-state=related \
disabled=yes
add action=drop chain=input comment="default configuration" disabled=yes \
in-interface=sfp1-gateway
add action=drop chain=input comment="default configuration" disabled=yes \
in-interface=ether1-gateway
add chain=forward comment="default configuration" connection-state=\
established disabled=yes
add chain=forward comment="default configuration" connection-state=related \
disabled=yes
add action=drop chain=forward comment="default configuration" \
connection-state=invalid disabled=yes
/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" disabled=\
yes out-interface=sfp1-gateway
add action=masquerade chain=srcnat comment="default configuration" \
out-interface=vrrp2-gw to-addresses=0.0.0.0
/ip ipsec policy
add template=yes
/ip route
add distance=1 gateway=192.168.33.1
/ip upnp
set allow-disable-external-interface=no
/system ntp client
set enabled=yes primary-ntp=91.226.136.139 secondary-ntp=88.147.254.229
/system routerboard settings
set cpu-frequency=750MHz
/system scheduler
add interval=1s name=schedule1 on-event=":if ([/interface get [find name=\"eth\
er5\"] running]=!true) do={/interface disable ether1-gateway}" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-date=jul/28/2014 start-time=09:45:37
add interval=1s name=schedule2 on-event=":if ([/interface get [find name=\"eth\
er5\"] running]=true) do={\r\
\n\t:if ([/interface get [find name=\"ether1-gateway\"] running]=!true) do\
={\r\
\n\t/interface enable ether1-gateway\r\
\n\t}\r\
\n}" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-date=jul/28/2014 start-time=09:46:17
/system script
add name=script1 policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
source=":if ([/interface get [find name=\"ether5\"] running]=!true) do={:i\
nterface ether1-gateway disable}"
add name=script2e-mail policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
source="/tool e-mail send to=\"admin@33tv.ru\" subject=\"Mikrotik VRRP cha\
nged!!!\" body=\"\CE\F1\ED\EE\E2\ED\FB\E9 \EC\E8\EA\F0\EE\F2\E8\EA \EE\F2\
\F0\F3\E1\E8\EB\F1\FF \E8 \ED\E0\E3\F0\F3\E7\EA\E0 \EB\E5\E3\EB\E0 \ED\E0 \
\F0\E5\E7\E5\F0\E2\ED\FB\E9\""
add name=script3change-priority policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
source="/interface vrrp set [/interface vrrp find vrid=49] priority=250"
/tool e-mail
set address=94.100.180.160 from= last-status=succeeded \
password= start-tls=yes user=
/tool mac-server
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-master-local
add interface=ether7-slave-local
add interface=ether8-slave-local
add interface=ether9-slave-local
add interface=ether10-slave-local
add interface=bridge-local
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-master-local
add interface=ether7-slave-local
add interface=ether8-slave-local
add interface=ether9-slave-local
add interface=ether10-slave-local
add interface=bridge-local

 Конфиг второго роутера
/interface bridge
add admin-mac=4C:5E:0C:56:23:48 auto-mac=no l2mtu=1598 name=bridge-local
/interface ethernet
set [ find default-name=ether1 ] name=ether1-gateway
set [ find default-name=ether6 ] name=ether6-master-local
set [ find default-name=ether7 ] master-port=ether6-master-local name=\
ether7-slave-local
set [ find default-name=ether8 ] master-port=ether6-master-local name=\
ether8-slave-local
set [ find default-name=ether9 ] master-port=ether6-master-local name=\
ether9-slave-local
set [ find default-name=ether10 ] master-port=ether6-master-local name=\
ether10-slave-local
set [ find default-name=sfp1 ] name=sfp1-gateway
/interface vrrp
add interface=bridge-local interval=100ms name=vrrp1 priority=50 vrid=49
add interface=ether1-gateway interval=100ms name=vrrp2-gw on-backup="/interfac\
e vrrp set [/interface vrrp find vrid=49] priority=50;\r\
\n:delay 5;\r\
\n/tool e-mail send to=\"admin@33tv.ru\" subject=\"Mikrotik VRRP changed!!\
!\" body=\"\CE\F1\ED\EE\E2\ED\FB\E9 \EC\E8\EA\F0\EE\F2\E8\EA \E2\EE\E7\EE\
\E1\ED\EE\E2\E8\EB \F0\E0\E1\EE\F2\F3\"" on-master="/interface vrrp set [/\
interface vrrp find vrid=49] priority=150;\r\
\n:delay 5;\r\
\n/tool e-mail send to=\"admin@33tv.ru\" subject=\"Mikrotik VRRP changed!!\
!\" body=\"\CE\F1\ED\EE\E2\ED\FB\E9 \EC\E8\EA\F0\EE\F2\E8\EA \EE\F2\F0\F3\
\E1\E8\EB\F1\FF \E8 \ED\E0\E3\F0\F3\E7\EA\E0 \EB\E5\E3\EB\E0 \ED\E0 \F0\E5\
\E7\E5\F0\E2\ED\FB\E9\"" priority=50 vrid=22
/ip neighbor discovery
set ether1-gateway discover=no
set sfp1-gateway discover=no
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
/ip dhcp-server
add address-pool=default-dhcp disabled=no interface=bridge-local lease-time=\
10m name=default
/port
set 0 name=serial0
/interface bridge port
add bridge=bridge-local interface=ether2
add bridge=bridge-local interface=ether3
add bridge=bridge-local interface=ether4
add bridge=bridge-local interface=ether5
add bridge=bridge-local interface=ether6-master-local
/ip address
add address=192.168.88.1/24 comment="default configuration" interface=\
bridge-local network=192.168.88.0
add address=192.168.88.3/24 interface=vrrp1 network=192.168.88.0
add address=192.168.33.251/24 interface=ether1-gateway network=192.168.33.0
add address=192.168.33.250/24 interface=vrrp2-gw network=192.168.33.0
/ip dhcp-client
add comment="default configuration" dhcp-options=hostname,clientid disabled=\
no interface=sfp1-gateway
add comment="default configuration" dhcp-options=hostname,clientid interface=\
ether1-gateway
/ip dhcp-server network
add address=192.168.88.0/24 comment="default configuration" dns-server=\
192.168.88.3 gateway=192.168.88.3
/ip dns
set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add chain=input comment="default configuration" disabled=yes protocol=icmp
add chain=input comment="default configuration" connection-state=established \
disabled=yes
add chain=input comment="default configuration" connection-state=related \
disabled=yes
add action=drop chain=input comment="default configuration" disabled=yes \
in-interface=sfp1-gateway
add action=drop chain=input comment="default configuration" disabled=yes \
in-interface=ether1-gateway
add chain=forward comment="default configuration" connection-state=\
established disabled=yes
add chain=forward comment="default configuration" connection-state=related \
disabled=yes
add action=drop chain=forward comment="default configuration" \
connection-state=invalid disabled=yes
/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" disabled=\
yes out-interface=sfp1-gateway
add action=masquerade chain=srcnat comment="default configuration" \
out-interface=vrrp2-gw to-addresses=0.0.0.0
/ip ipsec policy
add template=yes
/ip route
add distance=1 gateway=192.168.33.1
/ip upnp
set allow-disable-external-interface=no
/system routerboard settings
set cpu-frequency=750MHz
/tool e-mail
set address=94.100.180.160 from=<Mikrotik> last-status=failed password=\
user=
/tool mac-server
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-master-local
add interface=ether7-slave-local
add interface=ether8-slave-local
add interface=ether9-slave-local
add interface=ether10-slave-local
add interface=bridge-local
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-master-local
add interface=ether7-slave-local
add interface=ether8-slave-local
add interface=ether9-slave-local
add interface=ether10-slave-local
add interface=bridge-local

Два интерфейса VRRP - один на LAN, второй на WAN. Если отрубить питание основного роутера, резервный быстро подхватывает инициативу и все работает без нареканий. Пара пропущенных пингов и остановленное онлайн-радио не всчет) Включаю питание обратно - роутер загружается и инициатива возвращается обратно. Пинги и радио также шалят, хотя бывает по-разному. Иногда пинги не пропадают,а радио только цокнет немного и не обрывается.
Веселье начинается, когда я начинаю моделировать различные неприятности.
1. Отключаю из основного роутера кабель LAN. VRRP срабатывает и "активирует" LAN-интерфейс на резервном роутере. WAN продолжает работать как и раньше, то есть он активен на основном роутере. Итог - интернета нет)
2. Отключаю из основного роутера кабель WAN. Ситуация повторяется в точности, как и с LAN. Результат тотже)

На данный момент с двумя VRRP-интерфейсами я нашел решение с двумя скриптами на обоих роутерах. Как оно срабатывает - можно понять из конфигов. Только мне необходимо создать всего 4 VRRP-интерфейса, и как с ними быть я ума не приложу.

PS. Спрашивал людей, работающих с джуниперами. Настраивали они такое чудо, но там поддерживается какая-то команда, которая "объединяет" интерфейсы логически и управляет ими всеми сразу, если проблема наблюдается с любым из них. Я рассчитывал у микротика увидеть какой-нибудь инстанс для объединения VRRP, но..... Как то нелогично получается работает этот протокол)
Поделитесь со мной мыслями или идеями по этому поводу)


Ответить