My goal is to create a VPN so
- Clients have static IP addresses.
- Clients are able to communicate with each other and the server,
- Clients can reach global Internet through the VPN.
- Also, I'd like to setup DNS and private domain names (working with NginX).
Here is config of the server:
[Interface] Address = 10.0.0.1/24 ListenPort = 5555 PrivateKey = xxxxx [Peer] PublicKey = xxxxx AllowedIPs = 0.0.0.0/0
And client's config:
[Interface] PrivateKey = xxxxx ListenPort = 5555 Address = 10.0.0.2/32 DNS = 188.8.131.52 [Peer] PublicKey = xxxxx AllowedIPs = 0.0.0.0/0, ::/0 Endpoint = <server ip>:5555
But when I'm trying to load server's config
wg setconf wg0 /etc/wireguard/wg0.conf I get this error:
Line unrecognized: `Address=10.0.0.1/24' Configuration parsing error
Thus I commented this line. But it probably makes WG choose random IP addresses for the server and clients.
To make WireGuard work, I also ran these commands:
ip link add dev wg0 type wireguard ip address add dev wg0 10.0.0.1/24 ip link set up dev wg0
wg commands provides the following output:
interface: wg0 public key: xxxxx private key: (hidden) listening port: 5555 peer: xxxxx endpoint: <my IP address>:6228 allowed ips: 0.0.0.0/0 latest handshake: 2 minutes, 11 seconds ago transfer: 26.02 KiB received, 248 B sent
From the client (which is MacOS with WireGuard GUI) I'm able to connect, but:
- I get no Internet connection. I even can't ping the server by global IP address, though I can with the private one,
- I'm able to get connected to VPN even if I change the port in client's config. I think it means that it doesn't really get connected.
So, how can I achieve my goals? And what's wrong with my configs??
iptables nor firewalls are installed on the server, so it can't be a problem. Also, I have specified
net.ipv6.conf.all.forwarding=1 in the
Software versions. OS is
Ubuntu 18.04.4 LTS, Kernel:
Address from server's config, and set
AllowedIPs = 10.0.0.2/24 in the client's one, I finally got connected to the server's NginX from client by private IP, and able to reach the Internet (coz traffic goes outside VPN).
But if I set
AllowedIPs = 0.0.0.0/0 on the client, I have no Internet access, though still can reach server by VPN's IP address 10.0.0.1. I tried solving it with
ifconfig wg0 broadcast/multicast, but had no success. Now the command
ip address show wg0 provides the following output:
4: wg0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000 link/none inet 10.10.10.1/24 scope global wg0 valid_lft forever preferred_lft forever inet 10.10.10.1 peer 10.10.10.2/32 scope global wg0 valid_lft forever preferred_lft forever
In addition, I cannot access one client from another, I think it's the same problem. How can I fix WireGuard configs or server network settings to solve the problem?