You are not logged in.

#1 2013-12-15 03:44:28

senorsmile
Member
Registered: 2010-12-12
Posts: 72

netctl: adjust gateway metric per interface OR run custom post-up scri

trying to use an old laptop as a little router (technically a wireless bridge) to connect to the wifi at my house, then use the wired interface connected to a switch to have a separate wired network for a test bench.

I've just begun using netctl, and while it's easy to figure out and get things going, I can't figure out how to get it to set the default gateways properly. 

The core problem is that when the wired connection is present, the default gateway is set to it, despite the internet only being available via the wireless interface. 
E.g. 

[root@laprouter]# ip route
default via 192.168.10.1 dev enp0s10
default via 192.168.0.1 dev wlp3s0 metric 303
...

Clearly I can manually either change the metric or delete the default via enp0s10.  However, I'd like this to be handled automatically.  I have searched around and haven't found anything, and the wiki doesn't seem to address this currently.

Offline

#2 2013-12-15 10:46:17

carriage
Member
From: Finland
Registered: 2012-08-01
Posts: 7

Re: netctl: adjust gateway metric per interface OR run custom post-up scri

From the netctl.profile man page:

ExecUpPost=
           A command that is executed after a connection is established. If the specified command returns anything other than 0 (success), netctl will
           abort and stop the profile. If the command should be allowed to fail, add ‘|| true’ to the end of it.

           
There's also a bunch of other configurable settings defined there which may be of help.

Offline

#3 2013-12-15 11:59:23

progandy
Member
Registered: 2012-05-17
Posts: 5,280

Re: netctl: adjust gateway metric per interface OR run custom post-up scri

You have multiple options to set the route, try to set a custom route:

Gateway= # don't set a gateway automatically, use only routes-array
Routes=("default metric 1 via 192.168.0.2") # leave routes empty if you don't want any gateway here

or use the IPCustom= array to modify the routes.

Last edited by progandy (2013-12-15 12:04:08)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2013-12-16 22:41:53

senorsmile
Member
Registered: 2010-12-12
Posts: 72

Re: netctl: adjust gateway metric per interface OR run custom post-up scri

progandy wrote:

You have multiple options to set the route, try to set a custom route:

Gateway= # don't set a gateway automatically, use only routes-array
Routes=("default metric 1 via 192.168.0.2") # leave routes empty if you don't want any gateway here

or use the IPCustom= array to modify the routes.

Thanks!  Exactly what I was looking for.

Offline

#5 2014-01-26 16:53:21

zanegrey
Member
Registered: 2013-08-23
Posts: 12

Re: netctl: adjust gateway metric per interface OR run custom post-up scri

I ran into the same issue.  Would you mind specifying whether you used the IPCustom array or the former Gateway and Routes options, or perhaps just posting your profile?  Thanks!

Offline

Board footer

Powered by FluxBB