OPNsense Forum

English Forums => Development and Code Review => Topic started by: fabian on March 10, 2017, 11:11:53 pm

Title: Routing Protocol Support
Post by: fabian on March 10, 2017, 11:11:53 pm
Hi, I made a more or less working version of a plugin, that allows routing protocols like OSPF in OPNsense.
https://github.com/opnsense/plugins/pull/88

Quagga supports a lot more protocols but if you like to add another than OSPF like BGPv4 or RIP or are willing to help it could be even better.

Because it is a work in progress, it may not work on your device (the config still includes hardcoded interfaces because quagga generates them every time you copy the running config to the startup config and did not try if I can remove them securely.

Kind regards

Fabian
Title: Re: Routing Protocol Support
Post by: franco on March 11, 2017, 04:00:53 pm
Hi Fabian,

This is very cool, thanks for doing this! :)


Cheers,
Franco
Title: Re: Routing Protocol Support
Post by: mimugmail on March 13, 2017, 02:16:36 pm
Hi,

I'm quite new to OPN but very familiar wit PF.
Searching for a solution to use OSPF and BGP and stumbled upon on this one.

Any way to help or test here?

I was planning to use just the CLI like in the doc (https://docs.opnsense.org/manual/how-tos/quagga.html) but if there's a GUI I fine too :)
Title: Re: Routing Protocol Support
Post by: fabian on March 13, 2017, 10:35:14 pm
You should use the CLI for now because it will not go into the next release (17.1.3) and the GUI will not provide the full functionality (only basic configuration)

I am not going to implement BGP as I have never used it and I have no idea how it works. The Plugin seems to generate a valid config but there is some unexpected behaviour in the framework for me :/

I can ask franco for a merge if you like.
Title: Re: Routing Protocol Support
Post by: mimugmail on March 14, 2017, 06:56:58 am
I'm using BGP on Quagga (Linux) for years, also some minor stuff with OSPF.
Would love to help. :)
Title: Re: Routing Protocol Support
Post by: fabian on March 14, 2017, 02:05:20 pm
The code is now merged into the plugins repository. It will be possible to test it soon.

@Wordo: You may extend it by yourself (you can use the existing code as a template) or if anyone is willing to implement it, some configuration samples can help too (especially to know which configuration directives are important to you and therefore probably for others too).
Title: Re: Routing Protocol Support
Post by: mimugmail on March 14, 2017, 02:38:44 pm
Thanks! My test system is now OPNsense 17.7.a_213-amd64.

Will wait until the plugin will appear in the list, or do I have to add it by hand?


 
Title: Re: Routing Protocol Support
Post by: mimugmail on March 14, 2017, 03:31:40 pm
Meeep .. forget it. Cloned the plugin project beside core and installed it by hand.
Will start digging into it :)
Title: Re: Routing Protocol Support
Post by: fabian on March 16, 2017, 10:26:27 pm
I have seen that is is in the packages now.

It can be installed by typing "pkg install os-quagga-devel" into the shell.
Leave your comments  here for feedback or create a ticket in the GitHub repository opnsense/plugins which may mention me (@fabianfrz).

Kind regards

Fabian
Title: Re: Routing Protocol Support
Post by: mimugmail on March 17, 2017, 01:43:37 pm
Thanks! I didn't find the time yet to dive into coding standards.

Will setup a second machine on VBox and try the package.
Title: Re: Routing Protocol Support
Post by: mimugmail on March 20, 2017, 04:24:30 pm
Thanks! I didn't find the time yet to dive into coding standards.

Will setup a second machine on VBox and try the package.

Did a first pull request :)
Title: Re: Routing Protocol Support
Post by: fabian on March 20, 2017, 06:01:31 pm
The coding style is PSR1 and PSR2 for PHP, PEP8 for Python.
Title: Re: Routing Protocol Support
Post by: mimugmail on March 22, 2017, 11:23:04 am
Hi,

do you know how we can handle the problem, that the named interfaces from OPNsense arent supported by the physical ones of quagga?

The UI offers only wan or lan, but on the system itself it's em0 and em1.

I didn't dive to deep in the code (and I'm far from good on coding), but is the $uuid responsible for selecting/finding the interface, like here:

https://github.com/opnsense/plugins/blob/master/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php

Title: Re: Routing Protocol Support
Post by: fabian on March 22, 2017, 11:33:11 am
The uuid is required as an unique key for a field which contains multiple values (1:n association).

In Quagga it is possible to have an per interface configuration and because some settings (depending on the used routing protocol) apply to an interface we don't know, we cannot hardcode it.

UUID come from the model and have nothing to do with interfaces, except that interfaces in the OSPF configuration are managed via an ArrayField which has an UUID.

Here is the line which makes the uuid required:
https://github.com/opnsense/plugins/blob/master/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/OSPF.xml#L67
Title: Re: Routing Protocol Support
Post by: mimugmail on March 22, 2017, 01:53:25 pm
Got you, thanks!

Ok, so I could rename the interfaces in UI to have the same name as system interface in order to prevent conflicts in the configuration, right?
Title: Re: Routing Protocol Support
Post by: fabian on March 22, 2017, 02:43:54 pm
The GUI shows the names visible in the interface section (for example lan) but the real interface names like em0 are stored in the backend.
Title: Re: Routing Protocol Support
Post by: mimugmail on March 22, 2017, 06:05:08 pm
But in the ospf.conf there's a passive interface lan for example, I'm more familiar within linux, so I'm not sure if this is correct?
Title: Re: Routing Protocol Support
Post by: fabian on March 22, 2017, 06:57:16 pm
you can configure any interface as a passive interface. This is a CSV field which is spit by ",". See: https://github.com/fabianfrz/plugins/blob/master/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/ospfd.conf#L34

BTW: OPNsense is a FreeBSD, not Linux.
Title: Re: Routing Protocol Support
Post by: mimugmail on March 22, 2017, 08:30:28 pm
I tried to set the IF by hand but the results were not saved.

Surely it's BSD, that's why I'm a bit clumsy  ;D
Title: Re: Routing Protocol Support
Post by: mimugmail on March 27, 2017, 01:53:32 pm
Hi,

do you know if there will be a 0.0.2 release pkg?

Thanks!
Title: Re: Routing Protocol Support
Post by: fabian on March 27, 2017, 02:39:47 pm
No there will be a 0.0.2-dev with the next release but you can install it via pkg. Note that is will still not pull in quagga as a dependency - this will be in 0.0.3.
Title: Re: Routing Protocol Support
Post by: fabian on March 27, 2017, 10:35:00 pm
Little Update: 0.0.3 will support RIPv1 and RIPv2 too.
Title: Re: Routing Protocol Support
Post by: mimugmail on March 28, 2017, 07:12:11 am
Cool! :)

I always do a pkg update and pkg search quagga, but there's only the 0.0.1 version.

Title: Re: Routing Protocol Support
Post by: franco on March 28, 2017, 07:17:55 am
Hi Wordo,

We only refresh the mirrors (including the plugins) on a release build. If you upgrade to 17.1.4 the latest version of the plugin will be applied automatically.

I don't recommend pkg upgrade -- it mostly works, but will miss reboots and FreeBSD updates.


Cheers,
Franco
Title: Re: Routing Protocol Support
Post by: mimugmail on March 28, 2017, 10:16:13 am
Got it, thanks! :)
Title: Re: Routing Protocol Support
Post by: mimugmail on April 04, 2017, 04:09:31 pm
Hi,

I'm currently working on a bgp setup page but when I enable the service and press save there's nothing. Also the values won't get saved.

How can I debug the insights on opnsense? Had a short look on the dev guide but didn't found anything.

If you like I could send a pull request for review if you're interested.
Title: Re: Routing Protocol Support
Post by: fabian on April 04, 2017, 06:14:50 pm
Did you add the correct JavaScript to the view?

BTW: You can always create a pull request but please prefix it with [WIP] so nobody will merge it.
Title: Re: Routing Protocol Support
Post by: fabian on April 10, 2017, 02:35:30 pm
Just some news for you: Will be released soon.
Title: Re: Routing Protocol Support
Post by: mimugmail on April 10, 2017, 10:18:30 pm
Yep, had a look at #115.

But I'm still not sure if the interface detection really works.

When I connect via vtysh I can see all my physical interfaces like em0, em1 ... but when I set passive interface in OSPF, it's written as "wan" in the config. I haven't tried this out yet, but are you sure this will work correctly?
Title: Re: Routing Protocol Support
Post by: fabian on April 11, 2017, 08:13:21 am
Looks like there is something wrong. I will ask Franco for the issue.
Title: Re: Routing Protocol Support
Post by: mimugmail on April 11, 2017, 11:06:41 am
ATM for me it only works if I rename the IFs in OPNsense to my physical ones.

OT: Is there some kind of IRC where you guys are available?
Title: Re: Routing Protocol Support
Post by: fabian on April 11, 2017, 11:44:02 am
a chennel on freenode: #opnsense
Title: Re: Routing Protocol Support
Post by: fabian on April 15, 2017, 09:14:33 am
Good news for users of BGP: Another user contributed basic BGP support:
https://github.com/opnsense/plugins/pull/112
https://github.com/opnsense/plugins/pull/121

It will be in devel version of the quagga plugin, which is released with the next version of OPNsense (17.1.5).

Feedback and pull requests are welcome.

Have a nice easter weekend!

Fabian
Title: Re: Routing Protocol Support
Post by: fabian on April 30, 2017, 01:26:47 pm
BGP will be supported in the next version. (17.1.6) - developer preview users can test some diagnostics pages.
Title: Re: Routing Protocol Support
Post by: fabian on May 03, 2017, 03:56:49 pm
The development will also include OSPFv3 (for IPv6) - 17.1.7
Title: Re: Routing Protocol Support
Post by: fabian on May 10, 2017, 11:23:16 am
If you are still reading this: the developer preview may include OSPFv3 (by michael) and a diagnostics page (by me).
Title: Re: Routing Protocol Support
Post by: iffster1 on November 03, 2017, 02:06:15 pm
Any info about BGP ipv6?
Title: Re: Routing Protocol Support
Post by: mimugmail on November 03, 2017, 02:54:24 pm
I can try to get this working in two weeks ...