Long SQL Queries not working over libreswan tunnel

84 Views Asked by At

I have a Rocky Linux 8 distro in my office as a LAMP with the ODBC and SQL drivers.
This machine is behind a SonicWall VPN making a tunnel to another SonicWall to connect to the SQL Server. This Linux box is an API and needs to be working all the time, but since it is in our office and there is a lot of construction we have electrical power outages very frequently.

I decided to move this API box to the cloud.

Here is where I have the problem.

In the cloud I am using a rocky Linux 8 distro with libreswan to create the tunnel with the other SonicWall. I think the tunnel is working ok.

I have in the same network another Rocky Linux 8 box for the API with the same settings that I have in my office.

I am able to make Queries but only works if the query is small.

If I run a query with a select of 11 fields it times outs.... it just does not work...

The same long query works ok in my office, but not in cloud environment, but if I remove a couple of Select fields it works...

I tried setting the MTU on the tunnel to 1392 but it did not work. I believe the problem could be with the libreswan tunnel but I don't know what to do.

Here is the image of my setup

1

I hope it helps.

2

There are 2 best solutions below

0
On

After reading some articles about the different MTU of OCI instances and the MTU applied in the OCI VPN, my solution was to create routing rules within the instance limiting the MTU, this solved my problems with large queries.

Ex:

sudo ip route add 192.168.1.0/24 via 172.16.40.1 mtu 1200

About MTU : https://docs.oracle.com/pt-br/iaas/Content/Network/Troubleshoot/connectionhang.htm

0
On

just for the record, I used the following to fix the Issue.

iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 1380

I found it on https://libreswan.org/wiki/FAQ#My_ssh_sessions_hang_or_connectivity_is_very_slow

it fixed the problem....