Community discussions

MikroTik App
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Script for modify ipip tunnel interface

Sun Feb 18, 2018 9:26 pm

Hi! Im inew in this forum, and new in the Mikrotik world. I linked 2 homes with an ipip tunnel. Both homes have dynamic IPs, so I created the Local and remote Address with DDNS. The problem is when some of the homes reboot the router. The IP changes, and the field "local address" in ipip tunnel doesnt update. I would like create a script for each Hour update the local and remote address fields in the ipip tunnel interface. Do you have a script for that?

Sorry for my english, I know is bad. Thank you.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Script for modify ipip tunnel interface

Sun Feb 18, 2018 11:57 pm

Do you need any script at all? Remote address accepts hostname (I'm not sure since which RouterOS version), and local address is optional and should use current WAN address automatically.
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Re: Script for modify ipip tunnel interface

Tue Feb 20, 2018 1:10 am

Thanks for your answer Sob. Both in remote address and in local address I use ddns. The problem is that in the remote address the ddns remains permanently, but not in the local direction. When I put in the local address the address of ddns automatically translates it to the IP of the WAN. When I restart one of the routers the local address stays with the old IP and is not updated.

How can indicate that the IP of the wan be localized at any time? Both routers have Ros 6.41.2
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Script for modify ipip tunnel interface

Tue Feb 20, 2018 6:23 am

As I wrote, "Local Address" field is optional. So try to not enter anything there and you have good chance that it will work.
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Re: Script for modify ipip tunnel interface

Tue Feb 20, 2018 9:13 am

Hi! The problem is that I use IPsec for this interface, so when I put the Local address field emtpy this message it show: Couldnt change Interface <tunnel1> - both local and remote addrs must be set for ipsec to work (6)
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Script for modify ipip tunnel interface

Tue Feb 20, 2018 2:49 pm

It sounds like you might need a script. :) I'm not scripting guy, but bare-bones version is:
/interface ipip set local-address=[:resolve your.local.hostname] <ipip interface name>
Put it in scheduler and it works. I'm not sure if it would benefit from some error checking, or not setting the address when it didn't change. Start with this and watch if anything happens with IPSec when the script runs (when address didn't change).
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Re: Script for modify ipip tunnel interface

Tue Feb 20, 2018 6:08 pm

Thank you for your help Sob. I will wait for someone that could help me with a script :)

Regards
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Script for modify ipip tunnel interface

Wed Feb 21, 2018 1:08 am

If it wasn't clear, what I posted works, so feel free to try it like this. Put it in scheduler, set the interval and enjoy. I didn't try the whole thing with IPSec, but it will probably work fine too. The local address of tunnel changes correctly, and the only risk would be if RouterOS would see even setting the same address as change and reinitialized IPsec, but there's good chance that it won't.
 
jkarras
Member Candidate
Member Candidate
Posts: 226
Joined: Fri Sep 06, 2013 3:07 am
Location: Utah, USA

Re: Script for modify ipip tunnel interface

Sun Feb 25, 2018 4:31 am

No need to run this as a script. The DHCP client will provide the information on lease update.

https://wiki.mikrotik.com/wiki/Manual:I ... pt_example
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Re: Script for modify ipip tunnel interface

Sun Feb 25, 2018 11:30 pm

Hi,

my connection is over pppoe, not dhcp client. In spite of that, it would be useful for me? Sorry for my english
 
jkarras
Member Candidate
Member Candidate
Posts: 226
Joined: Fri Sep 06, 2013 3:07 am
Location: Utah, USA

Re: Script for modify ipip tunnel interface

Mon Feb 26, 2018 1:02 am

Hi,

my connection is over pppoe, not dhcp client. In spite of that, it would be useful for me? Sorry for my english
You'll have to use a scheduled script then. An example can be seen here.

https://github.com/karrots/ros-ddns-ipsec/
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Re: Script for modify ipip tunnel interface

Tue Feb 27, 2018 9:15 am

Thank you jkarras. I finally found a script for ipip tunnel in Github and it works!

https://github.com/Lillecarl/ROS_Script ... eb7d273f34

Greetings to all for your help.

Who is online

Users browsing this forum: CHUPAPEE and 36 guests