[OpenSIPS-Users] OpenSIPS 1.6.4 & Keepalived
Yuri Kirsanov
y.kirsanov at gmail.com
Thu Aug 11 06:18:54 CEST 2011
Hello community,
I have two servers with keepalived running and keepalived is running VRRP
protocol to have redundancy. I'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'd like OpenSIPS to be able to accept SIP requests from both internal LAN &
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 & 10.22.0.4. All
works fine when clients connect from LAN and mhomed=0 is set in
configuration file.
But I've run into a problem that when I enable mhomed=1 system is unable to
find outgoing socket. I'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:
Aug 10 10:49:14 localhost /opt/opensips/sbin/opensips[
21748]: ERROR:core:get_out_socket: no socket found
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)
Aug 10 10:49:14 localhost /opt/opensips/sbin/opensips[21748]:
ERROR:tm:t_forward_nonack: failure to add branches
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 & from the
Internet. I'm using just simple load_balance() function to route calls to
Asterisk servers, drouting module not used.
I haven't tested it yet, but I think it will be unable to find appropriate
outgoing interface to send packets from. And I really don'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:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
10.22.1.9 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.8 10.22.0.252 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.3 10.22.0.252 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.2 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.1 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.7 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.6 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.5 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
10.22.1.4 10.22.0.253 255.255.255.255 UGH 20 0 0
eth0.402
<PUBLIC_IP> 0.0.0.0 255.255.255.240 U 0 0 0
eth0.401
10.22.0.0 0.0.0.0 255.255.255.0 U 10 0 0
eth0.402
10.22.1.0 10.22.0.252 255.255.255.0 UG 20 0 0
eth0.402
0.0.0.0 <GW> 0.0.0.0 UG 0 0 0 eth0.401
Host records are clients connected via L2TP to two routers and obtained
using OSPF.
Here's output of ifconfig. You can't see virtual IP address in here, which
is normal.
eth0 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX
inet6 addr: fe80::20c:29ff:fexx:xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4604777 errors:0 dropped:0 overruns:0 frame:0
TX packets:5288576 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1215873667 (1.1 GiB) TX bytes:1185601384 (1.1 GiB)
eth0.401 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX
inet addr:<PUBLIC_IP> Bcast:<BROADCAST> Mask:255.255.255.240
inet6 addr: fe80::20c:29ff:fexx:xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:330 errors:0 dropped:0 overruns:0 frame:0
TX packets:158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:156900 (153.2 KiB) TX bytes:32267 (31.5 KiB)
eth0.402 Link encap:Ethernet HWaddr 00:0C:29:XX:XX:XX
inet addr:10.22.0.1 Bcast:10.22.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fexx:xxxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:79734 errors:0 dropped:0 overruns:0 frame:0
TX packets:125343 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:12664805 (12.0 MiB) TX bytes:20989003 (20.0 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1372428 errors:0 dropped:0 overruns:0 frame:0
TX packets:1372428 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:457852457 (436.6 MiB) TX bytes:457852457 (436.6 MiB)
And here's an output of "ip addr ls" command, where you can find that
virtual IP:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP qlen 1000
link/ether 00:0c:29:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet6 fe80::20c:29ff:fexx:xxxx/64 scope link
valid_lft forever preferred_lft forever
4: gre0: <NOARP> mtu 1476 qdisc noop state DOWN
link/gre 0.0.0.0 brd 0.0.0.0
11: sit0: <NOARP> mtu 1480 qdisc noop state DOWN
link/sit 0.0.0.0 brd 0.0.0.0
12: eth0.402 at eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP
link/ether 00:0c:29:xx:xx:xx brd ff:ff:ff:ff:ff:ff
inet 10.22.0.1/24 brd 10.225.0.255 scope global eth0.402
inet 10.22.0.254/24 scope global secondary eth0.402
inet6 fe80::20c:29ff:fexx:xxxxx/64 scope link
valid_lft forever preferred_lft forever
13: eth0.401 at eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue
state UP
link/ether 00:0c:29:08:b1:1d brd ff:ff:ff:ff:ff:ff
inet <PUBLIC_IP>/28 brd <BRDCST> scope global eth0.401
inet6 fe80::20c:29ff:fexx:xxxx/64 scope link
valid_lft forever preferred_lft forever
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()?
Thanks and best regards,
Yuri Kirsanov.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110811/d3fa0003/attachment-0001.htm>
More information about the Users
mailing list