I created a home VPN using OpenVPN and a second raspberry pi (different Pi, located at home and acting as a server), and have the hotspot-pi connect to the OpenVPN-pi (at home) using OpenVPN as a client.
The server's IP address is 10.10.10.83, and the local network subnet is 10.10.10.0/24
Edit: I have Completed part 1, 2 and 3 of Ingo's Answer. I get OpenVPN to start and connect to the server successfully.
However where myMy issues arise are:
- Once connected to the OpenVPN-pi, all devices connected to the hotspot-pi loose internet access.
- Only the hotspot-pi is able to ping the OpenVPN -pi at 10.8.0.1 or any IP's in the server's local network> no longer an issue
- Only the hotspot-pi retains the ability to connect to internetpiHotspot can ping 10.8.0.1(PiVPNServer), none of the attached devices to the hotspot retain internetPiVPNServer can ping 10. Only when disconnecting to the VPN does internet return for the devices8.0.2(piHotspot) only, no pinging any other device in their subnets
- Re-allow internet access to devices connected to the Hotspot-pi while it is connected to VPN. -> done
- Allow devices in the server side network (OpenVPN-pi at home) to see devices attached to hotspot-pi (client VPN side on the field)
- The ability to ping or ssh from any device on the server side to any devices on the client side.
Result of ip addr on the PiVPN Server:Result of ip addr on the PiVPN Server:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:fa:a5:b9 brd ff:ff:ff:ff:ff:ff
inet 10.10.10.83/824 brd 10.25510.25510.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::d187ba27:36d0ebff:fc8efefa:f762a5b9/64 scope link
valid_lft forever preferred_lft forever
3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100
link/none
inet 10.8.0.1/24 brdpeer 10.8.0.2552/32 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::20fea40b:5e736a36:93cd264:15ebc63d/64 scope link stable-privacy
valid_lft forever preferred_lft forever
Result of ip route in the PiVPN server:Result of ip route in the PiVPN server:
default via 10.10.10.1 dev eth0 src 10.10.10.83 metricproto 202static
10.08.0.0/82 dev eth0tun0 proto dhcpkernel scope link src 10.108.100.83 metric 2021
10.810.010.0/24 dev tun0eth0 proto kernel scope link src 10.810.010.183
Result of systemctl status [email protected]Result of systemctl status [email protected]
● [email protected] - OpenVPN connection to server
Loaded: loaded (/lib/systemd/system/[email protected]; enabled-runtime;enabled; vendor preset: enabled)
Active: active (running) since MonWed 2019-11-18 20 21:4341:0738 EST; 10min ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Main PID: 421329 (openvpn)
Status: "Initialization Sequence Completed"
Tasks: 1 (limit: 2200)
Memory: 2.8M5M
CGroup: /system.slice/system-openvpn.slice/[email protected]
└─421└─329 /usr/sbin/openvpn --daemon ovpn-server --status /run/openvpn/server.status 10 --cd /etc/openvpn --config /etc/openvpn/server.conf --writepid /run/openvpn/server.pidse
Nov 18 20 21:5141:0938 piVPNPiVPNServer ovpn-server[421]: 24.114.69.217:59077 Control Channelserver[329]: TLSv1.2, cipher TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 256 bitTUN/TAP EC,device curve:tun0 prime256v1opened
Nov 18 20 21:5141:0938 piVPNPiVPNServer ovpn-server[421]server[329]: 24.114.69.217:59077/sbin/ip [piHotspot]link Peerset Connectiondev Initiatedtun0 withup [AF_INET]24.114.69.217:59077mtu
Nov 18 20 21:5141:0938 piVPNPiVPNServer ovpn-server[421]server[329]: piHotspot/24.114.69.217:59077sbin/ip MULTI_sva:addr pooladd returneddev IPv4=10.8.0.2,tun0 IPv6=(Notlocal enabled)1
Nov 18 20 21:5141:0938 piVPNPiVPNServer ovpn-server[421]openvpn[329]: piHotspot/24.114.69.217Error:59077 MULTI:Invalid Learn:prefix 10.8.0.2for ->given piHotspot/24.114.69.217:59077prefix
Nov 18 20 21:5141:0938 piVPNPiVPNServer ovpn-server[421]server[329]: piHotspot/24.114.69.217:59077 MULTIERROR: primary virtualLinux IProute foradd piHotspot/24.114.69.217:59077:command 10.8.0.2fai
Nov 18 20 21:5141:1038 piVPNPiVPNServer ovpn-server[421]: piHotspot/24.114.69.217server[329]:59077 PUSH:Could Receivednot controldetermine message:IPv4/IPv6 'PUSH_REQUEST'prot
Nov 18 20 21:5141:1038 piVPNPiVPNServer ovpn-server[421]server[329]: piHotspot/24.114.69.217:59077UDPv4 SENTlink CONTROLlocal [piHotspot](bound): 'PUSH_REPLY,dhcp-option DNS 8.8.8.8,dhcp-option DNS 8.8.4.4,block-outside-dns,redirect-gateway def1,route-gateway 10.8.0.1,topology subnet,ping 1800,ping-restart 3600,ifconfig 10.8.0.2 255.255.255.0,peer-id 0,cipher AES-25[AF_INET
Nov 18 20 21:5141:1038 piVPNPiVPNServer ovpn-server[421]server[329]: piHotspot/24.114.69.217:59077UDPv4 Datalink Channelremote: using negotiated cipher 'AES-256-GCM'[AF_UNSPEC]
Nov 18 20 21:5143:1053 piVPNPiVPNServer ovpn-server[421]: piHotspot/24.114.69.217:59077 Outgoing Data Channelserver[329]: CipherPeer 'AES-256-GCM'Connection initializedInitiated with 256 bit key[AF
Nov 18 20 21:5143:1054 piVPNPiVPNServer ovpn-server[421]: piHotspot/24.114.69.217:59077 Incoming Data Channelserver[329]: Cipher 'AES-256-GCM' initialized with 256Initialization bitSequence keyCompleted
Result of ip addr in piHotspot (client):Result of ip addr in piHotspot (client):
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master br0 state DOWN group default qlen 1000
link/ether b8:27:eb:3f:0e:89 brd ff:ff:ff:ff:ff:ff
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 8a:ea:17:87:3f:87 brd ff:ff:ff:ff:ff:ff
inet 192.168.50.1/24 brd 192.168.50.255 scope global br0
valid_lft forever preferred_lft forever
inet6 fe80::88ea:17ff:fe87:3f87/64 scope link
valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether b8:27:eb:6a:5b:dc brd ff:ff:ff:ff:ff:ff
inet6 fe80::ba27:ebff:fe6a:5bdc/64 scope link
valid_lft forever preferred_lft forever
5: ppp0tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3100
link/pppnone
inet 2510.1098.2360.1552 peer 10.8.0.1/32 scope global ppp0tun0
valid_lft forever preferred_lft forever
inet6 fe80::31c0:593e:d389:b8b7/64 scope link flags 800
valid_lft forever preferred_lft forever
6: tun0ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1003
link/noneppp
inet 1025.8108.0227.2234/24 brd 10.8.0.25532 scope global tun0
valid_lft forever preferred_lft forever
inet6 fe80::c280:60ee:ad54:2cbb/64 scope link flags 800 ppp0
valid_lft forever preferred_lft forever
Result of ip route on piHotspot (client):Result of ip route on piHotspot (client):
0.0.0.0/1 via 10.8.0.1 dev tun0
default via 25.109108.236227.155234 dev ppp0 proto static
10.8.0.0/241 dev tun0 proto kernel scope link src 10.8.0.2
10.17610.010.0/1624 via 2510.1098.2360.1551 dev ppp0 proto statictun0
10.254176.0.0/16 via 25.109108.236227.155234 dev ppp0 proto static
(my IP address) via 25.109.236.155 dev ppp0
12810.0254.0.0/116 via 1025.8108.0227.1234 dev tun0ppp0 proto static
192.168.50.0/24 dev br0 proto kernel scope link src 192.168.50.1
Result of systemctl status [email protected]I think here there should be a call to my server's ip address no?
Result of systemctl status [email protected]
● [email protected] - OpenVPN connection to piHotspot
Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since MonWed 2019-11-18 20 21:4941:3025 EST; 10min16min ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 342290 ExecStart=/usr/sbin/openvpn --daemon ovpn-piHotspot --status /run/openvpn/piHotspot.status 10 --cd /etc/openvpn --config /etc/openvpn/piHotspot.conf --writepid /run/openvpn/piHotspot.pid (code=exited, status=0/SUCCESS)
Main PID: 380323 (openvpn)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/system-openvpn.slice/[email protected]
└─380└─323 /usr/sbin/openvpn --daemon ovpn-piHotspot --status /run/openvpn/piHotspot.status 10 --cd /etc/openvpn --config /etc/openvpn/piHotspot.conf --writepid /run/openvpn/piHotspot.pid
Nov 18 20 21:5142:1005 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: ROUTE_GATEWAYwrite 25.109.236.155/255.255.255.255UDP: IFACE=ppp0Network HWADDR=00:00:00:00:00:00is unreachable (code=101)
Nov 18 20 21:5142:1015 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: TUN/TAPwrite deviceUDP: tun0Network openedis unreachable (code=101)
Nov 18 20 21:5142:1025 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: TUN/TAP TXwrite queueUDP: lengthNetwork setis tounreachable 100(code=101)
Nov 18 20 21:5142:1036 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: do_ifconfig,write tt->did_ifconfig_ipv6_setup=0UDP: Network is unreachable (code=101)
Nov 18 20 21:5142:1046 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: /sbin/ip link setwrite devUDP: tun0Network upis mtuunreachable 1500(code=101)
Nov 18 20 21:5142:1056 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: /sbin/ip addr addwrite devUDP: tun0Network 10.8.0.2/24is broadcastunreachable 10.8.0.255(code=101)
Nov 18 20 21:5143:1007 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: /sbin/ipwrite routeUDP: addNetwork (myis IPunreachable address(code=101) via 25.109.236.155
Nov 18 20 21:5143:1017 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: /sbin/ipwrite routeUDP: addNetwork 0.0.0.0/1is viaunreachable 10.8.0.1(code=101)
Nov 18 20 21:5143:1045 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: /sbin/ip routePeer addConnection 128.0.0.0/1Initiated viawith 10[AF_INET](MY.8IP.0ADDR.1ESS):1194
Nov 18 20 21:5143:1045 RPiHotspotRPiNet ovpn-piHotspot[380]piHotspot[323]: Initialization Sequence Completed
Update: Nov 1420, 2019
I am able to ping server and client from each other, I can ping devices attached to the server's local network but I cannot ping devices attached to using the hotspot network10. I'd prefer it the other way for my specific use8. In fact I'd like to be able to ssh or control any devices in the client's network from the server0.
Devices attached to the client loose internet connection when I establish the vpn tunnel0 subnets (10. The moment8.0.1 10.8.0.2), But now I stophave lost the service, internet is back upability to ping other devices in each other's networks.
Lastly,I have gained internet connection back from attached devices while the VPN is enabled in the client/server files, they both have a tun set not a tap, won't this explain why I can't get an IP Address the same as my server's local network?.