I've set up an OpenVPN server on my linux device and set it to forward IP traffic to the internet.
For testing purposes, I've set up a Windows 7 client on a virtual machine using VirtualBox.
I've set the network on the virtual machine to host only.
I then setup an OpenVPN client on Windows 7, and it connected successfuly to the server (which is also the host for the VM).
I was then expecting to be able to reach the internet via the OpenVPN connection, but that didn't happen.
This is my server configuration file:
port 1194
proto udp
dev tun
ca /home/tom/easy-rsa/keys/ca.crt
cert /home/tom/easy-rsa/keys/server.crt
key /home/tom/easy-rsa/keys/server.key # This file should be kept secret
dh /home/tom/easy-rsa/keys/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
client-to-client
keepalive 10 31
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
and this is my client configuration file:
client
dev tun
proto udp
remote 192.168.56.1 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca "C:\\Program Files\\OpenVPN\\config\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\client1.crt"
key "C:\\Program Files\\OpenVPN\\config\\client1.key"
ns-cert-type server
comp-lzo
verb 3
#I have added these 2 lines from a forum post I found that seem to be related, it did not change much of anything.
redirect-gateway def1 bypass-dhcp
dhcp-option DNS 8.8.8.8
This is the log file of the connection (client side):
Thu Oct 23 14:41:41 2014 OpenVPN 2.3.4 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [PKCS11] [IPv6] built on Oct 21 2014
Thu Oct 23 14:41:41 2014 library versions: OpenSSL 1.0.1j 15 Oct 2014, LZO 2.05
Enter Management Password:
Thu Oct 23 14:41:41 2014 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Thu Oct 23 14:41:41 2014 Need hold release from management interface, waiting...
Thu Oct 23 14:41:41 2014 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Thu Oct 23 14:41:41 2014 MANAGEMENT: CMD 'state on'
Thu Oct 23 14:41:41 2014 MANAGEMENT: CMD 'log all on'
Thu Oct 23 14:41:41 2014 MANAGEMENT: CMD 'hold off'
Thu Oct 23 14:41:41 2014 MANAGEMENT: CMD 'hold release'
Thu Oct 23 14:41:42 2014 Socket Buffers: R=[8192->8192] S=[8192->8192]
Thu Oct 23 14:41:42 2014 UDPv4 link local: [undef]
Thu Oct 23 14:41:42 2014 UDPv4 link remote: [AF_INET]192.168.56.1:1194
Thu Oct 23 14:41:42 2014 MANAGEMENT: >STATE:1414068102,WAIT,,,
Thu Oct 23 14:41:42 2014 MANAGEMENT: >STATE:1414068102,AUTH,,,
Thu Oct 23 14:41:42 2014 TLS: Initial packet from [AF_INET]192.168.56.1:1194, sid=95ab81f7 4c293808
Thu Oct 23 14:41:42 2014 VERIFY OK: depth=1, C=IL, ST=ISRAEL, L=TelAviv, O=KLINO, OU=KLINO, CN=KLINO CA, name=EasyRSA, emailAddress=tom.klino@gmail.com
Thu Oct 23 14:41:42 2014 VERIFY OK: nsCertType=SERVER
Thu Oct 23 14:41:42 2014 VERIFY OK: depth=0, C=IL, ST=ISRAEL, L=TelAviv, O=KLINO, OU=KLINO, CN=server, name=EasyRSA, emailAddress=tom.klino@gmail.com
Thu Oct 23 14:41:42 2014 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Oct 23 14:41:42 2014 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Oct 23 14:41:42 2014 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Thu Oct 23 14:41:42 2014 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Oct 23 14:41:42 2014 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Thu Oct 23 14:41:42 2014 [server] Peer Connection Initiated with [AF_INET]192.168.56.1:1194
Thu Oct 23 14:41:43 2014 MANAGEMENT: >STATE:1414068103,GET_CONFIG,,,
Thu Oct 23 14:41:44 2014 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Oct 23 14:41:44 2014 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,route 10.8.0.0 255.255.255.0,topology net30,ping 10,ping-restart 31,ifconfig 10.8.0.10 10.8.0.9'
Thu Oct 23 14:41:44 2014 OPTIONS IMPORT: timers and/or timeouts modified
Thu Oct 23 14:41:44 2014 OPTIONS IMPORT: --ifconfig/up options modified
Thu Oct 23 14:41:44 2014 OPTIONS IMPORT: route options modified
Thu Oct 23 14:41:44 2014 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Thu Oct 23 14:41:44 2014 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Thu Oct 23 14:41:44 2014 MANAGEMENT: >STATE:1414068104,ASSIGN_IP,,10.8.0.10,
Thu Oct 23 14:41:44 2014 open_tun, tt->ipv6=0
Thu Oct 23 14:41:44 2014 TAP-WIN32 device [Local Area Connection 2] opened: \\.\Global\{78474CD3-6EE8-4D1A-B61E-BF391CCE0DC0}.tap
Thu Oct 23 14:41:44 2014 TAP-Windows Driver Version 9.21
Thu Oct 23 14:41:44 2014 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.10/255.255.255.252 on interface {78474CD3-6EE8-4D1A-B61E-BF391CCE0DC0} [DHCP-serv: 10.8.0.9, lease-time: 31536000]
Thu Oct 23 14:41:44 2014 Successful ARP Flush on interface [19] {78474CD3-6EE8-4D1A-B61E-BF391CCE0DC0}
Thu Oct 23 14:41:49 2014 TEST ROUTES: 2/2 succeeded len=1 ret=1 a=0 u/d=up
Thu Oct 23 14:41:49 2014 NOTE: unable to redirect default gateway -- Cannot read current default gateway from system
Thu Oct 23 14:41:49 2014 MANAGEMENT: >STATE:1414068109,ADD_ROUTES,,,
Thu Oct 23 14:41:49 2014 C:\Windows\system32\route.exe ADD 10.8.0.0 MASK 255.255.255.0 10.8.0.9
Thu Oct 23 14:41:49 2014 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=20 and dwForwardType=4
Thu Oct 23 14:41:49 2014 Route addition via IPAPI succeeded [adaptive]
Thu Oct 23 14:41:49 2014 Initialization Sequence Completed
Thu Oct 23 14:41:49 2014 MANAGEMENT: >STATE:1414068109,CONNECTED,SUCCESS,10.8.0.10,192.168.56.1
This is the output of the "ipconfig /all" for the OpenVPN interface after connection:
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : TAP-Windows Adapter V9
Physical Address. . . . . . . . . : 00-FF-78-47-4C-D3
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::f11c:363:c623:2250%19(Preferred)
IPv4 Address. . . . . . . . . . . : 10.8.0.10(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.252
Lease Obtained. . . . . . . . . . : Thursday, October 23, 2014 2:41:44 PM
Lease Expires . . . . . . . . . . : Friday, October 23, 2015 2:41:44 PM
Default Gateway . . . . . . . . . :
DHCP Server . . . . . . . . . . . : 10.8.0.9
DHCPv6 IAID . . . . . . . . . . . : 318832504
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1B-DB-13-49-08-00-27-E2-A4-6D
DNS Servers . . . . . . . . . . . : 8.8.8.8
8.8.8.8
8.8.4.4
NetBIOS over Tcpip. . . . . . . . : Enabled
It seems that the default gateway for the connection is not defined, which I think may be a part of the issue.
Can you see anything missing from my configuration? Anything odd?