docker-wireguard-vpn icon indicating copy to clipboard operation
docker-wireguard-vpn copied to clipboard

docker network is not being created

Open Arturro43 opened this issue 1 year ago • 5 comments

root@xxx:~# wireguard up
Error response from daemon: network docker-vpn0 not found
[ OK ]     conf file exists
[ OK ]     ip link add wg0 type wireguard
[ OK ]     wg setconf wg0 /etc/wireguard/wg0.conf
[FAIL]
root@xxx:~# wireguard status
Error response from daemon: network docker-vpn0 not found
Error response from daemon: network docker-vpn0 not found
[INFO]     Checking VPN Status:docker: Error response from daemon: network docker-vpn0 not found.
 DOWN
root@xxx:~# wireguard down
Error response from daemon: network docker-vpn0 not found
[ OK ]     ip link del wg0
[INFO]     Route/Rule/Network Does Not Exist. Creating ...
[ OK ]     ip rule add from table 200
[ OK ]     ip route add blackhole default metric 3 table 200
Error response from daemon: network docker-vpn0 not found
[INFO]     Checking VPN Status:docker: Error response from daemon: network docker-vpn0 not found.
 DOWN
root@xxx:~#

Arturro43 avatar Jul 31 '23 15:07 Arturro43

Please try the updated script and report back. Are you running the script as root? If you are still having an issue, please run the following from a term window and let me know the output:

docker network create docker-vpn0 --subnet 10.30.0.0/16 -o com.docker.network.driver.mtu=1420

BrodyBuster avatar Jul 31 '23 16:07 BrodyBuster

Thanks for the quick update, now wireguard status gives me vpn link down warning (works as intended)

I'll update you in 4-5 hours if now everything is okay

Arturro43 avatar Jul 31 '23 17:07 Arturro43

Regular VPN seems to work now, but using Cloudflare WARP+ (which uses IPv6) gives me error:

/usr/local/bin/wireguard: line 129: 2606:4700:110:XXXXX:XXXX:XXXX:XXXX:XXXX: command not found

Arturro43 avatar Aug 01 '23 05:08 Arturro43

Regular VPN seems to work now, but using Cloudflare WARP+ (which uses IPv6) gives me error:

/usr/local/bin/wireguard: line 129: 2606:4700:110:XXXXX:XXXX:XXXX:XXXX:XXXX: command not found

I did not write this with IPv6 in mind ... the issue is the way the script grep's for the IP address from the wireguard conf file, at least for starters.

interface_ip=$(grep Address /etc/wireguard/$dev_name.conf | awk '{print $3}' | cut -d/ -f1)

This is looking for a IPv4 address and needs to be corrected for IPv6. The first part of the command grep's for the "Address" field. Then grab the 3rd column. Finally the "cut -d/ -f1" removes the net mask from the field and stores the IP address as "interface_ip".

What's the Address portion of your wg0.conf file look like? If you need to, randomize the IP numbers as I am only interested in the format.

BrodyBuster avatar Aug 02 '23 15:08 BrodyBuster

Regular VPN seems to work now, but using Cloudflare WARP+ (which uses IPv6) gives me error:

/usr/local/bin/wireguard: line 129: 2606:4700:110:XXXXX:XXXX:XXXX:XXXX:XXXX: command not found

Also, I believe line 126: cmd="ip addr add $interface_ip dev $dev_name" would need to change to "cmd="ip -6 addr add $interface_ip dev $dev_name"

BrodyBuster avatar Aug 02 '23 15:08 BrodyBuster