I am tring to connect to form same PC to openvpn server with openvpn tow instance. I have a server with multiple IP and running tow openvpn server instances on the same Server. Trying to connect to those instances from one PC at the same time.
I can connect to them separately however when i try to connect to them together the first instance connect fine. but the second instance i get this error:
Thu Dec 22 05:27:04 2011 /usr/sbin/ip link set dev tun0 up mtu 1500 Thu Dec 22 05:27:04 2011 /usr/sbin/ip addr add dev tun0 local 10.10.0.5 peer 10.10.0.6 Thu Dec 22 05:27:04 2011 /usr/sbin/ip route add 184.75.xxx.xxx/32 via 10.0.0.1 RTNETLINK answers: File exists Thu Dec 22 05:27:04 2011 ERROR: Linux route add command failed: external program exited with error status: 2 Thu Dec 22 05:27:04 2011 /usr/sbin/ip route add 0.0.0.0/1 via 10.10.0.6 RTNETLINK answers: File exists Thu Dec 22 05:27:04 2011 ERROR: Linux route add command failed: external program exited with error status: 2 Thu Dec 22 05:27:04 2011 /usr/sbin/ip route add 128.0.0.0/1 via 10.10.0.6 RTNETLINK answers: File exists Thu Dec 22 05:27:04 2011 ERROR: Linux route add command failed: external program exited with error status: 2
Server A config
port 1190 proto udp dev tun1 ca /etc/openvpn/ca.crt cert /etc/openvpn/serverA.crt key /etc/openvpn/serverA.key dh /etc/openvpn/dh1024.pem server 10.3.0.0 255.255.255.0 ifconfig-pool-persist 10.3.0.0-ipp.txt --mode server --tls-server client-config-dir /etc/openvpn/ccd.d route 10.3.0.0 255.255.255.252 push "redirect-gateway def1 bypass-dhcp" push "dhcp-option DNS 208.67.222.222" push "dhcp-option DNS 208.67.220.220" keepalive 10 120 comp-lzo user nobody group nobody persist-key persist-tun status 10.3.0.0-openvpn-status.log verb 3
Server B config
port 1191 proto udp dev tun0 ca /etc/openvpn/ca.crt cert /etc/openvpn/serverB.crt key /etc/openvpn/serverB.key dh /etc/openvpn/dh1024.pem server 10.10.0.0 255.255.255.0 ifconfig-pool-persist 10.10.0.0-ipp.txt --mode server --tls-server client-config-dir /etc/openvpn/ccd.d route 10.10.0.0 255.255.255.252 push "redirect-gateway def1 bypass-dhcp" push "dhcp-option DNS 208.67.222.222" push "dhcp-option DNS 208.67.220.220" keepalive 10 120 comp-lzo user nobody group nobody persist-key persist-tun status 10.10.0.0-openvpn-status.log verb 3
Client A config
client dev tun1 proto udp remote 184.75.xxx.xxx 1190 resolv-retry infinite nobind persist-key persist-tun ca /etc/openvpn/ca.crt cert /etc/openvpn/client1.crt key /etc/openvpn/client1.key ns-cert-type server comp-lzo verb 3 --script-security 2
Client B config
client dev tun0 proto udp remote 184.75.xxx.xxx 1191 resolv-retry infinite nobind persist-key persist-tun ca /etc/openvpn/ca.crt cert /etc/openvpn/client2.crt key /etc/openvpn/client2.key ns-cert-type server comp-lzo verb 3 --script-security 2
Any help would be much appreciated.
Best Answer
You are basically trying to set two default gateway. Even if you could add both routes, only one of them would work correctly.
You probably should remove the
push "redirect-gateway def1 bypass-dhcp"
from the server, and simply set up a route on the client side for which ever VPN should be the default.