EDIT: READ UPDATE BELOW
I have two interfaces on a remote linux machine, wlan1 and eno1. Both machines are connected via the wlan1 192.168.1.0/24 network. I have a router connected to eno1 as 192.168.2.1.
I would like to connect from my macbook (192.168.1.x) via this remote machine 192.168.1.y.
I have configured a wireguard server on this remote machine.
[Interface]
PrivateKey = privkey
Address = 10.0.0.1/32
ListenPort = 51900
[Peer]
PublicKey = peerpubkey
AllowedIPs = 10.0.0.2/32, 192.168.2.0/24
and am connecting with the following client config
[Interface]
PrivateKey = privkey
Address = 10.0.0.2/32
DNS = 192.168.1.102 #address of pihole
[Peer]
PublicKey = pubkey
AllowedIPs = 192.168.1.0/24, 10.0.0.0/24
Endpoint = 192.168.1.y:51900
PersistentKeepalive = 20
I then ran this
sudo ip route add 192.168.2.0/24 via 192.168.2.1 dev eno1
and several other variations of ip route commands, none of which seemed to not work. (they are now flushed from the table)
Essentially, I would like to forward incoming requests to 192.168.2.0/24 from the 10.0.0.0 wg0 interface.
I know this configuration is not optimal, but I require this configuration for the convenience of repeated testing purposes. I need to access this device via the ethernet connection from my desktop and would like to be able to do so remotely but am unfamiliar with how to achieve this with linux routing tables.
Thank you!
EDIT: UPDATE:
I kinda just said screw it and did the work I needed to on the router via VNC on the remote host and abandoned the wireguard approach. However, after getting a shell on the device I realized I was not able to run dumpcap, tshark, tcpdump etc on the router due to RAM and disk limitations (I would prefer not running swap on a usb drive…) This means I will now have to direct traffic from 192.168.2.1 br-lan on the router back to the 192.168.2.2 eno1 host to be captured for later analysis. Any ideas?