Files
mikrotik-olsr/container/README.md
T
feedc0de fde4be1a8e
Check source / check (push) Successful in 12s
Build OLSR container / image (push) Successful in 44s
Keep BGP control endpoint off OLSR mesh address
2026-11-19 10:38:59 +01:00

9.3 KiB

OLSR on stock RouterOS (experimental)

This is the second installation path. The signed NPK/Netinstall path remains available. Containers need the official container package and container-enabled device mode, supported ARM hardware, and sufficient storage. No replacement RouterOS image, custom signing key, or configuration reset is required.

Status: experimental. The WohnzimmerAP live test now confirms OLSR neighbor discovery, an established RouterOS BGP session, hundreds of accepted dynamic routes, and correct neighbor-based gateways on olsr-mesh. Disabling the BGP connection withdraws those routes while OLSR keeps running. Full end-to-end forwarding and return traffic still need hardware acceptance.

This is an experimental control-plane-only container. It discovers OLSRv1 routes and exports the actual neighbor next hops to RouterOS over BGP. RouterOS forwards packets directly to those neighbors. Container transit forwarding is blocked; there is no container NAT. The earlier next hop self image is superseded. HNA remains rejected until its RouterOS return-path integration is implemented. There is no custom native OLSR configuration dialog in this container edition.

Networking

RouterOS and the container have separate network namespaces. Do not connect BGP to localhost. The container's OLSR identity is its mesh address, while BGP uses 172.31.255.2 on container loopback and 172.31.255.1 on RouterOS. The container adds an on-link route to the RouterOS peer through its VETH. The private 172.31.255.0/30 addresses are only the BGP control path; they are not OLSR interface addresses or route next hops. RouterOS installs learned routes through the actual OLSR neighbor on the mesh bridge.

Create a VLAN 4 interface on the existing trunk bridge, then bridge that VLAN interface with the container VETH using a separate bridge. This hands the container an untagged view of VLAN 4, including OLSR UDP 698 broadcasts. It does not hand over the physical port or change the existing bridge's PVID. The trunk bridge must already permit tagged VLAN 4 on the CPU and appropriate uplink. Do not also bridge the physical parent into the new bridge.

The VETH receives the unique community-assigned mesh IPv4 /32 as its address; that identity belongs to the container, not RouterOS. RouterOS keeps 172.31.255.1/30 on the mesh bridge for BGP. The container binds its BGP endpoint, 172.31.255.2/32, on loopback and adds an on-link route to the RouterOS peer through the VETH. This keeps the private control addresses off the OLSR interface. Add a RouterOS /32 route to the container mesh identity through the mesh bridge. LAN traffic also needs a valid return path. Learning a destination route does not advertise your source network.

BIRD preserves each OLSR next-hop IP and tags its outgoing link using community 64514:LINK_ID. RouterOS maps that ID to a local interface. Direct neighbor /32 routes receive community 64513:1 and an on-link gateway with scope 10. Other routes retain the neighbor IP and receive gw-interface with target scope 11. Every accepted OLSR route must also carry 64513:698; unknown links are rejected. The expected immediate gateway is NEIGHBOR_IP%ROUTEROS_INTERFACE, never the container transit IP. A VLAN which is a bridge port uses the bridge as its L3 interface (for example olsr-mesh), not the enslaved VLAN interface.

The default single link has ID 1. For multiple links, set OLSR_LINKS to JSON:

[{"interface":"mesh4","address":"10.12.4.173","id":4},
 {"interface":"mesh5","address":"10.12.5.173","id":5}]

Addresses above are examples, not allocations. Interfaces and addresses must already exist inside the container; this setting does not provision VLANs or additional VETHs. Keep distinct OLSR links isolated at layer 2, for example via an explicitly provisioned VLAN trunk. Do not bridge independent neighbor links together. Multi-link configuration generation is tested; multi-link RouterOS container provisioning and physical link-failure behavior still need hardware validation. The single-link recipe below does not create a multi-link topology.

Build and publish

From the repository root:

podman build --platform linux/arm64 -f container/Dockerfile -t localhost/olsr:test .
podman run --rm -e OLSR_NODE_IP=10.255.255.1 \
  -e BGP_LOCAL_IP=172.31.255.2 -e BGP_PEER_IP=172.31.255.1 \
  localhost/olsr:test --check
podman save --format docker-archive -o olsr-container.tar localhost/olsr:test

Use linux/arm/v7 for 32-bit ARMv7. Cross-platform builds require registered QEMU binfmt handlers. The separate Gitea workflow builds both architectures and publishes a manifest to registry.brunner.ninja/feedc0de/mikrotik-olsr with the full source commit as tag. Configure QUAY_USERNAME and QUAY_TOKEN repository secrets. No RouterOS signing key is used. The workflow does not deploy to routers.

RouterOS 7.25.1 installation

The commands below are a template, not a blindly importable script. Replace NODE_IP with an assigned IPv4 address, bridgeLocal with your trunk bridge, and the USB path with your storage path. Confirm names/subnets do not already exist. Upload the image archive to usb1/olsr-container.tar first.

/interface/vlan/add name=olsr-vlan4 interface=bridgeLocal vlan-id=4 comment=mikrotik-olsr-container
/interface/bridge/add name=olsr-mesh comment=mikrotik-olsr-container
/interface/bridge/port/add bridge=olsr-mesh interface=olsr-vlan4
/interface/veth/add name=veth-olsr address=NODE_IP/32
/interface/bridge/port/add bridge=olsr-mesh interface=veth-olsr
/ip/address/add address=172.31.255.1/30 interface=olsr-mesh comment=mikrotik-olsr-container
/ip/route/add dst-address=NODE_IP/32 gateway=olsr-mesh comment=mikrotik-olsr-container
/container/envs/add list=olsr key=OLSR_INTERFACE value=veth-olsr
/container/envs/add list=olsr key=OLSR_NODE_IP value=NODE_IP
/container/envs/add list=olsr key=BGP_INTERFACE value=veth-olsr
/container/envs/add list=olsr key=BGP_LOCAL_IP value=172.31.255.2
/container/envs/add list=olsr key=BGP_PEER_IP value=172.31.255.1
/container/add name=olsr file=usb1/olsr-container.tar interface=veth-olsr envlist=olsr root-dir=usb1/olsr-root logging=yes start-on-boot=no

In Winbox Routing > BGP, create an instance and a connection equivalent to:

/routing/bgp/instance/add name=OLSR-container as=64512 router-id=172.31.255.1
/routing/filter/rule/add chain=OLSR-container-in rule="reject;"
/routing/filter/rule/add chain=OLSR-container-out rule="reject;"
/routing/bgp/connection/add name=OLSR-container instance=OLSR-container local.role=ebgp local.address=172.31.255.1 remote.address=172.31.255.2/32 remote.as=64513 remote.port=1179 multihop=yes connect=yes listen=no hold-time=9s keepalive-time=3s input.filter=OLSR-container-in output.filter-chain=OLSR-container-out disabled=yes

Before enabling BGP, generate the input filter and paste its output into the OLSR-container-in rule in Winbox:

python3 container/routeros-filter.py --link 1=olsr-mesh --prefix 10.0.0.0/8
# Example for separately provisioned links:
python3 container/routeros-filter.py --link 4=olsr-mesh4 --link 5=ether2 --prefix 10.0.0.0/8

Select your community's accepted prefixes. Use --prefix multiple times as needed. Keep the output reject rule: RouterOS must not feed learned routes back into OLSR. Ensure existing firewall rules permit the intended BGP session and OLSR traffic without exposing BGP or management services to other mesh participants.

Start the container, inspect logs, then enable the BGP connection. Container logs appear in the standard RouterOS Log window with logging=yes. Stop the container to stop OLSR; the supervisor shuts down BIRD too. Disabling only the BGP connection removes RouterOS routes but leaves OLSR running in the container. After abrupt failures, withdrawal depends on the BGP hold timer.

Edit environment settings while stopped and restart to apply configuration. The interface is the name inside the container (veth-olsr in this example). Set OLSR_DEBUG=1 for verbose neighbor logs, or leave the default 0 for quiet operation. etx_ff link quality is currently fixed to match the existing FunkFeuer test. HNA, arbitrary configuration editing, and App YAML are pending hardware tests; the explicit container installation avoids an App manager changing VLAN setup.

Hardware acceptance checks

Verify UDP 698 neighbor discovery, BGP established, active dynamic routes and correct next hops, ping to a direct neighbor and a remote mesh destination, return traffic without any container transit, and withdrawal after both graceful stop and forced termination. Verify the pre-existing Thread container remains running and reachable. Do not enable start-on-boot until these pass. Remove only objects created above to uninstall; never reset or replace existing router configuration.

Registry deployment

A localhost/... image name means a local build archive was imported; it is not a registry deployment. After native forwarding passes hardware acceptance and CI publishes the commit tag, configure RouterOS to use https://registry.brunner.ninja as its container registry and create the container using remote-image=feedc0de/mikrotik-olsr:COMMIT_SHA instead of file=. Use the exact successful CI commit tag; do not assume latest exists. Registry credentials are needed for pulls only if the repository is private. Registry push credentials belong in Gitea Actions secrets, not the image or this repo.