OPNsense Forum

Archive => 18.1 Legacy Series => Topic started by: michaelsage on February 02, 2018, 11:38:57 pm

Title: [Resolved] WAN Gateway different subnet - Persistent
Post by: 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)?

Code: [Select]
route add -net GWIP -iface em0
route add default GWIP

Is there somewhere I should put it instead?

Thanks

Michael
Title: Re: WAN Gateway different subnet - Persistent
Post by: marjohn56 on February 02, 2018, 11:57:59 pm
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 (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.
Title: Re: WAN Gateway different subnet - Persistent
Post by: mimugmail on February 03, 2018, 06:17:57 am
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)?

Code: [Select]

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)
Title: Re: WAN Gateway different subnet - Persistent
Post by: michaelsage on February 03, 2018, 10:02:41 am
Awesome. I'll give that a shot.

Thanks
Title: Re: WAN Gateway different subnet - Persistent
Post by: michaelsage on February 03, 2018, 01:55:55 pm
Thanks that fixed it!
Title: Re: [Resolved] WAN Gateway different subnet - Persistent
Post by: franco on February 03, 2018, 03:37:46 pm
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