[Resolved] WAN Gateway different subnet - Persistent

Started by michaelsage, February 02, 2018, 11:38:57 PM

Previous topic - Next topic
February 02, 2018, 11:38:57 PM Last Edit: February 03, 2018, 01:56:16 PM by michaelsage
Hi All,

I run a dedicated server. I have a slight issue in that my WAN gateway is not on the same subnet as my public IPs.

I used shellcmd in pfSense and understand that doesn't exist in OPNSense which is fine.

Can I simple add the following to my /etc/rc file? Is it persistent (i.e. upgrades & updates)?


route add -net GWIP -iface em0
route add default GWIP


Is there somewhere I should put it instead?

Thanks

Michael

February 02, 2018, 11:57:59 PM #1 Last Edit: February 03, 2018, 12:03:10 AM by marjohn56
If you enable secure shell and login to that as root you can do it from the shell, but doubt it would survive an update. You could also do it this way...

https://docs.opnsense.org/development/backend/autorun.html

I think you should also be able to do it by adding a route & gateway and setting it default, but don't quote me on that.
OPNsense 24.7 - Qotom Q355G4 - ISP - Squirrel 1Gbps.

Team Rebellion Member

February 03, 2018, 06:17:57 AM #2 Last Edit: February 03, 2018, 04:14:10 PM by mimugmail
Quote from: michaelsage on February 02, 2018, 11:38:57 PM
Hi All,

I run a dedicated server. I have a slight issue in that my WAN gateway is not on the same subnet as my public IPs.

I used shellcmd in pfSense and understand that doesn't exist in OPNSense which is fine.

Can I simple add the following to my /etc/rc file? Is it persistent (i.e. upgrades & updates)?



route add -net GWIP -iface em0
route add default GWIP


Is there somewhere I should put it instead?

Thanks

Michael


Just setup a gateway as usual and tick "Far Gateway", then the check for the same subnet is disabled :)
Happy routing!  8)



I was under the impression pfSense had a similar checkbox of a different name for a while now too, possibly predating our option. :)


Cheers,
Franco