If my internet is down my PBX is down...

Discussion in 'General' started by victorcasale, Jul 10, 2009.

  1. victorcasale

    Joined:
    May 7, 2009
    Messages:
    46
    Likes Received:
    0
    Dear Friends, I'm so lost... If my internet is down, my elastix stop working.. All internal extentions can't connect to elastix. I was reading in some posts about the need to install bind... Is it really necessary?

    Any other method?

    I Already tryed insertin srvlookup=no inside sip_custom.conf but nothing happened


    Since now thank you all
     
  2. ramoncio

    Joined:
    May 12, 2010
    Messages:
    1,663
    Likes Received:
    0
    There is a post somewhere here explaining how to setup a dns server/cache in your elastix box to avoid this problem.
     
  3. Megabyte

    Joined:
    Mar 28, 2009
    Messages:
    327
    Likes Received:
    0
    I will write two way you can take one:

    method 1:

    Create 2 boxes. Link both boxes using IAX. Make one of the boxs handles all your SIP
    trunks (Box A). Make the other box (Box B) handles all your PSTN trunk and make sure
    you comment out externhost from sip_general_custom.conf or sip_nat.conf in Box B.
    Attach all your extensions to to box B
    Direct all incoming SIP calls from Box A to Box B.
    Direct all outgoing SIP calls from Box B to Box A.
    Naturally you must create all the appropriate dial plans and routes to handles your
    requirements in each of the boxes.
    If for any reason internet is down, it will only effect Box A while Box B, where all your
    extensions and PSTN trunks are will be spared. Of course if your router dies then all will
    be dead.
    Considering a basic box with 1GB RAM.

    method 2:

    Installing DNSMASQ



    Either at the console or via SSH (Putty), after login type the following command



    yum install dnsmasq



    Wait for this to complete and show no errors



    Now using your favourite editor in Linux (I use Nano) edit the following file



    /etc/dnsmasq.conf



    In dnsmasq.conf, you will find a line similar to the following diagram



    dnsmasqconf1.png



    Add this on the next line



    server=172.22.22.5 ( naturally replace this with your router or ISP DNS Server)



    So it now looks like the following diagram



    dnsmasqconf2.png





    Now access the System/Network Tab in Elastix and make the following changes



    elastixdnssetup.png





    1. The host remains as it is
    2. The Gateway remains as it is
    3. The primary DNS changes to 127.0.0.1 which is the local machine (Elastix Server).
    4. The secondary DNS is clear



    The reason for the secondary DNS to be empty is that if you add an address of your router or ISP in here, it will hang again, which is not what we want it to do. It checks DNSMASQ for a DNS address, doesn't get one, and falls straight through which is what we want.



    REBOOT YOUR ELASTIX BOX (this is necessary).
     
  4. johnme

    Joined:
    Nov 28, 2008
    Messages:
    148
    Likes Received:
    0
    Hi

    Dnsmasq do the job but there is something else.

    Elastix dies if cant find routers ip.

    If you shut down your router, or there is a problem with the router and you can't ping to his ip, then asterisk dies.

    So the problem with no internet is solved but there is one more step.

    Hope there is an answer...

    Hi again
    John
     
  5. johnme

    Joined:
    Nov 28, 2008
    Messages:
    148
    Likes Received:
    0
    Hi

    I found 3 diferent solutions.
    I will try them and if any of them worksi will let you know.

    These are the 3 solutions for you to try.

    1)
    =========================================

    1. I setup a SPA3000 as a SIP trunk with the trunk name
    01-whatever (this made sure that the trunk sat right at the
    beginning of sip_additional conf.

    2. Then in etc/resolv.conf I have the following
    192.168.1.1 (which is my routerip)
    127.0.0.1

    2)
    ============================================================

    This has bugged me for a long time and I think I may have
    solved it based on some suggestions above..

    I created a SIP extension - ie 19999 and then a trunk
    called SIPFAIL with the below:-

    PEER DETAILS
    username=SIP EXT
    type=peer
    secret=PASS
    qualify=yes
    host=IP ADDY OF * BOX

    USER DETAILS
    type=user
    secret=PASS
    context=from-trunk

    REG STRING
    SIPEXT:pASS@IP ADDY OF * BOX

    It all registered OK and when the router was powered down,
    all internal EXT worked fine - turned that TRUNK off and all internal EXT failed...

    3)
    ==========================================================

    srvlookup=yes

    in etc/asterisk/sip_custom.conf

    ==========================================================

    Hi again
    John
     
  6. johnme

    Joined:
    Nov 28, 2008
    Messages:
    148
    Likes Received:
    0
    Hi

    I am one step from the solution.

    Installing DNSMASQ

    Either at the console or via SSH (Putty), after login type the following command

    yum install dnsmasq

    Wait for this to complete and show no errors

    Now using your favourite editor in Linux (I use Nano) edit the following file

    /etc/dnsmasq.conf

    In dnsmasq.conf, you will find a line similar to the following diagram



    Add this on the next line

    server=172.22.22.5 ( naturally replace this with your router or ISP DNS Server)

    So it now looks like the following diagram




    Now access the System/Network Tab in Elastix and make the following changes




    1. The host remains as it is
    2. The Gateway remains as it is
    3. The primary DNS changes to 127.0.0.1 which is the local machine (Elastix Server).
    4. The secondary DNS is clear

    The reason for the secondary DNS to be empty is that if you add an address of your router or ISP in here, it will hang again, which is not what we want it to do. It checks DNSMASQ for a DNS address, doesn't get one, and falls straight through which is what we want.








    REBOOT YOUR ELASTIX BOX (this is necessary).

    Now before you get going, make sure that you can ping a domain name from the Linux command prompt. e.g. I used one I have used before and also a site I have not pinged before. If it resolves the name then it is working.
    =====================================================================
    Now my stuff

    After all that put in sip_general_custom.conf defaultexpirey=600 otherwise you will have problem with the registration of your external sip accounts.
    in etc/rc.d/rc.local at the end of the file put:
    /usr/sbin/amportal restart

    in etc/asterisk/sip_custom.conf put:

    srvlookup=no

    With this configuration even with my router power down elastix is still working.
    I did an amportal restart and still working.
    But when i did a reboot the elastix dies.

    So if we loose the router then we should not reboot elastix till we found the solution for the reboot.

    I'm waiting for it....

    Bye
    John
     
  7. telecomtechnician

    Joined:
    Jan 8, 2008
    Messages:
    422
    Likes Received:
    0
    hi there

    Can you be more specific in configuring the DNSMASQ? I cant find or see the diagram dnsmasqconf1.png

    Thank you

    David Medina
     
  8. johnme

    Joined:
    Nov 28, 2008
    Messages:
    148
    Likes Received:
    0
  9. telecomtechnician

    Joined:
    Jan 8, 2008
    Messages:
    422
    Likes Received:
    0
    Hi there

    Thanks for your link.

    I did the changes and it works fine, if there is no internet, elastix still works, but now I do not see my sip trunks. I erased them created all, and created from scratch and they do not appear in the CLI when I do sip show peers. I do a sip show peer XXXXXX (XXXXXX is the sip trunk) and it says it cannnot find it. It is like it does not exist.

    The sip trunks DO APPEAR in the FOP and freepbx and in the sip_additional.conf file.

    Definetely something changed in the .conf files after the installation and configuration of DNSmasq.

    I would appreciate your help

    David Medina
     

Share This Page