run openvpn in client mode automatically after linux boot
Context: Remote raspberry pi model b rev1, all setup with raspberry os / raspbian.
the hardware specs are nothing much, but the machine is reliable, even when apparently half the ram chips are dead.
- Install openvpn from the distro’s repository
- Take the config file from the server you want to connect to - in my case an ovpn file generated by pivpn - and put it into the config folder
/etc/openvpn/
. - if your vpn profile is password protected, add a textfile with the cleartext pass and reference it in your vpn profile file like so:
askpass /etc/openvpn/passwordfilename
- make sure
openvpn.service
is started and enabled.systemctl enable openvpn && systemctl restart openvpn
ip a
should show you the tunnel interface already.
NB: for the routing, make sure that your that your router has a static entry that sends all the traffic to the vpn subnet to the vpn server, but that is something that depends really on your own net topology.