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 [2023/07/16 03:20] – Grammatical changes in the Tailscale section. markfeuervpn_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>
  
Line 132: Line 145:
 /userdata/tailscale/tailscaled -state /userdata/tailscale/state > /userdata/tailscale/tailscaled.log 2>&1 &/userdata/tailscale/tailscale up /userdata/tailscale/tailscaled -state /userdata/tailscale/state > /userdata/tailscale/tailscaled.log 2>&1 &/userdata/tailscale/tailscale up
 </file> </file>
 +
 +  * **IF YOU ARE ACCESSING RESOURCES BEHIND A TAILSCALE SUBNET ROUTER:** By default, Tailscale clients specifically for Linux do not accept routes advertised by subnet routers. If you wish to access resources in the subnet router's network, the ''tailscale up'' command needs an ''--accept-routes'' flag appended. [[https://tailscale.com/kb/1241/tailscale-up?q=--accept-routes|Tailscale Docs]]
 +  * Using the above script block as a reference, the last line will look like this if you want to enable this feature:
 +
 +<code>
 +/userdata/tailscale/tailscaled -state /userdata/tailscale/state > /userdata/tailscale/tailscaled.log 2>&1 &/userdata/tailscale/tailscale up --accept-routes
 +</code>
  
   * **IF YOU ARE USING AN ARM SBC:** You need to use WinSCP or another program with this function to check that the tailscale and tailscaled files in /userdata/tailscale have the execute permission. Go to that directory and right click on both files, then click "Properties." Make sure to check the checkboxes for "Owner" and "Group" marked "X," then hit OK.   * **IF YOU ARE USING AN ARM SBC:** You need to use WinSCP or another program with this function to check that the tailscale and tailscaled files in /userdata/tailscale have the execute permission. Go to that directory and right click on both files, then click "Properties." Make sure to check the checkboxes for "Owner" and "Group" marked "X," then hit OK.
  • vpn_client.1689477612.txt.gz
  • Last modified: 3 years ago
  • by markfeuer