OPNsense Forum

Archive => 15.1 Legacy Series => Topic started by: benmz on July 01, 2015, 03:33:00 pm

Title: [SOLVED] Route to interface
Post by: benmz on July 01, 2015, 03:33:00 pm
Hi, first of all thanks a lot for your product... I really love to use a decent interface based on a decent firewall !! ;)
One suggestion I have is to support interface based route.

I was adding route like:
route add -inet 195.154.XX.XX/32 -link -iface em0

before 15.1.12 with /etc/hostname.em0 and /etc/rc.conf, but since last upgrade I'm not able anymore to set them automatically on startup...

How could I implement this option ? I don't even know where to start looking in the code. I'm a robust PHP dev  ;) but I have never played with phalcon...

Thanks anyway for your efforts to bring back pleasant firewalls !!
Title: Re: Route to interface
Post by: franco on July 01, 2015, 03:36:54 pm
Hi there, thanks, I think you may be looking for this fix which will also be in tomorrow's 15.7:

https://github.com/opnsense/core/commit/cc88a71d78524006f1596a7496881ede58869d73

Let me know whether that helps or not.
Title: Re: Route to interface
Post by: benmz on July 01, 2015, 03:45:13 pm
Yep! this seems to do the trick for the CLI part...  :)

Anyway I'd be glad to help on GUI dev if needed, but I'm a little bit stuck doesn't knowing where to start for this...

But topic could be set as 'SOLVED'


Thanks a lot for your quick answer, and sorry for my bad english...  ;D
Title: Re: [SOLVED] Route to interface
Post by: franco on July 01, 2015, 03:50:42 pm
Taken care of. And no worries about the English. :)

We'd love some help with the system, here are two pointers...

How to start hacking on the GUI:
http://lastsummer.de/development-workflow-in-opnsense/

Known issues that need help from new contributors:
https://github.com/opnsense/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22

If you have a GitHub account feel free to send pull requests, that's the easiest way to bring code in and to review/discuss.

If you need more help, the IRC channel on FreeNode is #OPNsense
Title: Re: [SOLVED] Route to interface
Post by: franco on July 01, 2015, 03:52:21 pm
PS: Why does "System: Routing: Routes" not do the job for your use case?
Title: Re: [SOLVED] Route to interface
Post by: benmz on July 01, 2015, 04:00:49 pm
Because the routing form only deals with destination IP route, but sometimes (specially with ppp or specific datacenters like here in France with Dedibox) your gateway is not an IP but an interface (set with the -link option in CLI command)
So in my case I got a /32 IP address on em0 a completely different /32 IP as a gateway which I need to set directly to the interface, and a default gateway pointing to that last gateway...

for exemple:

iface ifconfig em0 inet XX.XX.XX.XXX netmask 255.255.255.255
route add -inet 195.154.YYY.1/32 -link -iface em0
route add default 195.154.YYY.1

Does that answer your question ? Did I miss something in the GUI ?  :D
Title: Re: [SOLVED] Route to interface
Post by: franco on July 01, 2015, 04:08:57 pm
Ah, ok, seeing it now. That's worth putting into the GUI for sure.