georg at riseup.net
2011-Oct-12 21:27 UTC
[asterisk-users] Binding asterisk to two static IPs
He all, I've got a similar setup like [1], and the same issues thats described there. However, there was never a reply to this thread. I'm using a HA-cluster to run asterisk, on two servers, with two virtual ips. One for the phones to register, the other one from a different net to send and receive calls trough my provider. This is aswell a private net, without nat.
On 12.10.2011 23:27, georg at riseup.net wrote:> "If you put 0.0.0.0, it will bind to all addresses. In a HA Cluster, on > the active node, if you have a box address of 192.168.1.101 and a floating > address of 192.168.1.102, then if you use > > bindaddr=0.0.0.0...> Any idea how to solve this?Yes: Use "bindaddr=192.168.1.102". That's how we solved it on our Asterisk boxes. Another solution would be to use tcp, but not all SIP clients support that (and I don't know how good Asterisk does). Personally, I think this is a shortcoming in Asterisk. Every application with udp server functionality should handle this correctly. E.g. FreeRADIUS has a compile time option for this (--with-udpfromto, unfortunately off by default, for whatever reasons).
i had a similar challenge having Asterisk listen to multiple ports.. "some of my agents located in countries where SIP is blocked" the only effective way is to use IPTABLES i believe your problem can be solved with the same method. Tarek Sawah Information Technology Adviser Integrated Digital Systems CCNP, MCSE, RHCE, TELECOM USA: +1 386 492 9993> Date: Wed, 12 Oct 2011 23:27:16 +0200 > From: georg at riseup.net > To: asterisk-users at lists.digium.com > Subject: [asterisk-users] Binding asterisk to two static IPs > > He all, > > I've got a similar setup like [1], and the same issues thats described > there. However, there was never a reply to this thread. > > I'm using a HA-cluster to run asterisk, on two servers, with two virtual > ips. One for the phones to register, the other one from a different net to > send and receive calls trough my provider. This is aswell a private net, > without nat. > > From [1]: > > "If you put 0.0.0.0, it will bind to all addresses. In a HA Cluster, on > the active node, if you have a box address of 192.168.1.101 and a floating > address of 192.168.1.102, then if you use > > bindaddr=0.0.0.0 > > you will find that phones on the 192.168.1.x subnet will not register on > the floating address, which of course defeats the point of HA clustering. > What happens is that the registration packets go to the floating address > 192.168.1.102 but the response packets appear to come from 192.168.1.101 > [same NIC but the packet contains the base address attached to the NIC], > so the registration fails." > > Any idea how to solve this? > > Thanks, > Georg > > [1] > http://www.fonality.com/trixbox/forums/trixbox-forums/help/binding-sip-multiple-not-all-ip-addresses > > > -- > _____________________________________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > New to Asterisk? Join us for a live introductory webinar every Thurs: > http://www.asterisk.org/hello > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111012/0d54f2c9/attachment.htm>
On 10/12/2011 3:55 PM, georg at riseup.net wrote:>> After reading your original message, this is clear, yes. Sorry for being >> sloppy. > > np ;) > > Anyone else? > Would be really really great... >I solved it by having two physical connections to my network. PBX E0 IP 192.168.100.36 NM 255.255.255.0 GW 192.168.100.1 E1 IP 192.168.101.254 NM 255.255.255.0 GW n/a All the phones reside withing the 192.168.101.0/24 network. I still have bindaddr=0.0.0.0 so I can talk to my provider and my phones. But on two different interfaces. That forces the communication to always come from the correct source IP addr. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/ C - (541) 408-5189 O - (541) 323-9113 H - (541) 323-4219
georg at riseup.net
2011-Oct-12 23:15 UTC
[asterisk-users] Binding asterisk to two static IPs
> I solved it by having two physical connections to my network.Yes, I thought of this too. I used the second nic for the drbd-communication, but I think I will have to change this. Thanks, Georg
georg at riseup.net writes:> Any idea how to solve this?You can control src address selection with with ip route command. E.g. if you know that you want to reach 192.168.0.0/24 with a source address 192.168.0.50, you can do: ip route change 192.168.0.0/24 src 192.168.0.50 scope link dev eth0 (You need to change the IP addresses and device name of course) This may enable you to use bindaddr=0.0.0.0 /Benny
On 10/12/11 2:27 PM, georg at riseup.net wrote:> > "If you put 0.0.0.0, it will bind to all addresses. In a HA Cluster, on > the active node, if you have a box address of 192.168.1.101 and a floating > address of 192.168.1.102, then if you use > > bindaddr=0.0.0.0 > > you will find that phones on the 192.168.1.x subnet will not register on > the floating address, which of course defeats the point of HA clustering. > What happens is that the registration packets go to the floating address > 192.168.1.102 but the response packets appear to come from 192.168.1.101 > [same NIC but the packet contains the base address attached to the NIC], > so the registration fails." > > Any idea how to solve this?try use 2 different subnet addresses instead of both addresses on the same subnet. e.g. 192.168.1.101/24 & 192.168.2.101/24 and also use "ip" command to add the address to the interface instead of "ifconfig" and eth0:x notation. that way the OS will pick the correct address when responding to in coming packets. the problem is when you assign 2 addresses to the same interface on the same subnet, one of them will be primary and the other will becomes secondary on that subnet. the OS will always pick the primary address when sending out packets on that subnet. -- Edwin Lam <edwin.lam at officegeneral.com> Systems Engineer, OfficeWyze, Inc. Ph: +1 415 439 4988 Fax: +1 415 283 3370 http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0xD6506D20