Koozali.org: home of the SME Server

SAIL - S2S Sibling with dynamic IP adresses

Offline hervep

  • ***
  • 70
  • +0/-0
SAIL - S2S Sibling with dynamic IP adresses
« on: February 14, 2007, 11:35:33 AM »
Hi all,

I have a S2S IAX2 trunk running between 2 systems using dynamic DNS.
Each time the address changes ( 36Hours - thanks to our provider ) the peering status shows 'UNREACHABLE'.
The only solution I could find untill now is to 'reload' asterisk, in such a way that a new DNS request is made.

To write some 'monitor process' that reloads asterisk in case of trunk 'UNREACHABLE' is not an issue, but it does not sounds great to me.

Any better idea/suggestion on how to solve this ?

Thanks,

Hervé

Offline Franco

  • *
  • 1,171
  • +0/-0
    • http://contribs.org
SAIL - S2S Sibling with dynamic IP adresses
« Reply #1 on: February 14, 2007, 05:54:59 PM »
Humm, I do run a dynamic IP but mine only expires if something goes wrong, otherwise it keeps the same IP for months.
Anyway since you know the time it's ocurring, how about setting up a cron job to reload every YY hours?
There's even a free contrib that makes it easy to set these cron jobs.

Thanks,

Offline SARK devs

  • *****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
SAIL - S2S Sibling with dynamic IP adresses
« Reply #2 on: February 14, 2007, 05:55:19 PM »
Hi Herve

The IP shouldn't change if you use a nailed-up connection.  At lease expirey/renewal you should just get the same IP.

Other than that, I think you may have to go to fixed IP.  Alternatively, there is a small patch you can apply (but you will have to recompile asterisk) to force IAX to do regular dns lookups (it should, in theory be in the release we are using).  You can find it here...

http://bugs.digium.com/view.php?id=6305


Best

J

Offline hervep

  • ***
  • 70
  • +0/-0
SAIL - S2S Sibling with dynamic IP adresses
« Reply #3 on: February 15, 2007, 10:35:41 AM »
Quote from: "stuntshell"
Humm, I do run a dynamic IP but mine only expires if something goes wrong, otherwise it keeps the same IP for months.
Anyway since you know the time it's ocurring, how about setting up a cron job to reload every YY hours?
There's even a free contrib that makes it easy to set these cron jobs.

Thanks,


Yep ... but the issue is that you never really knows when it occurs, certainly on the remote router. In the best case, 36 Hrs after the last change, everytime new ip when reboot or pppoe failure ... .
On top of that, I know from today that a 'reload' is not always enough ... .

Thanks for your reply :-).

Hervé

Offline hervep

  • ***
  • 70
  • +0/-0
SAIL - S2S Sibling with dynamic IP adresses
« Reply #4 on: February 15, 2007, 11:22:26 AM »
Quote from: "selintra"
Hi Herve

The IP shouldn't change if you use a nailed-up connection.  At lease expirey/renewal you should just get the same IP.


Unfortunately not ... everytime a new IP.

Quote from: "selintra"

Other than that, I think you may have to go to fixed IP.  Alternatively, there is a small patch you can apply (but you will have to recompile asterisk) to force IAX to do regular dns lookups (it should, in theory be in the release we are using).  You can find it here...

http://bugs.digium.com/view.php?id=6305


Best

J


Thanks to your post, I had the idea to check in more details arround asterisk engine. Everything I could find indicates a known issue, with a partial solution introduction based on the 'dnsmgr' concept.
As far as I could understand the point, seems to be solved in version 1.4, where the different channels are really looking for updates.

Strange ( with current 1.2.10 ) is that even if the good IP address is given as destination ... iax poke don't arrive at the remote end. As far as I could see now, Nat router may be part of the problem. Will look further to find out what the issue is.

Would be interresting to test with * version 1.4 . If you have a test version Sail/1.4 I would be interrested in it, otherwise I will make tests using another 'manually configured ' asterisk server.

Best is of course to have 'fixed IP', but I am curious and wants to understand what is happening. VPN is a bypass ( virtual fixed IP ... ) that works.

Best regards,

Hervé

Offline hervep

  • ***
  • 70
  • +0/-0
SAIL - S2S Sibling with dynamic IP adresses
« Reply #5 on: February 16, 2007, 08:55:21 AM »
Hi all,

For those who are interrested in the topic ...

- By enabling the dnsmgr into asterisk ( see dnsmgr.conf ), dns updates seems to come on due time, 'chan_iax2.so' is good updated.

- Nat router capabilities seems to be major concern. I have a router that supports 'consistent NAT' , no problem at my side. The other end uses another NAT router that looks to be 'too basic' and needs to be resseted when remote end IP changes. ( router still sending IAX Pokes to the 'old address' destination, even if the good ip is asked by 'chan_iax2.so'. ).

- Little script to be able to follow/test stability (/etc/cron.hourly) :

Code: [Select]
#!/bin/sh

#peermonitor.sh
#Due to Dynamic IP addressing, peers may be lost when IP changes locally of remotely.
#Goal of this script is to have a quick and dirty monitoring that restarts the pipe when needed.

#Peername to monitor
peername="the_peer_to_be_monitored"

#Let's check the current peering status
/usr/sbin/asterisk -rx 'iax2 show peer '$peername > peer_status
sleep 1

#Let's scan the peer_status. If 'Status & OK' can be found on the same line in the answer, it's OK !.

test="Status.*OK"
if grep -in $test peer_status > /dev/null
then
# Nothing to do since it is OK ... just info log.
echo `date` " -- Peer monitor check OK -- "  >> /var/log/asterisk/peermonitor
exit
fi
# Oops, it is not 'OK'.
# Reloading the PBX seems to help.
# Another solution is to restart PBX when no calls ...

/usr/sbin/asterisk -rx 'reload'
# /usr/sbin/asterisk -rx 'restart when convenient'

# Let's log the issue ( gives an idea of occurences, or send a warning mail ... or both ! )
# Logfile will appear in the asterisk journal 'peermonitor'

# echo "Peer monitor alert. Asterisk reloaded" | mail -s "Asterisk peermonitor event report" yourmail@youraddress.net
echo `date` " -- Peer monitor alert. Asterisk reloaded -- "  >> /var/log/asterisk/peermonitor


Best,

Hervé

Offline SARK devs

  • *****
  • 2,806
  • +1/-0
    • http://sarkpbx.com
SAIL - S2S Sibling with dynamic IP adresses
« Reply #6 on: February 16, 2007, 12:27:31 PM »
Nice workaround.  I have a customer with Dyndns who is asking for this so I'll give it a whirl.

Thanks Herve

Best

J

Offline hervep

  • ***
  • 70
  • +0/-0
SAIL - S2S Sibling with dynamic IP adresses
« Reply #7 on: February 17, 2007, 08:40:22 AM »
Update info ( from what I can see untill now ... )

- dnsmgr of asterisk does not work as it should within * 1.2.10 (current 'SAIL' version). Best seems to disable it. Looks like 'chan_iax2.so' doesn't 'read' dnsmgr cache info ... .

- If your NAT router is capable of detecting wrong ARP cache data and therefore modifying its NAT table, or if your system is 'server-gateway', the script 'reloading' asterisk works as expected. Reload forces DNS query, and the trunk(s) is (are) restarting.

Example log from a 'working' NAT router :

Quote
Feb 17 07:04:13 router Vigor: Arp address mismatch - Ethernet destination address doesn't match ARP target adress


Hope this can help ...

Best regards,

Hervé