On Thu, 2013-06-20 at 22:46 +0530, Girish Kumar Shetty wrote:> - I am just wondering, Is there a way to create an Alias for interface
> 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.
>
> using Network Manager libraries( I mean, programmatically using libnm-glibInterface aliases are generally deprecated, because the only reason for
> and/or libnm-utils )?
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 someYou add all the IP addresses to the same "connection" and apply that
> hints on APIs?
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 nYou can also just add multiple IP addresses to the interface config
> the /etc/network/interfaces ( and also tried using 'ifconfig' command in
in /e/n/i and thus you don't need aliases.
Are you trying to get a notification when the *IP* addresses is
> 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.
added/removed from an interface? Or something else?
Dan