Absolutely!
---------- My Raspberry Pi sits inside my home network, its config:
eth0: IP: 192.168.200.11 GW: 192.168.200.1 IPv6: enabled (prefix delegation from ISP) Metric: 300
wlan0: IP: 192.168.209.11 GW: 192.168.209.1 IPv6: enabled (prefix delegation from ISP) Metric: 400
wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1420 inet 10.241.0.1 netmask 255.255.255.0 destination 10.241.0.1 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC) RX packets 37100 bytes 44690744 (44.6 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 17505 bytes 4748492 (4.7 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Wireguard config: root@dns1:~# cat /etc/wireguard/wg0.conf [Interface] ## This Desktop/client's private key ## PrivateKey = <removed>
## Client ip address ## Address = 10.241.0.1/24
[Peer] ## Ubuntu 20.04 server public key ## PublicKey = <removed>
## set ACL ## AllowedIPs = 10.241.0.0/24
## Your Ubuntu 20.04 LTS server's public IPv4/IPv6 address and port ## Endpoint = <My VPS Public IPv4 IP>:51820
## Key connection alive ## PersistentKeepalive = 15
ubuntu@dns1:~$ sudo wg interface: wg0 public key: <removed> private key: (hidden) listening port: 53514
peer: <removed> endpoint: <My VPS Public IPv4 IP>:51820 allowed ips: 10.241.0.0/24 latest handshake: 33 seconds ago transfer: 42.68 MiB received, 4.79 MiB sent persistent keepalive: every 15 seconds ubuntu@dns1:~$
----------
My VPS hosted externally: eth0: DHCP from VPS provider with IPv4/6(public IP, ie not NAT)
wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1420 inet 10.241.0.3 netmask 255.255.255.0 destination 10.241.0.3 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC) RX packets 16739 bytes 4405736 (4.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 36539 bytes 44736120 (44.7 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@m21:~# cat /etc/wireguard/wg0.conf [Interface] Address = 10.241.0.3/24 SaveConfig = true ListenPort = 51820 FwMark = 0xca6c PrivateKey = <removed>
[Peer] PublicKey = <removed> AllowedIPs = 10.241.0.1/32, 192.168.200.0/24, 192.168.209.0/24, 192.168.210.0/24, 192.168.211.0/24, 192.168.212.0/24 Endpoint = <My home public IPv4 IP>:33962 root@m21:~#
root@m21:~$ sudo wg interface: wg0 public key: <removed> private key: (hidden) listening port: 51820 fwmark: 0xca6c
peer: <removed> endpoint: <My home public IPv4 IP>:53514 allowed ips: 10.241.0.1/32, 192.168.200.0/24, 192.168.209.0/24, 192.168.210.0/24, 192.168.211.0/24, 192.168.212.0/24 latest handshake: 1 minute, 36 seconds ago transfer: 5.33 MiB received, 42.91 MiB sent root@m21:~$
Absolutely!
----------
My Raspberry Pi sits inside my home network, its config:
eth0:
IP: 192.168.200.11
GW: 192.168.200.1
IPv6: enabled (prefix delegation from ISP)
Metric: 300
wlan0:
IP: 192.168.209.11
GW: 192.168.209.1
IPv6: enabled (prefix delegation from ISP)
Metric: 400
wg0: flags=209< UP,POINTOPOINT, RUNNING, NOARP> mtu 1420 00-00-00- 00-00-00- 00-00-00- 00-00-00- 00 txqueuelen 1000 (UNSPEC)
inet 10.241.0.1 netmask 255.255.255.0 destination 10.241.0.1
unspec 00-00-00-
RX packets 37100 bytes 44690744 (44.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 17505 bytes 4748492 (4.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Wireguard config: wg0.conf
root@dns1:~# cat /etc/wireguard/
[Interface]
## This Desktop/client's private key ##
PrivateKey = <removed>
## Client ip address ##
Address = 10.241.0.1/24
[Peer]
## Ubuntu 20.04 server public key ##
PublicKey = <removed>
## set ACL ##
AllowedIPs = 10.241.0.0/24
## Your Ubuntu 20.04 LTS server's public IPv4/IPv6 address and port ##
Endpoint = <My VPS Public IPv4 IP>:51820
## Key connection alive ##
PersistentKeepalive = 15
ubuntu@dns1:~$ sudo wg
interface: wg0
public key: <removed>
private key: (hidden)
listening port: 53514
peer: <removed>
endpoint: <My VPS Public IPv4 IP>:51820
allowed ips: 10.241.0.0/24
latest handshake: 33 seconds ago
transfer: 42.68 MiB received, 4.79 MiB sent
persistent keepalive: every 15 seconds
ubuntu@dns1:~$
----------
My VPS hosted externally:
eth0: DHCP from VPS provider with IPv4/6(public IP, ie not NAT)
wg0: flags=209< UP,POINTOPOINT, RUNNING, NOARP> mtu 1420 00-00-00- 00-00-00- 00-00-00- 00-00-00- 00 txqueuelen 1000 (UNSPEC)
inet 10.241.0.3 netmask 255.255.255.0 destination 10.241.0.3
unspec 00-00-00-
RX packets 16739 bytes 4405736 (4.4 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 36539 bytes 44736120 (44.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@m21:~# cat /etc/wireguard/ wg0.conf
[Interface]
Address = 10.241.0.3/24
SaveConfig = true
ListenPort = 51820
FwMark = 0xca6c
PrivateKey = <removed>
[Peer]
PublicKey = <removed>
AllowedIPs = 10.241.0.1/32, 192.168.200.0/24, 192.168.209.0/24, 192.168.210.0/24, 192.168.211.0/24, 192.168.212.0/24
Endpoint = <My home public IPv4 IP>:33962
root@m21:~#
root@m21:~$ sudo wg
interface: wg0
public key: <removed>
private key: (hidden)
listening port: 51820
fwmark: 0xca6c
peer: <removed>
endpoint: <My home public IPv4 IP>:53514
allowed ips: 10.241.0.1/32, 192.168.200.0/24, 192.168.209.0/24, 192.168.210.0/24, 192.168.211.0/24, 192.168.212.0/24
latest handshake: 1 minute, 36 seconds ago
transfer: 5.33 MiB received, 42.91 MiB sent
root@m21:~$