Re: Setting Routes



On Friday 23 of December 2011 00:28:25 devine-mlist ddevnet net wrote:
>  Greetings,
> 
>  I have decided to write a Python script (we can't use libnm-qt, for
>  licensing reasons) that is called by the main program. Using QtDBus was
>  thrown in the "too hard" basket. Most things with Python DBus seem quite
>  easy and there's enough examples :)
> 
>  I see that I can get routes from
>  org.freedesktop.NetworkManager.IP4Config properties however I cannot see
>  how to set them. I'd prefer to set the routes with NetworkManager if
>  possible.
> 
>  Can setting routes be done through the DBus API?
> 
>  --Daniel Devine
> 
> 

org.freedesktop.NetworkManager.IP4Config object of a device is 
read-only and shows active IP parameters.

If you want to set up routes (or addresses), you should update a connection
(or create a new one) and then activate it on a device.

see:
http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager.Settings.Connection
It accepts all new settings, so you need to obtain the connection and change 
the parameters you want.
This example changes Ipv4 address:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/qt/change-
ipv4-addresses.cpp

You can also look  at python examples at:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python
e.g. add-system-connection.py, which work with 'addresses' that are similar to 
'routes'.

you are interested in routes property of 'ipv4' setting here:
http://projects.gnome.org/NetworkManager/developers/api/09/ref-
settings.html#id409163

Jirka

PS: Sorry for replying late, but better late than never ;)



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