Hi im hoping I can get a bit of help to save me from tearing my hair out
I have recently purchased a VPN (SurfShark) and want to get it set up to run on my raspberry pi 3b running a fresh install of OSMC
I followed their generic instructions for setting up OpenVPN and am able to use putty to access command line and get the service up and running I think. (instructions below)
Install the necessary packages by entering the command:
sudo apt-get install openvpn unzip
If you are requested to enter your password, please enter your computer’s admin password.
To see the list of all the available servers enter:
ls
Choose one of the servers from the server list and connect to Surfshark by entering:
sudo openvpn [file name]
OpenVPN will ask you for service credentials.
You have successfully connected to Surfshark if in the Terminal logs you can see “Initialization Sequence Completed”.
To disconnect from the OpenVPN connection simply open terminal and press Ctrl + C.
My first query is once I start the service I see the message “Initialization Sequence Completed”.
but I no longer have a command line to test if its working is this how it should be? if I did this through the terminal directly on osmc could I get osmc to start up again?
Secondly as far as I can tell it disconnects as soon as I disconnect the putty session
is there a way I can make it auto start when the pi starts up?
I have read various articles but have seen a lot of conflicting information and I think things may have changed in how its done so I am confused. Any help at all would be greatly appreciated.
You need to edit the relevant .ovpn file and change the line auth-user-pass to auth-user-pass userpass. Then in /etc/openvpn (using sudo) create a file userpass and add two lines:
username
password
substituting your own username and password. (I’ve called the file userpass but you can use anything you want.) Change permission on the file so it’s only readable by root:
unfortunately already tried that still didn’t work
I followed the guide from here and can now start a service and get it to start when I reboot.
Problem is there is no internet connection when I do I am getting “curl: (6) Could not resolve host: ipinfo.io”
There was a suggestion at the bottom of here that it could be a dns problem so I fixed that with the dns from my provider but still same issue.
I’m sorry to be a pain but I have been at this since Thursday and have got no further and I would really like to understand it as I eventually want to set up my pi zero-w and pi 4 with the same thing
if I sudo service OpenVPN stop and then run curl ipinfo.io I get my actual ip and location etc
Do you want to use Brian Hornsby’s add-on, which allows control though the Kodi interface, or do you simply want OpenVPN to run automatically at startup?
If you want an evidence-based analysis, rather than just a wild guess, we need logs.
Jul 07 21:25:00 osmc-Mortimer ovpn-client[323]: RESOLVE: Cannot resolve host address: ie-dub.prod.surfshark.com:1194 (Name or service not known)
This is happening because at this point in the startup sequence, there is still no network. You should enable “Wait for Network” in My OSMC > Network anf reboot.
Jul 07 22:16:10 osmc-Mortimer ovpn-client[298]: PUSH: Received control message: 'PUSH_REPLY,dhcp-option DNS 162.252.172.57,dhcp-option DNS 149.154.159.92,redirect-gateway def1,sndbuf 524288,rcvbuf 524288,explicit-exit-notify,block-outside-dns,route-gateway 10.8.8.1,topology subnet,ping 60,ping-restart 180,ifconfig 10.8.8.2 255.255.255.0,peer-id 0,cipher AES-256-GCM'
contains the directive block-outside-dns as well as dhcp-option DNS 162.252.172.57,dhcp-option DNS 149.154.159.92.
If you can ping 8.8.8.8, I’m guessing that this is blocking your DNS somehow. Unfortunately, I’m out of time for today. If @Tom_Doyle is still around, perhaps he can help with the installation/configuration of resolvconf or openresolv – or it’ll have to wait until tomorrow.
From what I can tell from looking at the config files, this is being pushed by the server; unfortunately it looks this option is Windows specific. A possible work around is to use openresolv as @dillthedog suggested. Please try:
sudo apt-get install openresolv
and the the following to the bottom of your chosen .opvn file (Or .conf file if you created on of these):
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Hopefully dns will work now and you should be able to access the internet using surfsharks’s dns servers.
ok so I tried to ping 8.8.8.8 and it works no packet loss
I installed openresolve and updated the bottom of my conf file with the script rebooted pi and still get the error curl 6 could not resolve host ipinfo.io