Community discussions

MikroTik App
 
clarkstyx
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Sun Jun 28, 2009 7:26 pm

best vpn to use using dynamic dns

Tue Sep 22, 2009 2:28 pm

guys,can anyone tell me which among the types of vpn will work best with dynamic dns or can be used to setup dynamic to dynamic vpn, thank you
 
duvi
Frequent Visitor
Frequent Visitor
Posts: 70
Joined: Fri Jun 05, 2009 12:32 pm
Contact:

Re: best vpn to use using dynamic dns

Tue Sep 22, 2009 3:26 pm

I don't think it matters which vpn you want to use with a dynamic dns. You just need a script, that regularly checks if the remote dynamic ip has changed, and then edits the config.
If you want, I can post my script for openvpn.
 
clarkstyx
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 69
Joined: Sun Jun 28, 2009 7:26 pm

Re: best vpn to use using dynamic dns

Tue Sep 22, 2009 7:29 pm

I don't think it matters which vpn you want to use with a dynamic dns. You just need a script, that regularly checks if the remote dynamic ip has changed, and then edits the config.
If you want, I can post my script for openvpn.
sure can you post it please? right now im using change-ip as my dynamic dns provider and im also using a scheduler on that script, so i guess what i need right now is a script that will reconfigure the vpn configuration when the remote ip is changed.
 
duvi
Frequent Visitor
Frequent Visitor
Posts: 70
Joined: Fri Jun 05, 2009 12:32 pm
Contact:

Re: best vpn to use using dynamic dns

Wed Sep 23, 2009 7:23 pm

The script was rewritten from the original changeip script.
# Define User Variables
:global ovpnhost "Put remote ovpn server DNS hostname here"
:global ovpnif "Put local ovpn client interface name here"

# Define Global Variables
:global ovpnip
:global ovpnlastip
:if ([ :typeof $ovpnlastip ] = nil ) do={ :global ovpnlastip "0" }

# Grab the current IP address of server.
:global ovpnip [:resolve $ovpnhost]
:global ovpnlastip [ /interface ovpn-client get $ovpnif connect-to ]

# Did we get an IP address to compare?
:if ([ :typeof $ovpnip ] = nil ) do={
   :log info ("OVPN: Cannot resolve " . $ovpnhost . ", please check.")
} else={

  :if ($ovpnip != $ovpnlastip) do={

    :log info ("OVPN: Updating " . $ovpnif . " IP address from " . $ovpnlastip . " to " . $ovpnip )
    /interface ovpn-client disable $ovpnif
    :delay 2
    /interface ovpn-client set $ovpnif connect-to=$ovpnip
    :delay 2
    /interface ovpn-client enable $ovpnif

  } else={ 
   :log info "OVPN: No update required."
  }

}

# End of script

 
User avatar
hilton
Long time Member
Long time Member
Posts: 635
Joined: Thu Sep 07, 2006 5:12 pm
Location: Jozi (aka Johannesburg), South Africa

Re: best vpn to use using dynamic dns

Sat Sep 26, 2009 9:49 pm

so i guess what i need right now is a script that will reconfigure the vpn configuration when the remote ip is changed.
:global "vpn-interface-name" "pptp-vpn"
:global "vpn-dns-name" "remotevpn.yourdomain.com"
:global "new-vpn-ip" [:resolve $"vpn-dns-name"]
:global "current-vpn-ip" [/interface pptp-client get $"vpn-interface-name" connect-to]
:if ($"current-vpn-ip" != $"new-vpn-ip") do={ /interface pptp-client set [find name=$"vpn-interface-name"] connect-to=$"new-vpn-ip"}
This should get you going.
Regards
Hilton
 
mh348
just joined
Posts: 2
Joined: Sat Oct 22, 2011 1:37 am

Re: best vpn to use using dynamic dns

Thu May 24, 2012 5:19 pm

so i guess what i need right now is a script that will reconfigure the vpn configuration when the remote ip is changed.
:global "vpn-interface-name" "pptp-vpn"
:global "vpn-dns-name" "remotevpn.yourdomain.com"
:global "new-vpn-ip" [:resolve $"vpn-dns-name"]
:global "current-vpn-ip" [/interface pptp-client get $"vpn-interface-name" connect-to]
:if ($"current-vpn-ip" != $"new-vpn-ip") do={ /interface pptp-client set [find name=$"vpn-interface-name"] connect-to=$"new-vpn-ip"}
This should get you going.
Hi

How do I use this with a Open Vpn setup ?

Looking at the last two lines I guess I have to change the interface type so that it will "read" the ovpn interface that I specify in line one... I tried both "ovpn-out" and "ovpn-client", but it doesnt seem to work.

Who is online

Users browsing this forum: Bing [Bot] and 32 guests