I'm a new user forum and I'm doing my first VPN setup.
I have purchased a VPN service with PrivateInternetAccess. I'm setting up a Linux VM (CentOS 6.5 server) on a VMware ESXi remote host. It's behind another VM, which makes NAT functions for multiple VMs. I have full access to the ESXi host and the NAT server, to make the necessary changes.
I have a openvpn client on the server and it works correctly.
My problem is that when I activate the client and tunnel works, I lose the connection to the server via ssh.
I guess I have to add a rule to separate config file or in Iptables to keep open the ssh port.
If you need any additional information, I will add it as soon as possible.
=============
Client config file:
client
dev tun
proto udp
remote xxx.privateinternetaccess.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/ca.crt
crl-verify /etc/openvpn/crl.pem
tls-client
remote-cert-tls server
comp-lzo
reneg-sec 0
verb 4 # verbose mode
status /etc/openvpn/openvpn-status.log
log /etc/openvpn/openvpn-log.log
auth-user-pass /etc/openvpn/login.pia
=============
the IPs client once connected to the VPN is (tunnel ips change every session):
eth1 Link encap:Ethernet HWaddr 00:0C:29:6F:FA:48
inet addr:192.168.100.13 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
test 1:
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.113.1.6 P-t-P:10.113.1.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
test 2:
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.188.1.10 P-t-P:10.188.1.9 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
Tunnel vpn public IP: test 1: 93.115.83.16
test 2: 5.254.100.67
test 3: 93.115.85.39
=============
/etc/sysconfig/iptables file:
# Generated by iptables-save v1.4.7 on Fri Oct 24 08:19:30 2014
*mangle
:PREROUTING ACCEPT [3340:3277701]
:INPUT ACCEPT [3114:3220261]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [2532:706816]
:POSTROUTING ACCEPT [2532:706816]
COMMIT
# Completed on Fri Oct 24 08:19:30 2014
# Generated by iptables-save v1.4.7 on Fri Oct 24 08:19:30 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Fri Oct 24 08:19:30 2014
# Generated by iptables-save v1.4.7 on Fri Oct 24 08:19:30 2014
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Fri Oct 24 08:19:30 2014
=============
Iptables allow all traffic, as the server with the vpn client is behind another, which makes routing, no filtering.
the output for "iptables -L -n -v" once connected to the VPN is:
Chain INPUT (policy ACCEPT 1185 packets, 1301K bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1490 packets, 568K bytes)
pkts bytes target prot opt in out source destination
for "iptables -L -n -v -t nat"
Chain PREROUTING (policy ACCEPT 18 packets, 1475 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 4 packets, 236 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 4 packets, 236 bytes)
pkts bytes target prot opt in out source destination
=============
Routing before running the vpn client (netstat -rn)
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.100.10 0.0.0.0 UG 0 0 0 eth1
Routing after running the vpn client (netstat -rn)
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.110.1.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
93.115.85.39 192.168.100.10 255.255.255.255 UGH 0 0 0 eth1
10.110.1.1 10.110.1.5 255.255.255.255 UGH 0 0 0 tun0
192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 10.110.1.5 128.0.0.0 UG 0 0 0 tun0
128.0.0.0 10.110.1.5 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 192.168.100.10 0.0.0.0 UG 0 0 0 eth1
=============