๐ OSPF PTP
Set up a clean OSPF pointโtoโpoint (PTP) adjacency using interface templates, a loopback routerโID, and a /30 transit network. This configuration is ideal for routerโtoโrouter links where you want predictable neighbor formation and fast convergence.
This guide uses RouterOS v7 OSPF interface templates. Adjust interface names and subnets to match your environment.
Prerequisitesโ
- โ MikroTik RouterOS v7.x
- โ Two routers connected on a /30 or /31 link
- โ Loopback interface configured (or use a stable interface address)
- โ SSH/Winbox access to both routers
- โ Matching OSPF area on both ends
OSPF will advertise routes between routers. Confirm your firewall allows OSPF (protocol 89) and avoid overlapping subnets.
Configuration Stepsโ
Option A: Terminalโ
-
Create OSPF instance
/routing ospf instance add disabled=no name=ospf-instance-1 originate-default=always router-id=10.254.254.1 -
Create OSPF area
/routing ospf area add disabled=no instance=ospf-instance-1 name=ospf-area-1 -
Add loopback template (passive)
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=lo \
networks=10.254.254.1/32 passive priority=1 -
Add PTP interface template
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan10-OSPF \
networks=172.16.0.0/30 priority=1 type=ptp
Option B: Winboxโ
-
Routing โ OSPF โ Instances
- Add instance
ospf-instance-1 - Set Router ID to
10.254.254.1 - Set Originate Default to
always
- Add instance
-
Routing โ OSPF โ Areas
- Add area
ospf-area-1 - Link to
ospf-instance-1
- Add area
-
Routing โ OSPF โ Interface Templates
- Add Loopback template
- Interface:
lo - Network:
10.254.254.1/32 - Passive: enabled
- Interface:
- Add PTP template
- Interface:
vlan10-OSPF - Network:
172.16.0.0/30 - Type:
ptp
- Interface:
- Add Loopback template
Understanding the Configurationโ
Flow Diagram
[Loopback /32] -> [OSPF Instance] -> [Area] -> [PTP Link] -> [Neighbor]
Topology Chart (Two Routers)
OSPF Area 0.0.0.0 (ospf-area-1)
Router-A (R1) Router-B (R2)
---------------- ----------------
Lo0: 10.254.254.1/32 Lo0: 10.254.254.2/32
Router-ID: 10.254.254.1 Router-ID: 10.254.254.2
VLAN10-OSPF: 172.16.0.1/30 <----PTP----> VLAN10-OSPF: 172.16.0.2/30
Components Table
| Component | Purpose | Notes |
|---|---|---|
| Router ID | Stable OSPF identity | Use loopback /32 |
| Area | OSPF scope | Same on both ends |
| Interface Template | Binds interfaces | RouterOS v7 model |
| PTP Type | Pointโtoโpoint adjacency | Ideal for /30 links |
Two-Router Example Configurationโ
Router-A (R1 CORE)โ
/interface bridge add name=lo
/ip address add address=10.254.254.1/32 interface=lo
/ip address add address=172.16.0.1/30 interface=vlan10-OSPF
/routing ospf instance add disabled=no name=ospf-instance-1 originate-default=always router-id=10.254.254.1
/routing ospf area add disabled=no instance=ospf-instance-1 name=ospf-area-1
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=lo \
networks=10.254.254.1/32 passive priority=1
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan10-OSPF \
networks=172.16.0.0/30 priority=1 type=ptp
Router-B (R2 AC)โ
/interface bridge add name=lo
/ip address add address=10.254.254.2/32 interface=lo
/ip address add address=172.16.0.2/30 interface=vlan10-OSPF
/routing ospf instance add disabled=no name=ospf-instance-1 router-id=10.254.254.2
/routing ospf area add disabled=no instance=ospf-instance-1 name=ospf-area-1
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=lo \
networks=10.254.254.2/32 passive priority=1
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan10-OSPF \
networks=172.16.0.0/30 priority=1 type=ptp
Use different router IDs and loopback addresses on each router. The PTP subnet must match on both ends.
originate-default=always should typically be set only on R1 (CORE) if it is the internet gateway. Do not enable it on R2 unless R2 is also intended to inject a default route into OSPF.
Two Links (ECMP) Exampleโ
Use two parallel PTP links for redundancy and loadโsharing. OSPF will install ECMP routes automatically when costs are equal.
Topology
R1 <==== PTP Link A ====> R2
R1 <==== PTP Link B ====> R2
Link A: 172.16.0.0/30
R1: 172.16.0.1/30
R2: 172.16.0.2/30
Link B: 172.16.0.4/30
R1: 172.16.0.5/30
R2: 172.16.0.6/30
Router-A (R1) โ Dual Linksโ
/ip address add address=172.16.0.1/30 interface=vlan10-OSPF
/ip address add address=172.16.0.5/30 interface=vlan20-OSPF
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan10-OSPF \
networks=172.16.0.0/30 priority=1 type=ptp
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan20-OSPF \
networks=172.16.0.4/30 priority=1 type=ptp
Router-B (R2) โ Dual Linksโ
/ip address add address=172.16.0.2/30 interface=vlan10-OSPF
/ip address add address=172.16.0.6/30 interface=vlan20-OSPF
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan10-OSPF \
networks=172.16.0.0/30 priority=1 type=ptp
/routing ospf interface-template add area=ospf-area-1 disabled=no interfaces=vlan20-OSPF \
networks=172.16.0.4/30 priority=1 type=ptp
To prefer one link, set different interface costs: /routing ospf interface-template set <id> cost=50.
Verificationโ
- Check OSPF neighbor state
/routing ospf neighbor print - Verify OSPF routes
/routing route print where routing-table=main protocol=ospf - Confirm interface templates
/routing ospf interface-template print - Ping remote router ID
/ping 10.254.254.2
Troubleshootingโ
| Issue | Cause | Solution |
|---|---|---|
| No neighbors | OSPF disabled | Ensure instance and area enabled |
| Neighbor stuck Init | MTU mismatch | Match MTU on both interfaces |
| Neighbor stuck ExStart | Duplicate router ID | Use unique router IDs |
| Neighbor flapping | Link instability | Check physical link/VLAN |
| No routes learned | Missing network statements | Verify interface templates |
| Passive on PTP | Wrong passive flag | Ensure PTP template is not passive |
| Wrong area | Area mismatch | Match area names on both routers |
| Default route missing | Originate not set | Set originate-default=always |
| CPU high | LSA flood | Reduce network size / tune timers |
| Routes in wrong table | Policy routing | Verify routing tables |
| OSPF blocked | Firewall filters | Allow protocol 89 |
| Neighbor up but no reachability | Missing IP config | Set proper /30 addressing |
Advanced Optionsโ
- Use
/31for PTP links to save IPs - Add authentication (MD5) on templates
- Tune hello/dead timers for fast failover
- Use separate area for backbone and access
- Disable default originate when not needed
- Add BFD for subโsecond convergence
- Use route filters to control advertisements
- Add passive templates for LAN subnets
- Enable ECMP for multiโlink designs
- Monitor OSPF with Netwatch/Telegram alerts
Related Guidesโ
Completionโ
โ OSPF PTP is configured!
Next steps:
- Configure the neighbor router with matching area and network
- Verify routes and adjacency stability
- Document router IDs and link subnets