Hello,
I am trying to setup a VPN (Openvpn on Ubuntu)so that I can access windows shares on my desktop (Windows 7) while I am away on my laptop (Windows 7) from public access points.
This diagram illustrates my scenario:
I have bought the OpenVPN cookbook and I read and tried some recipes which I thought would accomplish this but with no success.
My router is a
Netgear N150, I plan to upgrade to a linux computer for my router which will also run openvpn but that is down the road a bit still.
Here are my config files:
Currently using example3-1-client.conf on the client, I converted it to .ovpn:
client
proto udp
remote vpn.example.com
port 1194
dev tap
nobind
ca "c:/program files (x86)/openvpn/config/ca.crt"
cert "c:/program files (x86)/openvpn/config/ruffin-mobile1.crt"
key "c:/program files (x86)/openvpn/config/ruffin-mobile1.key"
;tls-auth "c:/program files (x86)/openvpn/config/ta.key" 1 # I commented this line out because the connection would not establish at all with it< I don't know why.
ns-cert-type server
And example3-1-server.conf:
tls-server
proto udp
port 1194
dev tap
server 192.168.99.0 255.255.255.0
ca /etc/openvpn/cookbook/ca.crt
cert /etc/openvpn/cookbook/server.crt
key /etc/openvpn/cookbook/server.key
dh /etc/openvpn/cookbook/dh1024.pem
;tls-auth /etc/openvpn/cookbook/ta.key 0 # Again, commented out because the connection wouldn't establish.
persist-key
persist-tun
keepalive 10 60
push "route 192.168.160.0 255.255.0.0"
user nobody
group nogroup
daemon
log-append /var/log/openvpn.log
I can connect with this config but I cannot ping the remote lan:
pinging the VPN server's tap0 address from the remote client wroteC:\Users\Rick>ping 192.168.99.1
Pinging 192.168.99.1 with 32 bytes of data:
Reply from 192.168.99.1: bytes=32 time=1297ms TTL=64
Reply from 192.168.99.1: bytes=32 time=550ms TTL=64
Reply from 192.168.99.1: bytes=32 time=246ms TTL=64
Reply from 192.168.99.1: bytes=32 time=231ms TTL=64
Ping statistics for 192.168.99.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 231ms, Maximum = 1297ms, Average = 581ms
pinging the vpn server's eth0 address from the remote client wroteC:\Users\Rick>ping 192.168.160.99
Pinging 192.168.160.99 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.160.99:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
pinging my desktop on the server side lan from the server wrote# ping -c 4 192.168.160.11
PING 192.168.160.11 (192.168.160.11) 56(84) bytes of data.
From 192.168.160.1: icmp_seq=1 Redirect Host(New nexthop: 192.168.160.11)
64 bytes from 192.168.160.11: icmp_req=1 ttl=128 time=0.746 ms
64 bytes from 192.168.160.11: icmp_req=2 ttl=128 time=0.375 ms
64 bytes from 192.168.160.11: icmp_req=3 ttl=128 time=0.387 ms
64 bytes from 192.168.160.11: icmp_req=4 ttl=128 time=0.391 ms
--- 192.168.160.11 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3000ms
rtt min/avg/max/mdev = 0.375/0.474/0.746/0.158 ms
Here are the entries in /var/log/openvpn.log for today:
server log wroteFri Aug 3 08:11:43 2012 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 30 2012
Fri Aug 3 08:11:43 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 3 08:11:43 2012 TUN/TAP device tap0 opened
Fri Aug 3 08:11:43 2012 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Aug 3 08:11:43 2012 /sbin/ifconfig tap0 192.168.99.1 netmask 255.255.255.0 mtu 1500 broadcast 192.168.99.255
Fri Aug 3 08:11:43 2012 GID set to nogroup
Fri Aug 3 08:11:43 2012 UID set to nobody
Fri Aug 3 08:11:43 2012 UDPv4 link local (bound): [undef]
Fri Aug 3 08:11:43 2012 UDPv4 link remote: [undef]
Fri Aug 3 08:11:43 2012 Initialization Sequence Completed
Fri Aug 3 08:11:46 2012 75.232.78.181:58484 Re-using SSL/TLS context
Fri Aug 3 08:11:49 2012 75.232.78.181:58484 [ruffin-mobile1] Peer Connection Initiated with [AF_INET]75.232.78.181:58484
Fri Aug 3 08:11:49 2012 ruffin-mobile1/75.232.78.181:58484 MULTI_sva: pool returned IPv4=192.168.99.2, IPv6=149a:3300:b04d:c821::b04d:c821
Fri Aug 3 08:11:51 2012 ruffin-mobile1/75.232.78.181:58484 send_push_reply(): safe_cap=960
Fri Aug 3 08:28:26 2012 event_wait : Interrupted system call (code=4)
Fri Aug 3 08:28:26 2012 /sbin/ifconfig tap0 0.0.0.0
SIOCSIFADDR: Permission denied
SIOCSIFFLAGS: Permission denied
Fri Aug 3 08:28:26 2012 Linux ip addr del failed: external program exited with error status: 255
Fri Aug 3 08:28:26 2012 SIGTERM[hard,] received, process exiting
Fri Aug 3 08:28:27 2012 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 30 2012
Fri Aug 3 08:28:27 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 3 08:28:27 2012 TUN/TAP device tap0 opened
Fri Aug 3 08:28:27 2012 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Aug 3 08:28:27 2012 /sbin/ifconfig tap0 192.168.99.1 netmask 255.255.255.0 mtu 1500 broadcast 192.168.99.255
Fri Aug 3 08:28:27 2012 GID set to nogroup
Fri Aug 3 08:28:27 2012 UID set to nobody
Fri Aug 3 08:28:27 2012 UDPv4 link local (bound): [undef]
Fri Aug 3 08:28:27 2012 UDPv4 link remote: [undef]
Fri Aug 3 08:28:27 2012 Initialization Sequence Completed
Fri Aug 3 08:29:26 2012 75.232.78.181:61169 Re-using SSL/TLS context
Fri Aug 3 08:29:30 2012 75.232.78.181:61169 [ruffin-mobile1] Peer Connection Initiated with [AF_INET]75.232.78.181:61169
Fri Aug 3 08:29:30 2012 ruffin-mobile1/75.232.78.181:61169 MULTI_sva: pool returned IPv4=192.168.99.2, IPv6=149a:c000:b05d:6722::b05d:6722
Fri Aug 3 08:29:32 2012 ruffin-mobile1/75.232.78.181:61169 send_push_reply(): safe_cap=960
Fri Aug 3 11:01:25 2012 75.203.235.128:57042 Re-using SSL/TLS context
Fri Aug 3 11:01:27 2012 75.203.235.128:57042 [ruffin-mobile1] Peer Connection Initiated with [AF_INET]75.203.235.128:57042
Fri Aug 3 11:01:27 2012 MULTI_sva: pool returned IPv4=192.168.99.2, IPv6=6868:6722:405e:6a22::
Fri Aug 3 11:01:30 2012 ruffin-mobile1/75.203.235.128:57042 send_push_reply(): safe_cap=960
Fri Aug 3 11:36:52 2012 event_wait : Interrupted system call (code=4)
Fri Aug 3 11:36:52 2012 /sbin/ifconfig tap0 0.0.0.0
SIOCSIFADDR: Permission denied
SIOCSIFFLAGS: Permission denied
Fri Aug 3 11:36:52 2012 Linux ip addr del failed: external program exited with error status: 255
Fri Aug 3 11:36:52 2012 SIGTERM[hard,] received, process exiting
Options error: --route-delay cannot be used with --mode server
Use --help for more information.
Fri Aug 3 13:20:31 2012 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 30 2012
Fri Aug 3 13:20:31 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 3 13:20:32 2012 TUN/TAP device tap0 opened
Fri Aug 3 13:20:32 2012 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Aug 3 13:20:32 2012 /sbin/ifconfig tap0 192.168.99.1 netmask 255.255.255.0 mtu 1500 broadcast 192.168.99.255
Fri Aug 3 13:20:32 2012 GID set to nogroup
Fri Aug 3 13:20:32 2012 UID set to nobody
Fri Aug 3 13:20:32 2012 UDPv4 link local (bound): [undef]
Fri Aug 3 13:20:32 2012 UDPv4 link remote: [undef]
Fri Aug 3 13:20:32 2012 Initialization Sequence Completed
Fri Aug 3 13:21:02 2012 event_wait : Interrupted system call (code=4)
Fri Aug 3 13:21:02 2012 /sbin/ifconfig tap0 0.0.0.0
SIOCSIFADDR: Permission denied
SIOCSIFFLAGS: Permission denied
Fri Aug 3 13:21:02 2012 Linux ip addr del failed: external program exited with error status: 255
Fri Aug 3 13:21:02 2012 SIGTERM[hard,] received, process exiting
Options error: --route-delay cannot be used with --mode server
Use --help for more information.
Fri Aug 3 13:21:49 2012 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 30 2012
Fri Aug 3 13:21:49 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 3 13:21:49 2012 TUN/TAP device tap0 opened
Fri Aug 3 13:21:49 2012 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Aug 3 13:21:49 2012 /sbin/ifconfig tap0 192.168.99.1 netmask 255.255.255.0 mtu 1500 broadcast 192.168.99.255
Fri Aug 3 13:21:49 2012 GID set to nogroup
Fri Aug 3 13:21:49 2012 UID set to nobody
Fri Aug 3 13:21:49 2012 UDPv4 link local (bound): [undef]
Fri Aug 3 13:21:49 2012 UDPv4 link remote: [undef]
Fri Aug 3 13:21:49 2012 Initialization Sequence Completed
Fri Aug 3 13:22:00 2012 173.233.182.245:55099 Re-using SSL/TLS context
Fri Aug 3 13:22:00 2012 173.233.182.245:55099 [ruffin-mobile1] Peer Connection Initiated with [AF_INET]173.233.182.245:55099
Fri Aug 3 13:22:00 2012 ruffin-mobile1/173.233.182.245:55099 MULTI_sva: pool returned IPv4=192.168.99.2, IPv6=146a:8600:b0ad:a121::b0ad:a121
Fri Aug 3 13:22:02 2012 ruffin-mobile1/173.233.182.245:55099 send_push_reply(): safe_cap=960
Fri Aug 3 14:57:32 2012 75.232.189.11:58880 Re-using SSL/TLS context
Fri Aug 3 14:57:35 2012 75.232.189.11:58880 [ruffin-mobile1] Peer Connection Initiated with [AF_INET]75.232.189.11:58880
Fri Aug 3 14:57:35 2012 MULTI_sva: pool returned IPv4=192.168.99.2, IPv6=68b8:a121:3035:a521::
Fri Aug 3 14:57:38 2012 ruffin-mobile1/75.232.189.11:58880 send_push_reply(): safe_cap=960
client log wroteFri Aug 03 13:21:57 2012 OpenVPN 2.2.2 Win32-MSVC++ [SSL] [LZO2] [PKCS11] built on Dec 15 2011
Fri Aug 03 13:21:57 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 03 13:21:57 2012 UDPv4 link local: [undef]
Fri Aug 03 13:21:57 2012 UDPv4 link remote: 173.233.182.245:1194
Fri Aug 03 13:21:57 2012 [Ruffin-VPN] Peer Connection Initiated with 173.233.182.245:1194
Fri Aug 03 13:21:59 2012 TAP-WIN32 device [tap-bridge] opened: \\.\Global\{23AC5212-207C-49F0-9E9B-634E1ED78E48}.tap
Fri Aug 03 13:21:59 2012 Notified TAP-Win32 driver to set a DHCP IP/netmask of 192.168.99.2/255.255.255.0 on interface {23AC5212-207C-49F0-9E9B-634E1ED78E48} [DHCP-serv: 192.168.99.0, lease-time: 31536000]
Fri Aug 03 13:21:59 2012 Successful ARP Flush on interface [22] {23AC5212-207C-49F0-9E9B-634E1ED78E48}
Fri Aug 03 13:22:04 2012 WARNING: potential route subnet conflict between local LAN [192.168.160.0/255.255.255.0] and remote VPN [192.168.0.0/255.255.0.0]
Fri Aug 03 13:22:04 2012 Warning: address 192.168.160.0 is not a network address in relation to netmask 255.255.0.0
Fri Aug 03 13:22:04 2012 ROUTE: route addition failed using CreateIpForwardEntry: The parameter is incorrect. [status=87 if_index=22]
The route addition failed: The parameter is incorrect.
Fri Aug 03 13:22:04 2012 Initialization Sequence Completed
Fri Aug 03 14:57:27 2012 [Ruffin-VPN] Inactivity timeout (--ping-restart), restarting
Fri Aug 03 14:57:27 2012 ROUTE: route deletion failed using DeleteIpForwardEntry: The parameter is incorrect.
The route deletion failed: Element not found.
Fri Aug 03 14:57:27 2012 SIGUSR1[soft,ping-restart] received, process restarting
Fri Aug 03 14:57:29 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Fri Aug 03 14:57:29 2012 UDPv4 link local: [undef]
Fri Aug 03 14:57:29 2012 UDPv4 link remote: 173.233.182.245:1194
Fri Aug 03 14:57:33 2012 [Ruffin-VPN] Peer Connection Initiated with 173.233.182.245:1194
Fri Aug 03 14:57:35 2012 TAP-WIN32 device [tap-bridge] opened: \\.\Global\{23AC5212-207C-49F0-9E9B-634E1ED78E48}.tap
Fri Aug 03 14:57:35 2012 Notified TAP-Win32 driver to set a DHCP IP/netmask of 192.168.99.2/255.255.255.0 on interface {23AC5212-207C-49F0-9E9B-634E1ED78E48} [DHCP-serv: 192.168.99.0, lease-time: 31536000]
Fri Aug 03 14:57:35 2012 Successful ARP Flush on interface [22] {23AC5212-207C-49F0-9E9B-634E1ED78E48}
Fri Aug 03 14:57:40 2012 Warning: address 192.168.160.0 is not a network address in relation to netmask 255.255.0.0
Fri Aug 03 14:57:40 2012 ROUTE: route addition failed using CreateIpForwardEntry: One or more arguments are not correct. [status=160 if_index=22]
The route addition failed: The parameter is incorrect.
Fri Aug 03 14:57:40 2012 Initialization Sequence Completed
Forwarding is enabled.
If I have forgotten anything or you need anything else to make a suggestion please ask me for it.
Eagerly awaiting your suggestions! Thanks! 🙂