I have wireguard installed on three devices:
- an iOS device connected to the internet using LTE
- a laptop connected to the internet using WiFi(behind NAT)
- a remote server with static IP
So far my config looks as below. Currently both devices (laptop an ios device) have their internet traffic routed through the aws instance.
Is it possible to route the internet traffic from my laptop through the iOS device? As far as I understand WireGuard has the concept of peers not "servers" so it shouldn't be hard to have the internet routed through another peer than the endpoint "peer".
Remote Server
IP forwarding is enabled
$ cat wg0.conf
[Interface]
#DNS = 8.8.8.8
## Private IP address for the wg0 interface ##
Address = 10.0.0.1
## VPN server listening port ##
ListenPort = 51820
## VPN server private key ##
PrivateKey = *****
## Firewall rules ##
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
AllowedIPs = 10.0.0.3
PublicKey = *****
[Peer]
PublicKey = *****
AllowedIPs = 10.0.0.2
Laptop
[Interface]
PrivateKey = ****
Address = 10.0.0.3/32
DNS = 8.8.8.8
[Peer]
PublicKey = ****
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 134.21.111.111:51820 # redacted
PersistentKeepalive = 5
iOS Device
[Interface]
PrivateKey = ****
Address = 10.0.0.2/32
DNS = 8.8.8.8
[Peer]
PublicKey = ****
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 134.21.111.111:51820 # redacted
PersistentKeepalive = 5