Hello,
I have successfully setup OpenVPN on my VPS which running CentOS Linux 5.8.
I need to route all the traffic including web traffic through OpenVPN. I put the command push "redirect-gateway def1" on the server configuration and client configuration.
Server configuration:
local xx.xx.xx.xx # server ip address
port 1194 # default port
proto udp #protocol
dev tun
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so /etc/pam.d/login
client-cert-not-required
username-as-common-name
server 1.2.3.0 255.255.255.0
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 5 30
Client Configuration:
client
dev tun
proto udp
remote xx.xx.xx.xx 1194 # - My server IP and OpenVPN Port
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
push "redirect-gateway def1"
mssfix 1450
persist-key
persist-tun
ca ca.crt
auth-user-pass
comp-lzo
reneg-sec 0
verb 3
Log information during connection to the OpenVPN:
Tue Sep 09 19:12:29 2014 OpenVPN 2.3.4 i686-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Aug 7 2014
Tue Sep 09 19:12:29 2014 library versions: OpenSSL 1.0.1i 6 Aug 2014, LZO 2.05
Tue Sep 09 19:12:29 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Tue Sep 09 19:12:29 2014 Need hold release from management interface, waiting...
Tue Sep 09 19:12:29 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Tue Sep 09 19:12:29 2014 MANAGEMENT: CMD 'state on'
Tue Sep 09 19:12:29 2014 MANAGEMENT: CMD 'log all on'
Tue Sep 09 19:12:30 2014 MANAGEMENT: CMD 'hold off'
Tue Sep 09 19:12:30 2014 MANAGEMENT: CMD 'hold release'
Tue Sep 09 19:12:40 2014 MANAGEMENT: CMD 'username "Auth" "vpnuser1"'
Tue Sep 09 19:12:40 2014 MANAGEMENT: CMD 'password [...]'
Tue Sep 09 19:12:40 2014 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Tue Sep 09 19:12:41 2014 Socket Buffers: R=[8192->8192] S=[8192->8192]
Tue Sep 09 19:12:41 2014 UDPv4 link local: [undef]
Tue Sep 09 19:12:41 2014 UDPv4 link remote: [AF_INET]xx.xx.165.153:1194
Tue Sep 09 19:12:41 2014 MANAGEMENT: >STATE:1410315161,WAIT,,,
Tue Sep 09 19:12:41 2014 MANAGEMENT: >STATE:1410315161,AUTH,,,
Tue Sep 09 19:12:41 2014 TLS: Initial packet from [AF_INET]xx.xx.165.153:1194, sid=cca74d7d 28fb8bb5
Tue Sep 09 19:12:41 2014 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Tue Sep 09 19:12:42 2014 VERIFY OK: depth=1, C=MY, ST=CA, L=SanFrancisco, O=UKM, OU=FTSM, CN=iinetwork.org, name=Akram, emailAddress=kargar2013@gmail.com
Tue Sep 09 19:12:42 2014 VERIFY OK: depth=0, C=MY, ST=CA, L=SanFrancisco, O=UKM, OU=FTSM, CN=iinetwork.org, name=Akram, emailAddress=kargar2013@gmail.com
Tue Sep 09 19:12:43 2014 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Tue Sep 09 19:12:43 2014 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Sep 09 19:12:43 2014 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Tue Sep 09 19:12:43 2014 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Sep 09 19:12:43 2014 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA
Tue Sep 09 19:12:43 2014 [iinetwork.org] Peer Connection Initiated with [AF_INET]192.227.165.153:1194
Tue Sep 09 19:12:44 2014 MANAGEMENT: >STATE:1410315164,GET_CONFIG,,,
Tue Sep 09 19:12:45 2014 SENT CONTROL [iinetwork.org]: 'PUSH_REQUEST' (status=1)
Tue Sep 09 19:12:46 2014 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 1.2.3.1,topology net30,ping 5,ping-restart 30,ifconfig 1.2.3.6 1.2.3.5'
Tue Sep 09 19:12:46 2014 OPTIONS IMPORT: timers and/or timeouts modified
Tue Sep 09 19:12:46 2014 OPTIONS IMPORT: --ifconfig/up options modified
Tue Sep 09 19:12:46 2014 OPTIONS IMPORT: route options modified
Tue Sep 09 19:12:46 2014 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Tue Sep 09 19:12:46 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Tue Sep 09 19:12:46 2014 MANAGEMENT: >STATE:1410315166,ASSIGN_IP,,1.2.3.6,
Tue Sep 09 19:12:46 2014 open_tun, tt->ipv6=0
Tue Sep 09 19:12:46 2014 TAP-WIN32 device [Local Area Connection 3] opened: \\.\Global\{A8A88339-1490-4261-B78F-5D22F94B256B}.tap
Tue Sep 09 19:12:46 2014 TAP-Windows Driver Version 9.9
Tue Sep 09 19:12:46 2014 Notified TAP-Windows driver to set a DHCP IP/netmask of 1.2.3.6/255.255.255.252 on interface {A8A88339-1490-4261-B78F-5D22F94B256B} [DHCP-serv: 1.2.3.5, lease-time: 31536000]
Tue Sep 09 19:12:46 2014 NOTE: FlushIpNetTable failed on interface [18] {A8A88339-1490-4261-B78F-5D22F94B256B} (status=5) : Access is denied.
Tue Sep 09 19:12:51 2014 TEST ROUTES: 2/2 succeeded len=1 ret=1 a=0 u/d=up
Tue Sep 09 19:12:51 2014 C:\Windows\system32\route.exe ADD xx.xx.165.153 MASK 255.255.255.255 192.168.0.1
Tue Sep 09 19:12:51 2014 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=12]
Tue Sep 09 19:12:51 2014 Route addition via IPAPI failed [adaptive]
Tue Sep 09 19:12:51 2014 Route addition fallback to route.exe
Tue Sep 09 19:12:51 2014 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Tue Sep 09 19:12:51 2014 ERROR: Windows route add command failed [adaptive]: returned error code 1
Tue Sep 09 19:12:51 2014 C:\Windows\system32\route.exe ADD 0.0.0.0 MASK 128.0.0.0 1.2.3.5
Tue Sep 09 19:12:51 2014 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=18]
Tue Sep 09 19:12:51 2014 Route addition via IPAPI failed [adaptive]
Tue Sep 09 19:12:51 2014 Route addition fallback to route.exe
Tue Sep 09 19:12:51 2014 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Tue Sep 09 19:12:51 2014 ERROR: Windows route add command failed [adaptive]: returned error code 1
Tue Sep 09 19:12:51 2014 C:\Windows\system32\route.exe ADD 128.0.0.0 MASK 128.0.0.0 1.2.3.5
Tue Sep 09 19:12:51 2014 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=18]
Tue Sep 09 19:12:51 2014 Route addition via IPAPI failed [adaptive]
Tue Sep 09 19:12:51 2014 Route addition fallback to route.exe
Tue Sep 09 19:12:51 2014 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Tue Sep 09 19:12:51 2014 ERROR: Windows route add command failed [adaptive]: returned error code 1
Tue Sep 09 19:12:51 2014 MANAGEMENT: >STATE:1410315171,ADD_ROUTES,,,
Tue Sep 09 19:12:51 2014 C:\Windows\system32\route.exe ADD 1.2.3.1 MASK 255.255.255.255 1.2.3.5
Tue Sep 09 19:12:51 2014 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=18]
Tue Sep 09 19:12:51 2014 Route addition via IPAPI failed [adaptive]
Tue Sep 09 19:12:51 2014 Route addition fallback to route.exe
Tue Sep 09 19:12:51 2014 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Tue Sep 09 19:12:51 2014 ERROR: Windows route add command failed [adaptive]: returned error code 1
Tue Sep 09 19:12:51 2014 Initialization Sequence Completed
Tue Sep 09 19:12:51 2014 MANAGEMENT: >STATE:1410315171,CONNECTED,SUCCESS,1.2.3.6,xx.xx.165.153
Can anyone tell me how can i make it work?