Re: How to know which active connection is choosen ?



On Wednesday 16 of February 2011 16:49:39 Maxime Boure wrote:
> Many thanks !
> I'll look into that.
> 
> I'm pretty sure the response is no, but is there a way to controle thoses
> route from NM (using dbus api or some sort of configuration files)?
> 

Yeah, the routing is done according to the routing table.
You can use these command to display the table:
* route
* netstat -r
* ip route
see man pages for more options.

Answer to your question about configuring routes is possitive :)
You can run nm-connection-editor (nm-applet right-click->"Edit 
connections...". Go to "IPv4 settings "tab add click "Routes...", where you 
can specify manual routes.
Also, if you check "Use this connection only for resources on its network", 
the device on which the conection is activated won't get the default route.

As far as D-Bus are concerned, you can get all settings (including routes) 
from a configured connection:
dbus-send  --system --print-reply --
dest='org.freedesktop.NetworkManagerSystemSettings' 
'/org/freedesktop/NetworkManagerSettings/0' 
org.freedesktop.NetworkManagerSettings.Connection.GetSettings

replace 0 with the appropriate number for your connection.

When you have an active connection, IP configuration can be obtained as 
follows:

dbus-send --system --print-reply --dest='org.freedesktop.NetworkManager' 
'/org/freedesktop/NetworkManager' org.freedesktop.NetworkManager.GetDevices

dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager 
/org/freedesktop/NetworkManager/Devices/1 org.freedesktop.DBus.Properties.Get 
string:org.freedesktop.NetworkManager string:Ip4Config

dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager 
/org/freedesktop/NetworkManager/IP4Config/1 org.freedesktop.DBus.Properties.Get 
string:org.freedesktop.NetworkManager string:Routes

again substitute the numbers for your actual values.

Tip: d-feet is nice GUI D-Bus browser (debugger)

Jirka

> On Wed, Feb 16, 2011 at 12:13 PM, Phil Thompson 
<phil yarwell demon co uk>wrote:
> > On Wed, 2011-02-16 at 11:14 +0100, Maxime Boure wrote:
> > > Is it possible to configure it, is there a default configuration ?
> > 
> > If you type "route" at a command prompt you can see what the default
> > route is. Usually it is the one with the faster speed.
> > 
> > "man route" will show you the options for manipulating the routing
> > table.
> > 
> > 
> > Phil


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