Re: Interface Alias creation using NetworkManager



Hi Dan,

Sorry for the delay in response, I had not access of email over the weekend.
And Thanks a lot for your time and help to answer my queries.

Thanks for the pointers on 'Assigning the multiple IP address to the existing physical interfaces' and also on 'Assigning the IP4 information on
a connection and applying that connection to a device/interface.'.
Thanks for pointing the example programs, currently going through those to get familiarize with those.

[Dan ] Are you trying to get a notification when the *IP* addresses is added/removed from an interface?  Or something else?

       [Girish] Yes, I am looking for the callback function when IP address is added/removed from an interface.
For this 'active_connections_changed' call back fucntion is enough or should I register a separate function?


Thanks again,
Girish. 


On Thu, Jun 20, 2013 at 11:08 PM, Dan Williams <dcbw redhat com> wrote:
On Thu, 2013-06-20 at 22:46 +0530, Girish Kumar Shetty wrote:
> Dear Experts,
>
>       I am quite new-bie  for Network Manager  and looking for some
> information mentioned below, any help/pointers on these will be a great
> help.
>
>    -   I am just wondering, Is there a way to create an Alias for interface
>    using Network Manager libraries( I mean, programmatically using libnm-glib
>    and/or libnm-utils )?

Interface aliases are generally deprecated, because the only reason for
their existence was that long ago, you could not assign multiple IP
addresses to the same interface.  See "ifconfig"; it's using the old
interfaces and cannot show multiple IP addresses.  But for the past 10
years or so, you can add multiple IP addresses to one interface, and
thus you don't need aliases.

ip addr add 192.168.1.10/24 dev eth0
ip addr add 10.0.0.1/8 dev eth0
ip addr show eth0
ifconfig eth0

note the difference.

>    -   And how can I configure IP4 information( like IP Addresses, Netmask,
>    DNS, routes etc.,) to this alias interface. Could you please provide some
>    hints on APIs?

You add all the IP addresses to the same "connection" and apply that
connection to the interface/device you wish to use.

>    -   Is it possible to get a notification If I run g_main_loop_run() as
>    mentioned in libnm-glib-test.c when this alias is created and removed?

libnm-glib-test may not be the best way to do this, see the "examples"
directory for a variety of ways to use the available APIs.  libnm-glib
(the library) is a great way to talk to NM using glib-based systems,
while Qt/KDE also have their own bindings.  Alternatively, you could use
plain D-Bus with python, C, etc.

>    -  I ran  executable created from 'libnm-glib-test.c'  and at the same
>    time I have created an alias for eth0 manually by adding an entry eth0:0 n
>    the /etc/network/interfaces ( and also tried using 'ifconfig' command in

You can also just add multiple IP addresses to the interface config
in /e/n/i and thus you don't need aliases.

>    command line) in both cases 'ifconfig' command on terminal has shown the
>    alias. But active_connection_changed call back function was not called. I
>    was assuming that creation/deletion of on Alias will cause a change in
>    active connection and 'active_connection_changed' callback function will be
>    called.
>    Could you please tell me what is the signal and callback function I have
>    to register in-order to get the events on this alias interface creation an
>    deletion.

Are you trying to get a notification when the *IP* addresses is
added/removed from an interface?  Or something else?

Dan





--
Best Regards,
Girish Kumar Shetty


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