Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vpn_client [2024/01/27 23:57] – add note in tailscale setup section to access resources behind a tailscale subnet router csvpn_client [2024/08/27 10:28] (current) – added under construction note atari
Line 1: Line 1:
 +<WRAP center round todo>
 +Double-check for functionality. custom.sh has been depreciated. https://wiki.batocera.org/launch_a_script?rev=1724655769#customlast_during_startup_first_after_shutdown
 +</WRAP>
 +
 ====== OpenVPN client ====== ====== OpenVPN client ======
 You can easily connect your Batocera to a VPN, as we ship OpenVPN with the distribution. However, it requires some manual configuration, and the steps involved will most probably be depending on your VPN provider. You can easily connect your Batocera to a VPN, as we ship OpenVPN with the distribution. However, it requires some manual configuration, and the steps involved will most probably be depending on your VPN provider.
  
-In this example here, I will be connecting a Batocera 5.27 client to a [[https://nordvpn.com|NordVPN]] server, and adapt it to [[https://www.privateinternetaccess.com|PIA]] when possible. The method here can be adapted to other VPN providers quite easily, please feel free to share your experience on the forum of Discord channel.+In this example here, I will be connecting a Batocera 5.27client to a [[https://nordvpn.com|NordVPN]] server, and adapt it to [[https://www.privateinternetaccess.com|PIA]] when possible. The method here can be adapted to other VPN providers quite easily, please feel free to share your experience on the forum of Discord channel.
  
 ===== OpenVPN configuration ===== ===== OpenVPN configuration =====
Line 49: Line 53:
 #!/bin/bash #!/bin/bash
  
-if test "$1" != "start"+if test "$1" == "start"
 then then
-  exit 0+  openvpn /userdata/system/openvpn/<replace_me>.ovpn & 
 +elif test "$1" == "stop" 
 +then 
 +  killall -9 openvpn 
 +else 
 +  curl ipinfo.io 2>/dev/null  | jq -a '.ip, .city, .country' | tr '\n' ' ' | sed s:\"::g
 fi fi
-openvpn /userdata/system/openvpn/<replace_me>.ovpn &+
 </file> </file>
  
 where ''<replace_me>'' is your VPN. where ''<replace_me>'' is your VPN.
  
-===== Tips and tricks ===== +This ''custom.sh'' script will be started on boot. It can be stopped when called with ''custom.sh stop'' or, when called with no argument and just ''custom.sh'', it displays the current public IP address and city/country where you are connectedso that you can check if your VPN is active or not.
- +
-  * You can verify that you are correctly connected to the VPN by checking your public IP address before and after ''openvpn'' is started by using the command ''curl ipinfo.io'' or ''curl ifconfig.me'' +
-  * If you want to start up your VPN connection every time Batocera boots, you can add the command ''openvpn /userdata/system/openvpn/ovpn_udp/fr661.nordvpn.com.udp.ovpn &'' to the local custom startup script ''/userdata/system/custom.sh'' -- this will be the very last process fired up in the boot sequence+
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
Line 82: Line 88:
 #!/bin/bash #!/bin/bash
  
-if test "$1" != "start"+if test "$1" == "start"
 then then
-  exit 0+  (openvpn /userdata/system/openvpn/<replace me>.ovpn &) 2>&1 | tee -a /var/log/vpn.log 
 +elif test "$1" == "stop" 
 +then 
 +  killall -9 openvpn 
 +else 
 +  curl ipinfo.io 2>/dev/null  | jq -a '.ip, .city, .country' | tr '\n' ' ' | sed s:\"::g
 fi fi
  
-(openvpn /userdata/system/openvpn/<replace me>.ovpn &) 2>&1 | tee -a /var/log/vpn.log 
 </file> </file>
  
Line 99: Line 109:
 #!/bin/bash #!/bin/bash
  
-if test "$1" != "start"+if test "$1" == "start"
 then then
-  exit 0 +  if [ ! -d /dev/net ]; then 
-fi +    mkdir -p /dev/net  
- +    mknod /dev/net/tun c 10 200 
-if [ ! -d /dev/net ]; then +    chmod 600 /dev/net/tun 
-  mkdir -p /dev/net  +  fi 
-  mknod /dev/net/tun c 10 200 +  openvpn /userdata/system/openvpn/<replace me>.ovpn & 
-  chmod 600 /dev/net/tun+elif test "$1" == "stop" 
 +then 
 +  killall -9 openvpn 
 +else 
 +  curl ipinfo.io 2>/dev/null  | jq -a '.ip, .city, .country' | tr '\n' ' ' | sed s:\"::g
 fi fi
  
-openvpn /userdata/system/openvpn/<replace_me>.ovpn & 
 </file> </file>
  
  • vpn_client.1706399840.txt.gz
  • Last modified: 2 years ago
  • by cs