Reputation: 311
I am working under Linux, with two physical ethernet interfaces. I have grouped the two interfaces to a bonding interface for backup... and it works.
I would like to know if there is any way to know, from my C user program, what is the active interface.
Thanks
Upvotes: 1
Views: 9295
Reputation: 105
Another method to know it (tested on Debian) is looking at the file /proc/net/bonding/bondX
. Replace bondX with the name of your interface.
Upvotes: 0
Reputation: 10579
Look at /sys/class/net/bond0/bonding/active_slave
and read it using a program or code of your choice. (Replace path accordingly if using an interface name different from bond0
.)
Upvotes: 4