Community discussions

 
mko101
just joined
Topic Author
Posts: 11
Joined: Tue Nov 01, 2016 8:09 pm

VPN stops working when server IP changes

Fri Dec 23, 2016 7:03 am

VPN coming from a mikrotik server set up in my house keeps breaking every time the IP changes. DNS address that comes with the routerboard allows to go around my dynamic IP, however every time the IP changes, mikrotik needs a reboot for VPN to work again (applies to both PPTP and SSTP).

I can simply
1) Run a scheduler to reboot mikrotik every morning (IP changes frequently but not every day)
2) Run a script to reboot mikrotik every time IP changes

However, maybe there is a solution to why VPN stops working in the first place so I wouldn't have to reboot it so often. What could possibly cause it?
 
networkfudge
Trainer
Trainer
Posts: 130
Joined: Mon May 20, 2013 2:47 pm

Re: VPN stops working when server IP changes

Fri Dec 23, 2016 7:57 am

However, maybe there is a solution to why VPN stops working in the first place so I wouldn't have to reboot it so often. What could possibly cause it?
DNS is just a human-friendly alias. The real address is the ip address. The DNS name is resolved to an IP address and the VPN connection is established. If the IP address changes then of course the connection is disrupted.
MTCNA MTCWE MTCRE MTCINE MTCTCE UWBS UWBA
 
mko101
just joined
Topic Author
Posts: 11
Joined: Tue Nov 01, 2016 8:09 pm

Re: VPN stops working when server IP changes

Fri Dec 23, 2016 8:59 am

Yes, that's correct, the connection would be disrupted. But the DNS should then point to the new IP address and if IP changes, I should be able to still connect through the DNS. Why does it require a system reboot?
 
erlinden
Member Candidate
Member Candidate
Posts: 174
Joined: Wed Jun 12, 2013 1:59 pm

Re: VPN stops working when server IP changes

Fri Dec 23, 2016 10:35 am

Do you have something like a dynamic dns solution? How did you configure your VPN server (and why are you still uring PPTP)? Can you provide all information about your setup, like what is in front of the Mikrotik? Which version of RouterOS are you running? Any logs about this situation?
 
pe1chl
Forum Guru
Forum Guru
Posts: 5928
Joined: Mon Jun 08, 2015 12:09 pm

Re: VPN stops working when server IP changes

Fri Dec 23, 2016 11:47 am

Is your MikroTik router that is behind a changing IP address making connection with another VPN server that has a static address?
Or are you trying to setup a VPN from somewhere else into your MikroTik that is on a changing address?

The first thing should be no problem, as long as you have some dead-link detection on your VPN.
I use L2TP/IPsec in such an environment and the dead link is detected when the IP changes, a new connection is established
automatically. Of course this leads to a minute or so of unavailability of the VPN.
 
mko101
just joined
Topic Author
Posts: 11
Joined: Tue Nov 01, 2016 8:09 pm

Re: VPN stops working when server IP changes

Fri Dec 23, 2016 9:06 pm

Do you have something like a dynamic dns solution? How did you configure your VPN server (and why are you still uring PPTP)? Can you provide all information about your setup, like what is in front of the Mikrotik? Which version of RouterOS are you running? Any logs about this situation?
I do not have anything like a dyndns solution. I also don't use PPTP, I use SSTP and I can set up L2TP as well if that would be better, but all connections come from Windows computers and SSTP served me well so far.
The setup is ADSL modem/router combo which forwards ports and traffic to MikroTik. Mikrotik has a static internal IP set. The routerboard is RouterBoard 951G and runs on 6.37.3.
I will see if anything shows up in logs.
Is your MikroTik router that is behind a changing IP address making connection with another VPN server that has a static address?
Or are you trying to setup a VPN from somewhere else into your MikroTik that is on a changing address?

The first thing should be no problem, as long as you have some dead-link detection on your VPN.
I use L2TP/IPsec in such an environment and the dead link is detected when the IP changes, a new connection is established
automatically. Of course this leads to a minute or so of unavailability of the VPN.
The setup right now is client-to-site. It's Windows computers that are connecting with Mikrotik's VPNs, however updating the connection to site-to-site was my next step. The connecting devices don't have a static IP. I'm not sure that answers your question.
 
pe1chl
Forum Guru
Forum Guru
Posts: 5928
Joined: Mon Jun 08, 2015 12:09 pm

Re: VPN stops working when server IP changes

Sat Dec 24, 2016 12:41 am

When your "server" router has no static address, you need something like dyndns to make it known to your
clients where the router can be found. This also introduces some dead time as the DNS record will have a
(low) TTL that needs to expire first.

It is best when your "server" is on a static address, that avoids a lot of problems. But I know that is kind
of difficult in some countries. (not here, I have a static IPv4 address and IPv6 /48 network on my home VDSL)
 
majestic
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Mon Dec 05, 2016 11:19 am

Re: VPN stops working when server IP changes

Mon Dec 26, 2016 1:54 pm

I believe the OP is not referring that the connection drops because i'm sure he's aware that it would. What he's referring to is that he can't reconnect back to the VPN until he reboots the router.

Im sadly am not a mikrotik expert as I am just starting out with them so I can't give you the exact commands to fix but I do have a lot of linux based experience and I have seen this problem in the past with dynamic connections. What it is, is that the routes which gets adjusted when you connect to your VPN is not being deleted/removed when the connection drops/changes. This is causing in essence a stale session and as the connection is trying to use this "stale/bad route" it doesn't work. This route needs to be removed before the VPN will be able to reconnect and is why when you reboot the router, you then find that you can connect as the temp ones gets purged.

I am not sure how you resolve this with mikrotik but I am sure that as i've explained what is "likely" going on that someone will be able to answer with the commands you need to resolve this. Sadly all my connections are static these days so I can't test/figure it out for you.

The easiest way to see if this is whats going on is to get a print out of the routes when the connection is fine (check what your current/live IP is) and what it is again when the connection changes and it breaks. You should find that the old IP is still present in the table thus causing problems.

HTH
 
networkfudge
Trainer
Trainer
Posts: 130
Joined: Mon May 20, 2013 2:47 pm

Re: VPN stops working when server IP changes

Wed Dec 28, 2016 12:23 am

VPN coming from a mikrotik server set up in my house keeps breaking every time the IP changes. DNS address that comes with the routerboard allows to go around my dynamic IP, however every time the IP changes, mikrotik needs a reboot for VPN to work again (applies to both PPTP and SSTP).

I can simply
1) Run a scheduler to reboot mikrotik every morning (IP changes frequently but not every day)
2) Run a script to reboot mikrotik every time IP changes

However, maybe there is a solution to why VPN stops working in the first place so I wouldn't have to reboot it so often. What could possibly cause it?
As far as why it's dropping it could be many reasons, from a config issue to a modem or isp issue. Is your connection pppoe? Delivered over? Fiber, DSL, cable, wireless?

As far as the reconnection is involved you said you are using builtin /ip cloud ddns name? I'm not sure how it works and under what circumstances does it check for ip changes so it may update the mtik ddns server. Next time it happens rather than rebooting try to do some troubleshooting instead. Check what commands you have available, I think you can even force an update but never used it so not sure.
MTCNA MTCWE MTCRE MTCINE MTCTCE UWBS UWBA
 
mko101
just joined
Topic Author
Posts: 11
Joined: Tue Nov 01, 2016 8:09 pm

Re: VPN stops working when server IP changes

Tue Jan 03, 2017 7:47 pm

For now I used dynu DNS instead of mikrotik's DNS address, and configured a script to run and update IP every 15 minutes.

It would be nice to come up with a solution inside the mikrotik though, as networkfudge mentioned.
 
majestic
Frequent Visitor
Frequent Visitor
Posts: 81
Joined: Mon Dec 05, 2016 11:19 am

Re: VPN stops working when server IP changes

Wed Jan 04, 2017 10:58 am

For now I used dynu DNS instead of mikrotik's DNS address, and configured a script to run and update IP every 15 minutes.

It would be nice to come up with a solution inside the mikrotik though, as networkfudge mentioned.
Alternatively you may want to check this script posted by one of the users.

http://forum.mikrotik.com/viewtopic.php?t=84140

It monitors the connection for change in IP and updates the dynamic dns record when found. You can adapt it to support almost any DDNS provider.

HTH

Who is online

Users browsing this forum: Google [Bot] and 38 guests