Hello,
I have a Kamailio 3.0 server with two interfaces. 192.168.x.x and a public interface.
I send PUBLISH out on the private interface to my presence server.
Everything else happens on the public address.
I did not use the "listen=" option in the config, so Kamailio was automatically detecting my interfaces to bind to.
Last night I had a provider sending packets in on TCP and Kamailio was sending out on UDP. Unfortunately, it kept using the private interface despite that the IP was unreachable on this interface.
It looks like Kamailio uses the first interface it finds when converting between TCP and UDP, and I believe that on the server, the private interface was being listed first.
I finally added listen= in kamailio with all 4 interfaces ( tcp/udp public and tcp/udp private ). I listed the public UDP interface first, restarted and the packets started going out on the public interface.
Is this a feature or a bug ?
How does Kamailio decide which interface to use ? What if I sent a packet to an IP that is only reachable on one interface?
At the very least, I think that a note about this difficulty should be included in the default config so that future users don't have the same issue I did.
Thanks,
David
Am 16.03.2011 15:06, schrieb David:
Hello,
I have a Kamailio 3.0 server with two interfaces. 192.168.x.x and a public interface.
I send PUBLISH out on the private interface to my presence server.
Everything else happens on the public address.
I did not use the "listen=" option in the config, so Kamailio was automatically detecting my interfaces to bind to.
I always specify explicitly the sockets, thus I do not know hwo the "auto" feature works.
Last night I had a provider sending packets in on TCP and Kamailio was sending out on UDP. Unfortunately, it kept using the private interface despite that the IP was unreachable on this interface.
It looks like Kamailio uses the first interface it finds when converting between TCP and UDP, and I believe that on the server, the private interface was being listed first.
I finally added listen= in kamailio with all 4 interfaces ( tcp/udp public and tcp/udp private ). I listed the public UDP interface first, restarted and the packets started going out on the public interface.
Is this a feature or a bug ?
Probably it is just by design. If you do not tell Kamailio which interface to use (force_send_socket) it somehow has to guess. If usually tries to use the same socket on which the message was received. Probably in case of protocol change that does not work.
How does Kamailio decide which interface to use ? What if I sent a packet to an IP that is only reachable on one interface?
Either force the interface, or use mhomed=true (multihomed).
Actually, I always thought that the interface on which the request will be sent is chosen by the OS (based on routing table) - Kamailio just decides which src-IP address to use in the SIP message. If you set mhomed=yes, then it opens a new socket to find out which IP will be choosen be the OS, close the socket, use the IP in the message header, and send it on the respective socket.
At the very least, I think that a note about this difficulty should be included in the default config so that future users don't have the same issue I did.
Patches are welcome.
regards Klaus