1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

    Dismiss Notice
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

DDNS custom script

Discussion in 'Asuswrt-Merlin' started by cowst, Jan 1, 2018.

Tags:
  1. cowst

    cowst Senior Member

    Joined:
    Jun 14, 2012
    Messages:
    216
    Hi,
    My malfunctioning ISP modem just got replaced by their horrible connect box router.
    I think it doesn't work in bridge mode, so I have NAT behind NAT for my N66.
    So my asus ddns now gets the internal ip and the vpn server is not reachable anymore.

    Just to be sure I understood my options.
    I have to move from asus ddns to another (probably I will go for DuckDns).
    Create a custom script in ddns-start (I'll use the one provided in wiki) and replace the WAN ip with one fetched on the fly.
    Is this correct?
    Is the gui taking care that the custom script is being called periodically at ban-safe intervals? (as it was doing with the asus.com selection)

    Then I'll have to port forward the openvpn port in the crappy router.
    Change the vpn server address to the duckdns address in the clients.

    Any change in vpn server itself in the n66?
     
  2. martinr

    martinr Part of the Furniture

    Joined:
    Nov 27, 2014
    Messages:
    2,328
    Location:
    Manchester, United Kingdom
    I get the impression you’ve already done quite a bit of searching, but in case not, have you seen some of the posts on this topic? Here’s just one example https://www.snbforums.com/threads/double-nat-custom-ddns-script.34431/


    Which country are you in and what type of connection do you have to the house? Any chance you could replace the new ISP router with a plain modem?
     
    Last edited: Jan 1, 2018
  3. cowst

    cowst Senior Member

    Joined:
    Jun 14, 2012
    Messages:
    216
    Yes, I saw some solutions, but the procedure I posted is based on the one from Merlin's wiki, and if that is exactly the proper solution for my specific problem, I would prefer to stick to what the router FW recommends :)

    Germany, Unitymedia cable 120mbit.
    I needed over one year for them to come here and acknowledge what I said from the very beginning, that the modem was broken.
    They replaced it with new hw, and I don't really want to deal with them again if I can work around it.
     
  4. cowst

    cowst Senior Member

    Joined:
    Jun 14, 2012
    Messages:
    216
    I also wanted to know what "Forced refresh interval (in days)" does.
    Is that just a safeguard so a DNS association to a fixed IP won't expire?
    If that is the case, it implies that the script would not send an update in case there is no IP change, but that means that it takes the WAN IP into consideration (or a saved var), which is internal and static in my case, so I must be missing something here.
    Anyway having a custom script to update the DNS entry and then forcing a bogus WAN value after 21 days seems unlikely.

    @RMerlin could you clarify please?
     
  5. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    32,088
    Location:
    Canada
    The router will only update your DDNS registration if the WAN IP has changed. Some providers will deactivate accounts that don't get at least one update per month, hence that setting that will force an update every X days even if the IP hasn't changed to prevent account deactivation.
     
  6. cowst

    cowst Senior Member

    Joined:
    Jun 14, 2012
    Messages:
    216
    Ok, thanks, that is what I thought.

    But then, in the wiki there are examples for custom scripts to be used with double NAT (actually with duckdns I don't need to find the ip in advance), but normally in those situations the internal wan doesn't change.

    So isn't the ddns-start kinda useless here?
    I am afraid I have to use some startup script to add a cron job, right?

     
  7. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    32,088
    Location:
    Canada
    The watchdog should trigger even a custom script.
     
  8. cowst

    cowst Senior Member

    Joined:
    Jun 14, 2012
    Messages:
    216
    Is the watchdog able to recognize the change of public ip?
    Because the asus wan stays always on 192.168.0.10 in my case.
     
  9. RMerlin

    RMerlin Super Moderator

    Joined:
    Apr 14, 2012
    Messages:
    32,088
    Location:
    Canada
    Sorry, I misunderstood your original query. You will indeed be responsible for checking yourself for any IP change when in a dual NAT situation. That means setting up a cron job to periodically check it, and if it changed then trigger your ddns script.
     
    cowst likes this.
  10. charlie2alpha

    charlie2alpha Senior Member

    Joined:
    Nov 15, 2014
    Messages:
    442
    Location:
    Germany
    If the WAN IP doesn't change the script won't be triggered until the specified refresh time. In your case you probably will have to create a cru job that runs the DDNS update every 5 mins or so, assuming your DDNS provider allows it, otherwise you'll have to heavily script it to check for external IP changes first.
     
  11. cowst

    cowst Senior Member

    Joined:
    Jun 14, 2012
    Messages:
    216
    Yes, thanks everybody, I just need to figure out how to use in RAM variables and I should be fine.
    Perhaps the link on first response had an example of that.