有没有熟悉 openvpn 的同学给看看

61 天前
 fever
openvpn 两边 service 都启动起来了 连接不成功,或者说一连上就被重置了,似乎是拒绝了
服务端的转发有开 /etc/sysctl.conf
服务端的端口 51199 是正常开放的
看日志 Connection reset, restarting [-1] 这个错误也找不到相关解释


服务端配置:
proto tcp-server
dev tun
port 51199
ifconfig 10.10.4.1 10.10.4.2
tls-server
remote-cert-tls client
tls-auth /etc/openvpn/server/ta.key 0
ca /etc/openvpn/server/ca.crt
cert /etc/openvpn/server/server.crt
key /etc/openvpn/server/server.key
dh /etc/openvpn/server/dh2048.pem
cipher AES-128-CBC
comp-lzo adaptive
push "comp-lzo adaptive"
persist-tun
persist-key
verb 4
keepalive 10 60
user openvpn
group openvpn
log /var/log/openvpn_test.log
log-append /var/log/openvpn_test.log
route 192.168.144.0 255.255.248.0 vpn_gateway


客户端配置:
proto tcp-client
dev tun
remote x.x.x.x 51199
ifconfig 10.10.4.2 10.10.4.1
tls-client
remote-cert-tls server
tls-auth /etc/openvpn/server/ta.key 1
ca /etc/openvpn/server/ca.crt
cert /etc/openvpn/server/server.crt
key /etc/openvpn/server/server.key
dh /etc/openvpn/server/dh2048.pem
cipher AES-128-CBC
comp-lzo adaptive
persist-tun
persist-key
verb 4
keepalive 10 60
user openvpn
group openvpn
log /var/log/openvpn_us.log
log-append /var/log/openvpn_us.log
route 192.168.40.0 255.255.248.0 vpn_gateway



客户端日志:
2024-04-02 19:53:17 us=761923 Restart pause, 300 second(s)
2024-04-02 19:58:17 us=762021 Re-using SSL/TLS context
2024-04-02 19:58:17 us=762156 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2024-04-02 19:58:17 us=762173 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2024-04-02 19:58:17 us=762235 Control Channel MTU parms [ L:1559 D:1182 EF:68 EB:0 ET:0 EL:3 ]
2024-04-02 19:58:17 us=762253 Preserving previous TUN/TAP instance: tun4
2024-04-02 19:58:17 us=762271 Data Channel MTU parms [ L:1559 D:1450 EF:59 EB:395 ET:0 EL:3 ]
2024-04-02 19:58:17 us=762307 Local Options String (VER=V4): 'V4,dev-type tun,link-mtu 1559,tun-mtu 1500,proto TCPv4_CLIENT,ifconfig 10.10.4.1 10.10.4.2,keydir 1,cipher AES-128-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-client'
2024-04-02 19:58:17 us=762319 Expected Remote Options String (VER=V4): 'V4,dev-type tun,link-mtu 1559,tun-mtu 1500,proto TCPv4_SERVER,ifconfig 10.10.4.2 10.10.4.1,keydir 0,cipher AES-128-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-server'
2024-04-02 19:58:17 us=762331 TCP/UDP: Preserving recently used remote address: [AF_INET]xxxx:51199
2024-04-02 19:58:17 us=762362 Socket Buffers: R=[131072->131072] S=[16384->16384]
2024-04-02 19:58:17 us=762371 Attempting to establish TCP connection with [AF_INET]xxxx:51199 [nonblock]
2024-04-02 19:58:17 us=937632 TCP connection established with [AF_INET]xxxx:51199
2024-04-02 19:58:17 us=937679 TCP_CLIENT link local: (not bound)
2024-04-02 19:58:17 us=937689 TCP_CLIENT link remote: [AF_INET]xxxx:51199
2024-04-02 19:58:18 us=791085 Connection reset, restarting [-1]
2024-04-02 19:58:18 us=791173 TCP/UDP: Closing socket
2024-04-02 19:58:18 us=791200 SIGUSR1[soft,connection-reset] received, process restarting
2024-04-02 19:58:18 us=791215 Restart pause, 300 second(s)


服务端日志
2024-04-02 19:58:18 us=709684 TCP connection established with [AF_INET]x.x.x.x:37360
2024-04-02 19:58:18 us=709738 TCPv4_SERVER link local (bound): [AF_INET][undef]:51199
2024-04-02 19:58:18 us=709745 TCPv4_SERVER link remote: [AF_INET]x.x.x.x:37360
2024-04-02 19:58:18 us=709757 Server poll timeout, restarting
2024-04-02 19:58:18 us=709799 TCP/UDP: Closing socket
2024-04-02 19:58:18 us=709860 SIGUSR1[soft,server_poll] received, process restarting
2024-04-02 19:58:18 us=709880 net_route_v4_best_gw query: dst 0.0.0.0
2024-04-02 19:58:18 us=709965 net_route_v4_best_gw result: via 192.168.40.253 dev eth0
2024-04-02 19:58:18 us=709996 Re-using SSL/TLS context
2024-04-02 19:58:18 us=710069 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2024-04-02 19:58:18 us=710081 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
2024-04-02 19:58:18 us=710127 Control Channel MTU parms [ L:1559 D:1182 EF:68 EB:0 ET:0 EL:3 ]
2024-04-02 19:58:18 us=710194 Preserving previous TUN/TAP instance: tun0
2024-04-02 19:58:18 us=710205 Data Channel MTU parms [ L:1559 D:1450 EF:59 EB:395 ET:0 EL:3 ]
2024-04-02 19:58:18 us=710224 Local Options String (VER=V4): 'V4,dev-type tun,link-mtu 1559,tun-mtu 1500,proto TCPv4_SERVER,ifconfig 10.10.4.2 10.10.4.1,keydir 0,cipher AES-128-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-server'
2024-04-02 19:58:18 us=710229 Expected Remote Options String (VER=V4): 'V4,dev-type tun,link-mtu 1559,tun-mtu 1500,proto TCPv4_CLIENT,ifconfig 10.10.4.1 10.10.4.2,keydir 1,cipher AES-128-CBC,auth SHA1,keysize 128,tls-auth,key-method 2,tls-client'
2024-04-02 19:58:18 us=710282 Could not determine IPv4/IPv6 protocol. Using AF_INET
2024-04-02 19:58:18 us=710300 Socket Buffers: R=[131072->131072] S=[16384->16384]
2024-04-02 19:58:18 us=710314 Listening for incoming TCP connection on [AF_INET][undef]:51199
3912 次点击
所在节点    宽带症候群
57 条回复
mm2x
61 天前
@Remember 为啥没有价值呢?不比 PPTP 和 L2TP 好用安全多了。OPENVPN 在组网方面还是非常不错的吧?
fever
61 天前
@newlifeinsc #15 都是 Linux 来着 2.5.5
chronos
61 天前
要不你尝试一下 tinc ,我用这个连接国内外很稳定,用了好多年了。
YaD2x
61 天前
@ik 我就过了一下代理,不然直连端口一会儿就封了
fever
61 天前
@mm2x #21 对 感觉还是挺方便的
@defunct9 #17 因为好个不同地方一起组网 主要路由支持的有限 只有 openvpn 和一个 pptp
defunct9
61 天前
@YaD2x ,是要控制整段路由。公司到苹果的路由,必须走阿里到 ipsec 上海的一条专门线路。
fever
61 天前
@defunct9 #26 哥怎么给你 ssh 绿色吗还是 tg
defunct9
61 天前
@fever wx:defunct
fever
61 天前
@YaD2x #19 你那个贴子啥都没说啊 你可以配置文件发出来看看 我两边都 ping 通过 我现在的问题是换了 tls 有问题
newlifeinsc
61 天前
@fever #22 那应该是和我的状况不一样, 我用的 openvpn3 的 client 去连的。相同的 client 配置,你有用其他平台的 client 去试吗
fever
61 天前
@newlifeinsc #30 并没有 我是两边都是 linux 不同区域的
YaD2x
61 天前
@fever 日 记错了,忘了帖子内容被我删了
YaD2x
61 天前
@defunct9 我也加你 请教你一下
ExplodingFKL
61 天前
openvpn 太复杂了,加上大量的协议协商,这玩意的握手特征特别明显,阻断是常有的事情 ,如果是组网的话可以用 nebula 、n2n 、wireguard 啥的,虽然出国 UDP 日常拉胯 ...
nkloveni
61 天前
@totoro52 他这种预共享 key 的 fq 是没问题的,没啥特征的
fever
61 天前
@nkloveni #35 说的预共享是我 append 里面的 static 共享密钥方式吗 ?意思是下面的 static 方式是没问题 ,但是用 tls 不行,就是因为 tls 有特征被阻断吗
pagxir
61 天前
组网用 fou ipsec ipip 都可以吧。用 VPN 是为了安全。
ranaanna
61 天前
可能有一个错误:客户端的 cert 和 key ,不应该和服务端的是一样的,但是这里从文件名字来看,可能是一样的。简单的 static key 已经过时了。tls-auth hangshake 很多年前也被封了,但是 OP 只需要额外配置一个 tls-crypt ,给 tls-auth 加个密,就能顺利用到当下
ranaanna
61 天前
抱歉前面写错了,tls-auth 和 tls-crypt 是相似的东西,被封的是 tls handshake ,所以需要额外配置 tls-auth 或 tls-crypt
ranaanna
61 天前
再次抱歉看 OP 配置是有 tls-auth 的(但是不需要 0 1 ,因为不是点对点),所以可能的问题是两端用了相同的 cert 和 key

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1029240

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX