how to connect two openvpn servers with openvpn client?

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
greenshell417
OpenVpn Newbie
Posts: 1
Joined: Mon Jun 26, 2017 2:52 am

how to connect two openvpn servers with openvpn client?

Post by greenshell417 » Mon Jun 26, 2017 3:18 am

I followed this article to setup two openvpn servers. https://www.hugeserver.com/kb/how-to-config-openvpn-linux-server/

One is in Virginia, the other one is in Tokyo. And I tested from my home pc. Both servers are accessible.

Now I want to connect the Virginia server to Tokyo server. So all the packages Virginia server received will be forwarded to Tokyo server.

So I ran openvpn client on Virginia server, with Tokyo server's .ovpn and .crt and .key files, which are the same set of files I used to connect to Tokyo server from my home PC. But I was no longer able to connect to Virginia server after I ran openvpn client on it. Did I do something wrong?

The reason I did it because I think it might be faster if I uses Virginia server as an intermediate server.
I think My home PC -----> Virginia server ------> Tokyo server will be faster(with smaller ping and pack loss) than My home PC ------> Tokyo server, because the connection between Virginia server and Tokyo server are optimized by the server provider

How should I do this correctly?

Here is my server side configuration file
#change with your port
port 1194

#You can use udp or tcp
proto udp

# "dev tun" will create a routed IP tunnel.
dev tun

#Certificate Configuration

#ca certificate
ca /etc/openvpn/keys/ca.crt

#Server Certificate
cert /etc/openvpn/keys/server.crt

#Server Key and keep this is secret
key /etc/openvpn/keys/server.key

#See the size a dh key in /etc/openvpn/keys/
dh /etc/openvpn/keys/dh2048.pem

#Internal IP will get when already connect
server 10.1.1.0 255.255.255.0

#this line will redirect all traffic through our OpenVPN
push "redirect-gateway def1"

#Provide DNS servers to the client, you can use goolge DNS
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"

#Enable multiple client to connect with same key
duplicate-cn

keepalive 20 60
comp-lzo
persist-key
persist-tun
#daemon

log-append /var/log/myvpn/openvpn.log

#Log Level
verb 3

and client ovpn file

client
dev tun
proto udp

#Server IP and Port
remote tokyo_server_ip 1194

resolv-retry infinite
nobind
persist-key
persist-tun
mute-replay-warnings
ca ca.crt
cert client.crt
key client.key
ns-cert-type server
comp-lzo

Thanks

Post Reply