gpt4 book ai didi

mysql - AWS 的站点到站点 OpenSWAN VPN 隧道问题

转载 作者:IT王子 更新时间:2023-10-29 00:21:33 25 4
gpt4 key购买 nike

我们在两个 AWS 区域和我们的托管设施之间有一个 Openswan VPN 隧道(使用 AWS 的指南:http://aws.amazon.com/articles/5472675506466066)。正常使用工作正常(ssh 等),但我们在所有区域之间的隧道上遇到一些 MySQL 问题。在 Linux 服务器上使用 mysql 命令行客户端并尝试使用 MySQL Connector J 进行连接,它基本上停止了……它似乎打开了连接,但随后卡住了。它不会被拒绝或任何东西,只是卡在那里。

初步研究后认为这是一个 MTU 问题,但我已经搞砸了很多而且没有运气。

与服务器的连接工作正常,我们可以选择要使用的数据库等,但是使用 Java 连接器时,Java 客户端在进行查询后似乎没有接收到任何网络流量。

当在 Linux 上的 MySQL 客户端中运行一个选择时,我们最多可以在它失效之前获得 2 或 3 行。

话虽如此,我在 AWS 端也有一个单独的 openswan VPN,用于客户端(mac 和 iOS)vpn 连接。一切都通过客户端 VPN 运行得非常好,而且总体上看起来更稳定。我注意到的主要区别是静态连接使用“隧道”作为类型,客户端使用“传输”,但是当将静态隧道连接切换为传输时,它说有大约 30 个打开的连接并且不起作用.

我是 OpenSWAN 的新手,所以希望有人能帮助我指出让静态隧道和客户端 VPN 正常工作的正确方向。

一如既往,这是我的配置文件:

两个静态隧道服务器的 ipsec.conf:

# basic configuration
config setup
# Debug-logging controls: "none" for (almost) none, "all" for lots.
# klipsdebug=none
# plutodebug="control parsing"
# For Red Hat Enterprise Linux and Fedora, leave protostack=netkey
protostack=netkey
nat_traversal=yes
virtual_private=
oe=off
# Enable this if you see "failed to find any available worker"
# nhelpers=0

#You may put your configuration (.conf) file in the "/etc/ipsec.d/" and uncomment this.
include /etc/ipsec.d/*.conf

VPC1 到 colo 隧道配置

conn vpc1-to-DT
type=tunnel
authby=secret
left=%defaultroute
leftid=54.213.24.xxx
leftnexthop=%defaultroute
leftsubnet=10.1.4.0/24
right=72.26.103.xxx
rightsubnet=10.1.2.0/23
pfs=yes
auto=start

colo-to-VPC1 隧道配置

conn DT-to-vpc1
type=tunnel
authby=secret
left=%defaultroute
leftid=72.26.103.xxx
leftnexthop=%defaultroute
leftsubnet=10.1.2.0/23
right=54.213.24.xxx
rightsubnet=10.1.4.0/24
pfs=yes
auto=start

客户端点 VPN ipsec.conf

# basic configuration

config setup
interfaces=%defaultroute
klipsdebug=none
nat_traversal=yes
nhelpers=0
oe=off
plutodebug=none
plutostderrlog=/var/log/pluto.log
protostack=netkey
virtual_private=%v4:10.1.4.0/24

conn L2TP-PSK
authby=secret
pfs=no
auto=add
keyingtries=3
rekey=no
type=transport
forceencaps=yes
right=%any
rightsubnet=vhost:%any,%priv
rightprotoport=17/0
# Using the magic port of "0" means "any one single port". This is
# a work around required for Apple OSX clients that use a randomly
# high port, but propose "0" instead of their port.
left=%defaultroute
leftprotoport=17/1701
# Apple iOS doesn't send delete notify so we need dead peer detection
# to detect vanishing clients
dpddelay=10
dpdtimeout=90
dpdaction=clear

最佳答案

找到解决方案。需要在两端添加以下 IP 表规则:

iptables -t mangle -I POSTROUTING -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

加上 1400 的 MTU,我们看起来非常稳定

关于mysql - AWS 的站点到站点 OpenSWAN VPN 隧道问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21761830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com