Page 1 of 1

script to change ospf cost based on wireless modulation?

Posted: Mon Apr 19, 2021 8:46 pm
by syadnom
Has anyone made or found a script to change OSPF cost based the 'tx-rate' on the interface?

This is for a WDS mesh proof of concept. I'll pull tx modulation levels out of the registrations table so I can update OSPFv3 costs on the matching interface. Just hoping to see how others have done it and shortcut my own dev process.

Re: script to change ospf cost based on wireless modulation?

Posted: Fri Apr 23, 2021 4:51 am
by millenium7
Changing OSPF link cost will drop the adjacency, keep that in mind. It is not a dynamic process without interruption
TX-Rate is also not a suitable metric, you'd want to build a script that uses RSSI, SNR and link quality. TX rate is just that, TX rate. Doesn't mean anything about actual effective received rate on the other side. It also often nose-dives to 1mbit/s when idle but almosti mmediately returns to where it should be

I did build a pseudo-routing protocol in mikrotik scripting a few years ago to improve a mesh, but it wasn't WDS and it dynamically added devices to the drop list to reduce airwave usage. It was built around the concept of moving drones that could keep a mesh going with as much speed as possible. Always finding a path to the destination node and disconnecting all redundant links. Each one operated independently, but it did work fairly well. Didn't have any issues with an isolated segment

So it is possible but you're going to have to learn scripting and build it yourself

Re: script to change ospf cost based on wireless modulation?

Posted: Sat Apr 24, 2021 3:33 am
by syadnom
@millenium7, OSPFv3 only drops the specific adjacency for the interface changed. Unlike OSPFv2 that freaks out entirely, this is pretty graceful. The mesh would be pretty static and stable so if I'm intending to reduce an interface cost because of poor modulation it's probably ok to drop this. would be nice if it were more like a static route. Really, I just want to have an automatic way to handle if there is an obstruction or the radio get's moved etc and the signal level tanks. I could just set an access list dropping any low-signal links to keep from having -85 connections on, but that doesn't really help when someone plugs in a netgear monstrosity that nukes the airwaves nearby and I need that node deprioritized in a hurry without dropping them off. I'd rather have one sketchy link for that customer and every other one route around. I can then manually address the noise.

I could just copy the routes from OSPFv3's routes (/routing ospf-v3 route print) to static routes using the OSPF cost as 'distance'. Let OSPFv3 do the work of calculating the routes out but still update OSPFv3 routes based on SNR and CCQ so OSPFv3 does the hard work. Then just copy or update the statics on a timer which don't cause any adjacency drops. Of course, delete non-existent routes in the process. This seems to work really well on my lab in gns3. The OSPFv3 cost changes do their thing up at distance 110 and the statics are the 'real' routes. copy down the changes without any disruption.

The goal here is to get into areas that I can't otherwise. I've tried cambium 450i in 3Ghz and 900Mhz, no go. Can't trench in fiber or DSL. But each home can see a dozen others through gaps in the trees so a mesh is a practical design despite mesh pitfalls. Then, as needed, add 60Ghz links to make a high capacity path with a OSPF cost of 1 for every 60Ghz link. I would also be bridging an EoIP tunnel from the customer's port back to the core router (MTUs adjusted to compensate, 1500 EoIP path).

These are people using hughesnet and that starlink is way to high a price. They're dying for a fair price on a 10Mbps connection so their kids can do homework on.

Finally, if mikrotik would release some terragraph-type gear at a killer price w/ 5Ghz backup then maybe this is all just wasted effort.
Ultimately I'd like to do a dual radio mesh to avoid hop pena