C++ Bind to INADDR_ANY does not include CARP virtual ip addresses

Hi all,

I'm writing a server in c++ that should reply to requests on mutliple virtual ip addresses. If I set the s_addr to be INADDR_ANY, the server answers to requests on all ip addresses except the virtual ones.

If I specify one of the virtual ip-addresses in stead of INADDR_ANY, the server answers to requests on the vitual ip.

I tried to set the IP_BINDANY socket option without any luck.

Is there something I've missed or do I have to bind each virtual addresses I want the server to listen on?
 
If I set the s_addr to be INADDR_ANY, the server answers to requests on all ip addresses except the virtual ones.
It will only respond to the VIP address if the interface is MASTER. Or better, packets will only arrive on the VIP address on the MASTER interface. They are silently ignored on the BACKUP interface(s).
 
Thanks for the reply. I've made sure that the interface is MASTER. I know that CARP is correctly configured since my server answers to requests on one of the VIPs when I bind to that address specifically. In fact, it has been working for several years with one VIP, but now I need the server to listen on multiple VIPs.
 
Back
Top