hi, guys thanks for time and help i have a issue
i have a vpn site to site using two mikrotik routers but it has been impossible for me to be able to work from one of the offices connected to a sql server at the other end of the vpn, everything works except this service I have port 1433 open I connect to the server but when I execute a query it stays running query verifying with wire shark I get many TCP Retransmission
when i try to run one simple query i get this error on wire shark:
I’m guess ping is disabled on the SQL Server so PMTUD isn’t working. Basically on Windows Server you want to make sure PMTUD discovery is enabled/working (e.g. which is allowing ping). There is a registry you’d want to make sure was enabled: “EnablePMTUDiscovery=1”. Allowing ping in the windows firewall might also fix PMTUD discovery, and thus fix MTU issues and the TCP retransmissions you see. Been a while since used Windows Server, but basically you want to make sure PMTUD discovery is allowed on your SQL Server (maybe google help here since WS2XXX versions might be different, IDK).
As an alternative, you can try a mangle rule to change the TCP MSS size on the Mikrotik side as an alternative (e.g. tell TCP to use smaller packets). Replace XXXX with the site-to-site VPN interface name (or do FW filter match by IP, address-list, or whatever you’d like instead, as long as it’s traffic going over the VPN)…
Amm0’s point is that a VPN eats into the MTU limit. You have to deal with that somehow, either by clamping it statically or letting the auto-configuration signals through. He showed both options.
FWIW… I’m not sure how the TCP MSS mangle rule works with IPSec – so that may or may NOT be right, never test IPSec w/ adjust-mss mangle.
Why I suggest doing this “by hand” and using ping at both side to calculate the MTU – so can sort out if it’s even a MTU problem. Although the “everything works but one box” with TCP retrans points at MTU issue.
@Amm0 that is a good point and who is answering on the other side, the server/client or the router. When the router answers then on behalve then the VPN connection is
not used.
@all
Run the MTU adjuster on the returning traffic and check that the ICMP can also reach the client on the inside.
Hmm… That’s ODD that the MTU is different between the two side. And even more curious it’s off by 4 bytes too. e.g. Is WAN interface’s config MTU off by 4 bytes on one side as that about the only explanation that make sense… If you had an idea why they be different, that be helpful…
But…I think your math is wrong in the the set-mss= is now part of the problem. See MTU is NOT the same as TCP MSS – so you can’t take the value from ping and use that directly in the set-mss=. And what ping with DF tells you is the max ICMP packet size – & TCP packets are bigger by 12 bytes than ICMP packets.
Anyway, we need to take lowest of your ping tests to do the math… so 1389 is the result from ping with DF set. The MTU then is 1389 + 20 (IP header) + 8 (ICMP header) = 1417 MTU. Now the MSS is 40 bytes less than the MTU (20 for IP, 20 for TCP headers).
So, I think, the Mikrotik TCP MSS mangle rule should be using set-mss=1377. Set this the SAME on both sides! Do not set them different on each side – that will break things! And why we’re using the lowest of the values since that’s what’s needed for MSS.
And the IPSec traffic goes though the firewall twice (tunnel then traffic)… It might be best to use the subnet IPs for the TCP MSS mangle rule – instead of the interface name in the adjust-mss rules.
But this is also why I suggest doing a little homework on the Windows Server running SQL Server. Older version of Windows disabled PMTUD from working. It takes both side for PMTUD to work… Mac and Linux all deal with PMTUD, and “recent” Windows… I just don’t know when the specific Windows version they changed their default firewall to allow PMTUD.
See my most recent post. Try using the IP address in the mangle rule. It may be hit, but MSS adjustment of the tunnel itself (not inner traffic) isn’t going to help the remote LAN to SQL inner traffic…