Re: [asterisk-users] Binding asterisk to two static IPs
On 10/12/11 2:27 PM, ge...@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@officegeneral.com Systems Engineer, OfficeWyze, Inc. Ph: +1 415 439 4988 Fax: +1 415 283 3370 http://pgpkeys.mit.edu:11371/pks/lookup?op=getsearch=0xD6506D20 -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
ge...@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 -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
On 10/12/2011 06:15 PM, ge...@riseup.net wrote: 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. If your networking equipment supports VLAN, you could add a virtual lan to the existing ethernet device. vconfig add eth0 42 Then assign an address to eth0.42. You can use eth0 for your endpoints and eth0.42 for your provider or whichever way you want it. You do then, of course, need to turn trunking onto the switch port that is connected to eth0 and enable VLAN 1 and 42. You will need to make it permanent via system config scripts. For RedHat based distros, this includes /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0.42 files. I have never tried this with your exact situation, but it works well for me in other projects. Dale -- The truth speaks for itself. I'm just the messenger. Lyta Alexander - Babylon 5 -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
Hi Dale, Wow, thanks for the tip. I just start to change the network config, and see how it works. If your networking equipment supports VLAN, you could add a virtual lan to the existing ethernet device. Jeah, got a Cisco managed switch. Then assign an address to eth0.42. You can use eth0 for your endpoints and eth0.42 for your provider or whichever way you want it. Don't you think the problem will still occur that the answers from asterisk seem to come from the main address assigned to the NIC? Or isn't this possible because of the vlan? Thanks, Georg -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
Don't you think the problem will still occur that the answers from asterisk seem to come from the main address assigned to the NIC? Or isn't this possible because of the vlan? Thanks, Georg It should work. As far as the OS and routing tables are concerned, eth0 and eth0.42 are different network devices on different subnets. If the 2 nic solution would work for your problem, then this should work just as well. By creating the VLAN, you are effectively working with a 3 nic solution. Dale -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
If your networking equipment supports VLAN, you could add a virtual lan to the existing ethernet device. vconfig add eth0 42 Then assign an address to eth0.42. You can use eth0 for your endpoints and eth0.42 for your provider or whichever way you want it. You do then, of course, need to turn trunking onto the switch port that is connected to eth0 and enable VLAN 1 and 42. You will need to make it permanent via system config scripts. For RedHat based distros, this includes /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0.42 files. I have never tried this with your exact situation, but it works well for me in other projects. Just tested this, doesn't work. Asterisk ist still replying using the main-address associated to the NIC. :/ Georg -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
On 10/13/2011 10:53 AM, ge...@riseup.net wrote: Just tested this, doesn't work. Asterisk ist still replying using the main-address associated to the NIC. In a previous posting, Jim Lucas proposed... --- snip --- 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 --- snip --- This has two different subnets for eth0 and eth1. Do you have different IP subnets for eth0 and eth0.42? If you do, I do not know the reason for the problem. Perhaps you could post the output of: /sbin/ifconfig -a /bin/netstat -rn -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
When you set bindaddr=0.0.0.0 Asterisk will not bind to any specific IP and the OS will choose the source IP of the packet.Let me repeat this: THE OS PICKS THE SOURCE IP. If your OS routing tables are correct, then the packets will be sourced from the correct IP. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Dale Noll Sent: Thursday, October 13, 2011 12:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Binding asterisk to two static IPs On 10/13/2011 10:53 AM, ge...@riseup.net wrote: Just tested this, doesn't work. Asterisk ist still replying using the main-address associated to the NIC. In a previous posting, Jim Lucas proposed... --- snip --- 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 --- snip --- This has two different subnets for eth0 and eth1. Do you have different IP subnets for eth0 and eth0.42? If you do, I do not know the reason for the problem. Perhaps you could post the output of: /sbin/ifconfig -a /bin/netstat -rn -- _ -- 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 -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
This has two different subnets for eth0 and eth1. Do you have different IP subnets for eth0 and eth0.42? If you do, I do not know the reason for the problem. Ah, sorry, overlooked this. I will give it another try with different subnets. Thanks, Georg -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
On 12.10.2011 23:27, ge...@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). -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
Hallo, On 12.10.2011 23:27, ge...@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). If I use the floating internal ip, I can't reach my provider anymore. Thought this was clear. So: This is actually the problem... :) Thanks, Georg -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
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: ge...@riseup.net To: asterisk-users@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 -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
On 13.10.2011 00:27, ge...@riseup.net wrote: If I use the floating internal ip, I can't reach my provider anymore. Thought this was clear. After reading your original message, this is clear, yes. Sorry for being sloppy. -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
After reading your original message, this is clear, yes. Sorry for being sloppy. np ;) Anyone else? Would be really really great... Thanks, Georg -- _ -- 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
Re: [asterisk-users] Binding asterisk to two static IPs
On 10/12/2011 3:55 PM, ge...@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 -- _ -- 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
Re: [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 -- _ -- 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