I'm trying to configure a VPN server, and when I try to connect with my current configuration, my remote machine drops me, and I have to reboot it. This is how my configuration looks:
/etc/openvpn/server.conf
#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/easy-rsa/keys/ca.crt
#Server Certificate
cert /etc/openvpn/easy-rsa/keys/server.crt
#Server Key and keep this is secret
key /etc/openvpn/easy-rsa/keys/server.key
#See the size a dh key in /etc/openvpn/keys/
dh /etc/openvpn/easy-rsa/keys/dh2048.pem
#Internal IP will get when already connect
server 10.8.0.0 255.255.255.0
#this line will redirect all traffic through our OpenVPN
push "redirect-gateway def1"
#push "remote-gateway 10.8.0.5"
#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
#enable log
log-append /var/log/myvpn/openvpn.log
#Log Level
verb 3
client.ovpn
client
dev tun
proto udp
remote xxx.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
verb 3
ca /root/ca.crt
cert /root/client.crt
key /root/client.key
iptables
*nat
:PREROUTING ACCEPT [671:56750]
:INPUT ACCEPT [665:56294]
:OUTPUT ACCEPT [165:12223]
:POSTROUTING ACCEPT [165:12223]
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
COMMIT
When I run openvpn, I get output until it hits the routing, and it drops my connection:
[root@vpntestserver ~]# openvpn --config test.ovpn
Server side:
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 TLS: Initial packet from [AF_INET]PUBLIC_IP:46985, sid=a18792ce 0e216f9a
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 VERIFY OK: depth=1, C=US, ST=TX, L=*********, O=************, OU=*************, CN=**********, name=*********
Wed Aug 24 19:23:21 2016 VERIFY OK: depth=0, C=US, ST=TX, L=*********, O=************, OU=S*************, CN=**********, name=*********, emailAddress=********
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384, 2048 bit RSA
Aug 24 19:23:21 wulong openvpn[20344]: 166.78.244.39:46985 [nizen] Peer Connection Initiated with [AF_INET]166.78.244.39:46985
Aug 24 19:23:21 wulong openvpn[20344]: nizen/166.78.244.39:46985 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)
Aug 24 19:23:21 wulong openvpn[20344]: nizen/166.78.244.39:46985 MULTI: Learn: 10.8.0.6 -> nizen/166.78.244.39:46985
Aug 24 19:23:21 wulong openvpn[20344]: nizen/166.78.244.39:46985 MULTI: primary virtual IP for nizen/166.78.244.39:46985: 10.8.0.6
Aug 24 19:23:23 wulong openvpn[20344]: nizen/166.78.244.39:46985 PUSH: Received control message: 'PUSH_REQUEST'
Aug 24 19:23:23 wulong openvpn[20344]: nizen/166.78.244.39:46985 send_push_reply(): safe_cap=940
Aug 24 19:23:23 wulong openvpn[20344]: nizen/166.78.244.39:46985 SENT CONTROL [nizen]: 'PUSH_REPLY,redirect-gateway def1,remote-gateway 10.8.0.5,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.1,topology net30,ping 20,ping-restart 60,ifconfig 10.8.0.6 10.8.0.5' (status=1)
Client side:
Wed Aug 24 19:23:21 2016 OpenVPN 2.3.11 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on May 10 2016
Wed Aug 24 19:23:21 2016 library versions: OpenSSL 1.0.1e-fips 11 Feb 2013, LZO 2.06
Wed Aug 24 19:23:21 2016 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Wed Aug 24 19:23:21 2016 Socket Buffers: R=[212992->212992] S=[212992->212992]
Wed Aug 24 19:23:21 2016 UDPv4 link local: [undef]
Wed Aug 24 19:23:21 2016 UDPv4 link remote: [AF_INET]198.101.146.50:1194
Wed Aug 24 19:23:21 2016 TLS: Initial packet from [AF_INET]198.101.146.50:1194, sid=989f523a f07a9246
Wed Aug 24 19:23:21 2016 VERIFY OK: depth=1, C=US, ST=TX, L=*********, O=************, OU=*************, CN=**********, name=*********, emailAddress=********
Wed Aug 24 19:23:21 2016 VERIFY OK: depth=0, C=US, ST=TX, L=*********, O=************, OU=S*************, CN=**********, name=*********, emailAddress=********
Wed Aug 24 19:23:21 2016 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Wed Aug 24 19:23:21 2016 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed Aug 24 19:23:21 2016 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Wed Aug 24 19:23:21 2016 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Wed Aug 24 19:23:21 2016 Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384, 2048 bit RSA
Wed Aug 24 19:23:21 2016 [wulong] Peer Connection Initiated with [AF_INET]198.101.146.50:1194
Wed Aug 24 19:23:23 2016 SENT CONTROL [wulong]: 'PUSH_REQUEST' (status=1)
Wed Aug 24 19:23:23 2016 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,remote-gateway 10.8.0.5,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.1,topology net30,ping 20,ping-restart 60,ifconfig 10.8.0.6 10.8.0.5'
Wed Aug 24 19:23:23 2016 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:2: remote-gateway (2.3.11)
Wed Aug 24 19:23:23 2016 OPTIONS IMPORT: timers and/or timeouts modified
Wed Aug 24 19:23:23 2016 OPTIONS IMPORT: --ifconfig/up options modified
Wed Aug 24 19:23:23 2016 OPTIONS IMPORT: route options modified
Wed Aug 24 19:23:23 2016 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Wed Aug 24 19:23:23 2016 ROUTE_GATEWAY 166.78.244.1/255.255.255.0 IFACE=eth0 HWADDR=bc:76:4e:10:d0:22
Wed Aug 24 19:23:23 2016 TUN/TAP device tun0 opened
Wed Aug 24 19:23:23 2016 TUN/TAP TX queue length set to 100
Wed Aug 24 19:23:23 2016 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Wed Aug 24 19:23:23 2016 /usr/sbin/ip link set dev tun0 up mtu 1500
Wed Aug 24 19:23:23 2016 /usr/sbin/ip addr add dev tun0 local 10.8.0.6 peer 10.8.0.5
Wed Aug 24 19:23:23 2016 /usr/sbin/ip route add 198.101.146.50/32 via 166.78.244.1
Wed Aug 24 19:23:23 2016 /usr/sbin/ip route add 0.0.0.0/1 via 10.8.0.5
Wed Aug 24 19:23:23 2016 /usr/sbin/ip route add 128.0.0.0/1 via 10.8.0.
I'm sure this has been addressed, and I'm missing it, and if so, feel free to let me know harshly and then direct me to a response. Thanks in advance!! This is really frustrating me.