Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't track wg0. Status shows off even when wg0 is on. Turning on throws 'wg0 already exists' error #604

Open
stompbeat opened this issue Feb 6, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@stompbeat
Copy link

stompbeat commented Feb 6, 2025

Description:
WGDashbard shows that wg0 Status is off even though it is turned on. When I click the toggle it throws 'wg-quick: wg0 already exists' message and I'm unable to track the usage. I can see all the peers.

When I fully restart wireguard and wgd with the following commands and then toggle the Status to 'On' for wg0, the Dashboard throws 'wg0 is off' server message and brings the toggle back to 'Off' status. But 'wg show' command on the server shows that wg0 is running. If I click on Status toggle to 'On' again, it says 'wg-quick: wg0 already exists' message.
Commands I used to shut down wireguard and restart WGD:
./wgd.sh stop
sudo systemctl stop wg-quick@wg0
sudo systemctl disable wg-quick@wg0
wg-quick down wg0
./wg.sh start

State:

  • I had wireguard previously installed.
  • 'Toggle When Start Up' is enabled for wg0 but the problem persists when when disabled.
  • Configuration file wg0.conf was previously present.
  • I was using WGD version 4.1 before but now I'm on 4.2-dev. This problem persists on BOTH versions.
  • I haven't created any other config files yet

Dashboard Run:
./wgd.sh start

OS Information:

  • No container
  • GCP VM
  • OS: Ubuntu 20.04.4 LTS
  • Python Version: 3.10.16

Configuration File:
[Interface]
MTU = 1360
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens4 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens4 -j MASQUERADE
ListenPort = 51820
PrivateKey =

[Peer]
PublicKey =
AllowedIPs = 10.0.0.2/32

[Peer]
PublicKey =
AllowedIPs = 10.0.0.3/32

[Peer]
PublicKey =
AllowedIPs = 10.0.0.4/32

[Peer]
PublicKey =
AllowedIPs = 10.0.0.5/32

@stompbeat stompbeat added the bug Something isn't working label Feb 6, 2025
@DaanSelen
Copy link
Collaborator

When the bug happens what is the output of wg show?

@stompbeat
Copy link
Author

stompbeat commented Feb 6, 2025

When the bug happens what is the output of wg show?

Nothing changes on wg show.

If wireguard is fully shut down, and I change the status to 'On' on WGDashboard, wg show displays wg0 interface as active, however, Status toggle goes back to 'Off' quickly after displaying the server message as 'wg-quick: wg0 is off'. Yet that toggle action does turn on wg0.

If wg show is already indicating that wg0 interface is on, toggling the status only displays 'wg-quick: wg0 already exists' as a message and never goes to the 'On' state. The dashboard also doesn't provide any tracking data for the interface as well as the peers.

@donaldzou
Copy link
Owner

Hi! Sorry for the delayed reply. Could you help confirm the following:

  • What would happen if you do sudo wg-quick up wg0, then sudo wg and do you see wg0 is up?
  • Can you try to run WGDashboard in debug mode with ./wgd.sh debug and try to toggle the configuration, and see if there's any errors pop up?

@stompbeat
Copy link
Author

Here's the result

`root@vpn-server-backup-1:~/WGDashboard/src# ./wgd.sh debug

[WGDashboard] WireGuard is already installed.
[WGDashboard] Starting WGDashboard in the foreground.
[WGDashboard] Initialized Configuration: wg0
[WGDashboard] Autostart Configuration: wg0
[WGDashboard] Background Thread #1 Started
[WGDashboard] Background Thread #2 Started

  • Serving Flask app 'WGDashboard'
  • Debug mode: off
    WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
  • Running on all addresses (0.0.0.0)
  • Running on hidden
  • Running on hidden
    Press CTRL+C to quit
    hidden - - [10/Feb/2025 18:35:48] "GET / HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:48] "GET /api/locale HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:49] "GET /api/getDashboardVersion HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:49] "GET /api/getDashboardTheme HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:49] "GET /api/isTotpEnabled HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:53] "POST /api/authenticate HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:53] "GET /api/validateAuthentication HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:54] "GET /api/getDashboardConfiguration HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:54] "GET /static/app/dist/assets/index-BKNwSldE.css HTTP/1.1" 304 -
    hidden - - [10/Feb/2025 18:35:54] "GET /static/app/dist/assets/index-BA3gShnI.js HTTP/1.1" 304 -
    hidden - - [10/Feb/2025 18:35:54] "GET /static/app/dist/assets/configurationList-CWcGXYWr.css HTTP/1.1" 304 -
    hidden - - [10/Feb/2025 18:35:54] "GET /static/app/dist/assets/configurationList-BjpbRiKk.js HTTP/1.1" 304 -
    hidden - - [10/Feb/2025 18:35:55] "GET /api/getWireguardConfigurations HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:55] "GET /api/getDashboardUpdate HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:35:58] "GET /api/toggleWireguardConfiguration/?configurationName=wg0 HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:36:05] "GET /api/getWireguardConfigurations HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:36:15] "GET /api/getWireguardConfigurations HTTP/1.1" 200 -
    hidden - - [10/Feb/2025 18:36:25] "GET /api/getWireguardConfigurations HTTP/1.1" 200 -

root@vpn-server-backup-1:/WGDashboard/src# sudo wg-quick up wg0
Warning: /etc/wireguard/wg0.conf' is world accessible wg-quick: wg0' already exists
root@vpn-server-backup-1:
/WGDashboard/src# sudo wg
interface: wg0
public key: hidden
private key: (hidden)
listening port: 51820

peer: hidden
allowed ips: 10.0.0.2/32

peer: hidden
allowed ips: 10.0.0.3/32

peer: hidden
allowed ips: 10.0.0.4/32

peer: hidden
allowed ips: 10.0.0.5/32`

@donaldzou
Copy link
Owner

This seems normal.. What if you run ifconfig, do you see wg0 in the list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants