Skip to content

Wireguard connects but does not work

Hello

i have a problem with wireguard(client) on arch linux

i have installed three packages to use wireguard :wireguard-dkms, wireguard-tools, networkmanager-wireguard-git

i also use systemd-resolved for my dns

​

i can connect to a wireguard server but internet connection without any error apperently disconnects after connecting to a wireguard server and internet connection comes back if i disconnect

i don't think the problem is because the dns server because i can't ping IPs too

i tried connecting to them using "wg-quick" command and Gnome's networkmanager gui

but i got indentical results

3 points4 comments
Open on Reddit
About this post
Posted
Archived
Score
3 · 100% up
Kind
Text
ID
f44cmb

Author

26
posts
23
comments
7
media
View profile

4 comments

i had problems with wireguard as well, what i ended up doing is

  • using dhcpcd (as a service)
  • using NetworkManager to put interfaces up/down (nmcli)
  • starting wireguard with sudo (use nmcli for this and not wg up) important part here is starting it with sudo, nmcli will bring up interfaces without sudo but this will (probably) just mess with things and your internet will not work so always use sudo to bring up things.

some commands to keep in mind

  • for dhcpcd
  • sudo systemctl start dhcpcd.service -- start dhcpcd service (this will most likely also bring up your normal network interface as well)
  • sudo systemctl stop dhcpcd.service -- stop (deactivate) dhcpcd
  • sudo systemctl enable dhcpcd.service -- will add it to services
  • sudo systemctl disable dhcpcd.service -- will prevent it from restarting.
  • For nmcli:
  • sudo nmcli connection up your_normal_interface_here
  • sudo nmcli device disconnect your_normal_interface_here
  • sudo nmcli connection up wireguard_vpn_name_here
  • sudo nmcli device disconnect wireguard_vpn_name_here

take a look at wireguard-in-networkmanager for help with NetworkManager and wireguard, very nice post/guide for setting up wireguard and also editing interfaces using NetworkManager.

2 points

I connect with just wg-quick and it works fine, using NM, but with No NM config or git file, using the first two packages you listed, and the key files from my vpn provider. Works fine on Arch and Fedora 31. Pls update with your solution when found. Good luck!

2 points

If you want all your traffic go through the server, in the wg client config you should have in the peer section (server):

AllowedIPs = 0.0.0.0/0, ::/0

In the server the wg config needs some iptables rules in the interface section and ip forwarding enabled at os level.

#replace eth name and wg name
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o ens3 -j MASQUERADE

sysctl

net.ipv4.ip_forward = 1
1 points

I just installed it this morning and I am amazed! Easy, fast (oh my) and integrates nicely in my net config. All my traffic on all my devices enrypted. Always. Really a lovely piece of software!

SaveConfig = true

Is nice, if you add a peer, it directly gets written to the config file!

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.