IPsec/GRE + OSPF в RouterOS 7

Обсуждение ПО и его настройки
Ответить
abc
Сообщения: 2
Зарегистрирован: 20 май 2024, 14:21

Добрый день.
Есть такая конфигурация IPsec+GRE и простенький OSPF:

R1:

Код: Выделить всё

/ip ipsec peer
add exchange-mode=ike2 name=peer1 passive=yes send-initial-contact=no
/ip ipsec identity
add generate-policy=port-strict peer=peer1 secret=Password

/interface gre
add allow-fast-path=no local-address=172.16.0.1 name=gre-tunnel1 remote-address=172.16.0.2

/ip address
add address=100.100.100.2/30 interface=ether1 network=100.100.100.0
add address=10.10.0.1/24 interface=ether2 network=10.10.0.0
add address=172.16.0.1/30 interface=gre-tunnel1 network=172.16.0.0

/routing ospf interface
add interface=ether2 network-type=point-to-point
add interface=gre-tunnel1 network-type=point-to-point
/routing ospf network
add area=backbone network=10.10.0.0/24
add area=backbone network=172.16.0.0/24

/ip firewall nat
add action=accept chain=srcnat dst-address=172.16.0.0/24
add action=masquerade chain=srcnat out-interface=ether1
R2:

Код: Выделить всё

/ip ipsec peer
add address=100.100.100.2/32 exchange-mode=ike2 name=peer1 send-initial-contact=no
/ip ipsec identity
add peer=peer1 secret=Password
/ip ipsec policy
add dst-address=172.16.0.1/32 level=unique peer=peer1 src-address=172.16.0.2/32 tunnel=yes

/interface gre
add allow-fast-path=no local-address=172.16.0.2 name=gre-tunnel1 remote-address=172.16.0.1

/ip address
add address=100.100.100.6/30 interface=ether1 network=100.100.100.4
add address=10.10.5.1/24 interface=ether2 network=10.10.5.0
add address=172.16.0.2/30 interface=gre-tunnel1 network=172.16.0.0

/routing ospf interface
add interface=ether2 network-type=point-to-point
add interface=gre-tunnel1 network-type=point-to-point
/routing ospf network
add area=backbone network=10.10.5.0/24
add area=backbone network=172.16.0.0/24

/ip firewall nat
add action=accept chain=srcnat dst-address=172.16.0.0/24
add action=masquerade chain=srcnat out-interface=ether1
В логе:

Код: Выделить всё

ospf-instance-1 { version: 2 router-id: 172.16.0.2 } backbone { 0.0.0.0 } interface { p2p 172.16.0.2%gre-tunnel1 } send hello
ospf-instance-1 { version: 2 router-id: 172.16.0.2 } backbone { 0.0.0.0 } interface { p2p 172.16.0.2%gre-tunnel1 } neighbor { router-id: 10.10.0.1 state: ExStart } send DD to 172.16.0.1 Init Master More sequence 1939173898
ospf-instance-1 { version: 2 router-id: 172.16.0.2 } backbone { 0.0.0.0 } interface { p2p 172.16.0.2%gre-tunnel1 } neighbor { router-id: 10.10.0.1 state: ExStart } receive DD from 172.16.0.1 Init Master More sequence 0
В ROS6 это работает нормально, но в ROS7 OSPF повисает в ExStart.
Если отключить IPsec и перенастроить GRE с внешними адресами на R1 и R2:

Код: Выделить всё

/interface gre
add allow-fast-path=no ipsec-secret=Password local-address=100.100.100.2 name=gre-tunnel2 remote-address=100.100.100.6

/interface gre
add allow-fast-path=no ipsec-secret=Password local-address=100.100.100.6 name=gre-tunnel2 remote-address=100.100.100.2
то OSPF заводится.

Вопрос в том, как заставить OSPF работать в приведенной выше конфигурации IPsec/GRE в ROS7?


abc
Сообщения: 2
Зарегистрирован: 20 май 2024, 14:21

Проблема была в политике IPsec. В отличие от ROS6 в ней нужно явно указывать GRE протокол - 255 (all) по умолчанию не работает. В данном случае на R2 надо исправить IPsec policy. В списке выбора GRE нет, поэтому просто указать 47.
Изображение
Ну или через терминал, вместо:

Код: Выделить всё

/ip ipsec policy
add dst-address=172.16.0.1/32 level=unique peer=peer1 src-address=172.16.0.2/32 tunnel=yes
Указать:

Код: Выделить всё

/ip ipsec policy
add dst-address=172.16.0.1/32 level=unique peer=peer1 protocol=gre src-address=172.16.0.2/32 tunnel=yes
Аналогичная проблема обсуждалась тут.


Ответить