I use a special documentation server which I always want to reach from my Mac without establishing an VPN connection. Why? Because I have to write documentations while I am in other VPN (L2TP or WireGuard) tunnels.
For this I need a permanent way to reach a predefined IP adress in my secure network. After a short talk with my college Samuel Oberhofer, we mentioned the solution using the CLI-Wireguard-Tool and YES this works perfectly.
You need the WireGuard Config file and you have to install wireguard-tools via brew with this command:
brew install wireguard-tools
now you can use „wg-quick“ with following options:
[up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
so with this command you start up the VPN
wg-quick up "PATH-TO-YOUR-CONFIG"
——————————————————
I created a start script for myself to make it easier to start all services I want to have. For this you just create an hidden folder in your home directory with
mkdir .wireguardconfig
and copy the configs you want to start into this folder
now you can create a script (don’t forget to use chmod +x) and add for example following:
#!/bin/bash
wg-quick up ~/.wireguardconfig/1020.conf
wg-quick up ~/.wireguardconfig/2100.conf
Now you can easily start the Wireguard VPN’s in the background with this script.
——————————————————
to install brew use following:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Take care that you do not use special characters in the config file or take too long file names. If you do, you get following error:
wg-quick: The config file must be a valid interface name, followed by .conf