T
T
trauus2018-11-21 11:20:10
Computer networks
trauus, 2018-11-21 11:20:10

How to change DNS in Mikrotik after raising the tunnel?

My ISP has PPTP Internet access with Round Robin DNS server balancing.
After raising the PPTP tunnel, I need to raise the L2TP tunnel to the VPN provider.
How can I make the ISP's DNS server used only to obtain the PPTP server address, and then other DNS servers are used?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Z
Ziptar, 2018-11-21
@Ziptar

It is possible to catch the l2tp connection with a script and register statics in the dns settings. But I'm not sure that statically registered servers have priority over dynamic ones for Mikrotik.
In this case, you can use the script to catch the rise of the l2tp connection and enable the rule to redirect requests to 53/UDP to 8.8.8.8, for example.
:if ([:len [/ppp active find name="l2tp connection name"]] > 0) do={
/ip firewall nat enable [find comment~"Redirect rule comment part"]
} else {
/ip firewall nat disable [find comment~"Comment part of the rule with a redirect"]
}
Well, create the redirect rule itself with the corresponding comment, and run the script every 10 seconds, suppose.
Something like this, but it's not accurate.

S
sanglyb, 2018-11-22
@sanglyb

I would do it through netwatch - put a check on the remote gateway, on up write commands like
/ip dns set servers=[the desired server when connected]
/ip dns cache flush
similarly to down.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question