Re: Force default gateway for a specific connection?



Hi Dan,

On 19/01/12 18:32, Dan Williams wrote:
On Wed, 2012-01-18 at 12:23 +0100, Thomas Bechtold wrote:
Hi,

is it possible to tell NM to use a specific connection always as default
gateway?
in my case, i use a modem and a lan cable and i want to use always the
modem as default gateway. the reason is, that sometimes a firewall
blocks some LAN traffic so i always want to use the modem connection as
default gw.

Yes it's quite possible, though the terminology is opposite than what
you're talking about.  Every connection in NM by can grab the default
route and will do so by default since that's the most common case.

What you want to do here is to mark the connections you *don't* want to
have the default route as "never-default" (in keyfile config files) or,
in the UI, "Use this connection only for resources on its network" (in
the Routes dialog of nm-connection-editor).

That's not working in my case because both conenctions should grap the default route, but the modem connection should have a higher priority.
i want to do the following (modem=ppp0 and ethernet=eth0) steps:

1) both devices are detached
2) attach eth0: now eth0 should have the default route
3) attach ppp0: now ppp0 should have the default route
4) detach ppp0: now eth0 should have the default route
5) detach eth0: no route (no devices attached)
6) attach ppp0: ppp0 should have the default route
7) attach eth0: ppp0 should have the default route

Is this usecase possible?

With "never-default=true" for the ethernet conenction, after step 4) there's no default route available with nm 0.8.6.


Tom


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]