Removed static host value and change it to set from the endpoint variable of wireguard config actualy
6 lines
203 B
Bash
Executable File
6 lines
203 B
Bash
Executable File
#!/bin/sh
|
|
|
|
ENDPOINT=$(cat /etc/wireguard/wg0.conf | grep Endpoint | awk '{print $3}' |cut -d ':' -f1)
|
|
IP_GATEWAY=$(route -n | grep 'UG[ \t]' | awk '{print $2}');
|
|
route add -host $ENDPOINT gw $IP_GATEWAY
|