Hello community,<br>I have two servers with keepalived running and keepalived is running VRRP protocol to have redundancy. I&#39;ve configured a virtual IP address to be started when keepalived starts, so there are one active virtual IP and one real IP per server. OpenSIPS (1.6.4tls) is configured to be run on IP of 10.22.0.254, which is virtual IP address and keepalived is configured to start OpenSIPS upon master transition and stop it if it goes to slave mode. Real IP of first server is 10.22.0.1, backup server 10.22.0.2. Also, both of these interfaces are in VLAN mode, so VLAN 402 is for internal network and VLAN 401 for the Internet. Each server has public IP address on eth0.401 and I&#39;d like OpenSIPS to be able to accept SIP requests from both internal LAN &amp; Internet. OpenSIPS is used as a call director and load balancer, there are two Asterisk servers behind it and I use OpenSIPS to send calls to them. Asterisk servers are on IPs (not virtual) of 10.22.0.3 &amp; 10.22.0.4. All works fine when clients connect from LAN and mhomed=0 is set in configuration file.<br>
<br>But I&#39;ve run into a problem that when I enable mhomed=1 system is unable to find outgoing socket. I&#39;ve traced that problem and found that it works fine as long as I have real IP address on PBX and it stops working as soon as I switch to keepalived and virtual IP address. System accepts a call from client and then unable to route it to any of Asterisk servers with an error:<br>
<br>Aug 10 10:49:14 localhost /opt/opensips/sbin/opensips[21748]: ERROR:core:get_out_socket: no socket found<br>Aug 10 10:49:14 localhost /opt/opensips/sbin/opensips[21748]: ERROR:tm:update_uac_dst: failed to fwd to af 2, proto 1  (no corresponding listening socket)<br>
Aug 10 10:49:14 localhost /opt/opensips/sbin/opensips[21748]: ERROR:tm:t_forward_nonack: failure to add branches<br><br>Ok, so I tried to use force_send_socket() function and mhomed=0 to route outgoing calls from clients to Asterisk servers - and it works fine without issues. But the problem here is what to do with incoming calls from Asterisk gateways to clients? Clients may be connected both from LAN &amp; from the Internet. I&#39;m using just simple load_balance() function to route calls to Asterisk servers, drouting module not used.<br>
<br>I haven&#39;t tested it yet, but I think it will be unable to find appropriate outgoing interface to send packets from. And I really don&#39;t know how to analyze from where client is connected and how to choose correct socket for it to use force_send_socket function in this case. So, maybe mhomed should be fixed to determine this virtual interface correctly somehow? My routing table looks like this:<br>
<br>Kernel IP routing table<br>Destination     Gateway         Genmask         Flags Metric Ref    Use Iface<br>10.22.1.9       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>10.22.1.8       10.22.0.252     255.255.255.255 UGH   20     0        0 eth0.402<br>
10.22.1.3       10.22.0.252     255.255.255.255 UGH   20     0        0 eth0.402<br>10.22.1.2       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>10.22.1.1       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>
10.22.1.7       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>10.22.1.6       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>10.22.1.5       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>
10.22.1.4       10.22.0.253     255.255.255.255 UGH   20     0        0 eth0.402<br>&lt;PUBLIC_IP&gt;  0.0.0.0         255.255.255.240 U     0      0        0 eth0.401<br>10.22.0.0       0.0.0.0         255.255.255.0   U     10     0        0 eth0.402<br>
10.22.1.0       10.22.0.252     255.255.255.0   UG    20     0        0 eth0.402<br>0.0.0.0         &lt;GW&gt;  0.0.0.0         UG    0      0        0 eth0.401<br><br>Host records are clients connected via L2TP to two routers and obtained using OSPF.<br>
Here&#39;s output of ifconfig. You can&#39;t see virtual IP address in here, which is normal.<br><br>eth0      Link encap:Ethernet  HWaddr 00:0C:29:XX:XX:XX  <br>          inet6 addr: fe80::20c:29ff:fexx:xxxx/64 Scope:Link<br>
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>          RX packets:4604777 errors:0 dropped:0 overruns:0 frame:0<br>          TX packets:5288576 errors:0 dropped:0 overruns:0 carrier:0<br>          collisions:0 txqueuelen:1000 <br>
          RX bytes:1215873667 (1.1 GiB)  TX bytes:1185601384 (1.1 GiB)<br><br>eth0.401  Link encap:Ethernet  HWaddr 00:0C:29:XX:XX:XX  <br>          inet addr:&lt;PUBLIC_IP&gt;  Bcast:&lt;BROADCAST&gt;  Mask:255.255.255.240<br>
          inet6 addr: fe80::20c:29ff:fexx:xxxx/64 Scope:Link<br>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>          RX packets:330 errors:0 dropped:0 overruns:0 frame:0<br>          TX packets:158 errors:0 dropped:0 overruns:0 carrier:0<br>
          collisions:0 txqueuelen:0 <br>          RX bytes:156900 (153.2 KiB)  TX bytes:32267 (31.5 KiB)<br><br>eth0.402  Link encap:Ethernet  HWaddr 00:0C:29:XX:XX:XX  <br>          inet addr:10.22.0.1  Bcast:10.22.0.255  Mask:255.255.255.0<br>
          inet6 addr: fe80::20c:29ff:fexx:xxxx/64 Scope:Link<br>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>          RX packets:79734 errors:0 dropped:0 overruns:0 frame:0<br>          TX packets:125343 errors:0 dropped:0 overruns:0 carrier:0<br>
          collisions:0 txqueuelen:0 <br>          RX bytes:12664805 (12.0 MiB)  TX bytes:20989003 (20.0 MiB)<br><br>lo        Link encap:Local Loopback  <br>          inet addr:127.0.0.1  Mask:255.0.0.0<br>          inet6 addr: ::1/128 Scope:Host<br>
          UP LOOPBACK RUNNING  MTU:16436  Metric:1<br>          RX packets:1372428 errors:0 dropped:0 overruns:0 frame:0<br>          TX packets:1372428 errors:0 dropped:0 overruns:0 carrier:0<br>          collisions:0 txqueuelen:0 <br>
          RX bytes:457852457 (436.6 MiB)  TX bytes:457852457 (436.6 MiB)<br><br>And here&#39;s an output of &quot;ip addr ls&quot; command, where you can find that virtual IP:<br>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN <br>
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00<br>    inet <a href="http://127.0.0.1/8">127.0.0.1/8</a> scope host lo<br>    inet6 ::1/128 scope host <br>       valid_lft forever preferred_lft forever<br>2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP qlen 1000<br>
    link/ether 00:0c:29:xx:xx:xx brd ff:ff:ff:ff:ff:ff<br>    inet6 fe80::20c:29ff:fexx:xxxx/64 scope link <br>       valid_lft forever preferred_lft forever<br>4: gre0: &lt;NOARP&gt; mtu 1476 qdisc noop state DOWN <br>    link/gre 0.0.0.0 brd 0.0.0.0<br>
11: sit0: &lt;NOARP&gt; mtu 1480 qdisc noop state DOWN <br>    link/sit 0.0.0.0 brd 0.0.0.0<br>12: eth0.402@eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP <br>    link/ether 00:0c:29:xx:xx:xx brd ff:ff:ff:ff:ff:ff<br>
    inet <a href="http://10.22.0.1/24">10.22.0.1/24</a> brd 10.225.0.255 scope global eth0.402<br>    inet <a href="http://10.22.0.254/24">10.22.0.254/24</a> scope global secondary eth0.402<br>    inet6 fe80::20c:29ff:fexx:xxxxx/64 scope link <br>
       valid_lft forever preferred_lft forever<br>13: eth0.401@eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UP <br>    link/ether 00:0c:29:08:b1:1d brd ff:ff:ff:ff:ff:ff<br>    inet &lt;PUBLIC_IP&gt;/28 brd &lt;BRDCST&gt; scope global eth0.401<br>
    inet6 fe80::20c:29ff:fexx:xxxx/64 scope link <br>       valid_lft forever preferred_lft forever<br><br>Any ideas how to make mhomed to work properly or any easy method to check if client connected from LAN or the Internet to use force_send_socket()?<br>
<br>Thanks and best regards,<br>Yuri Kirsanov.<br>