【问题标题】:OpenVpn client with multiple remote IP addresses具有多个远程 IP 地址的 OpenVpn 客户端
【发布时间】:2020-09-11 14:51:16
【问题描述】:

我有 2 个 openvpn 服务器在树莓派 4(ubuntu 服务器 20.04 LTS)上运行,每个服务器都在 nat 后面。我有一个 GL.inet 路由器,它将作为客户端连接到 openvpn 服务器,我希望客户端在第一个服务器出现故障时连接到下一个服务器。我无法让它正常工作。路由器 (GL.inet) 连接到服务器一。从另一台计算机,我 ssh 进入服务器一并重新启动服务器一。预期:路由器(GL.inet)必须自动切换到服务器 2。现实:路由器(Gl.inet)一直试图连接到服务器 1。我尝试重新启动路由器(Gl.inet),它一直在尝试重新连接到服务器一。大约 1 小时后,它将连接到服务器 2。我希望立即完成切换,或者可能在 5 分钟内完成,而不是一小时。

这是两台服务器的配置文件:

ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/pivpnservertwo.crt
key /etc/openvpn/easy-rsa/pki/private/pivpnservertwo.key
remote-cert-tls client
tls-auth /etc/openvpn/easy-rsa/pki/ta.key 0                                  
dh  dh2048.pem
;tls-verify "./verify-cn /etc/openvpn/allowedClients" 
;crl-verify ""
reneg-sec 3600 
cipher AES-256-CBC                                                      
user nobody                                                             
group nogroup
persist-tun 
persist-key 
persist-local-ip
persist-remote-ip
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp" 
push "dhcp-option DNS 4.2.2.2"
push "dhcp-option DNS 8.8.8.8" 
client-config-dir /etc/openvpn/clientConfigDirectory 
dev tun 
topology subnet 
float
proto udp
port 1194
push-peer-info
max-clients 100
keepalive 5 10 
ping-timer-rem 
log         /var/log/openvpn/openvpn.log 
ifconfig-pool-persist /var/log/ipassignments.txt                                                                                                                                   
verb 4
status    /var/log/openvpn/openvpn-status.log  1                                            
status-version 1
writepid  /var/log/openvpn/openvpn-pid.log
explicit-exit-notify 2
up        ./server.up
down      ./server.down
management 127.0.0.1 3066 

这是客户端的配置文件:

client                                          
ca ca.crt                                                            
cert chachoo.crt
key chachoo.key
remote-cert-tls server
tls-auth ta.key 1 
reneg-sec 0  
cipher AES-256-CBC  
persist-tun  
persist-key   
mute-replay-warnings
dev tun                                             
remote 192.168.50.100 1194 udp4
remote 192.168.50.150 1194 udp4                                        
remote-random                                                           
resolv-retry infinite 
nobind
connect-retry 5  20 
connect-retry-max 3 
verb 4

这是路由器客户端日志的图片:您可以​​在日志中看到,它说,保留最近使用的远程 IP 地址。我希望它切换到以下远程 IP 地址。

【问题讨论】:

    标签: openwrt openvpn


    【解决方案1】:

    关注这个thread

    尝试将以下配置添加到您的客户端配置中

    server-poll-timeout 1
    

    【讨论】:

    • 我刚试过。确实切换到其他服务器,但是连接不稳定,不断重连重连。
    • 查看服务器和客户端日志,和/或将它们添加到您的问题中。
    • 可能1秒不够用,试试server-poll-timeout 10
    猜你喜欢
    • 2011-09-09
    • 2020-11-30
    • 2018-04-30
    • 1970-01-01
    • 2021-11-27
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多