From the output of ip addr show on the guest:
near enp023 (in my case):
inet 192.168.0.106/24 (...)
hence the guest IP is 192.168.0.106.
On host run:
sudo ip route add default via 192.168.0.106
I needed to delete the old default gateway:
ip route del default
sudo vim /usr/local/bin/set_gateway_route.sh
add
#!/bin/bash
# Remove existing default gateway
ip route del default 2>/dev/null
# Add the new default route
ip route add default via 192.168.0.106 dev enp5s0sudo chmod +x /usr/local/bin/set_gateway_route.sh
Now host routes through the guest:
➜ ~ traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 _gateway (192.168.0.106) 0.573 ms 0.551 ms 0.549 ms
2 192.168.0.1 (192.168.0.1) 1.021 ms 1.148 ms 1.154 ms
3 device.lan (192.168.1.254) 2.161 ms 2.173 ms 2.364 ms
(...)
When the VM is up, run the bash script. Check the results with ip route show. Expect line default via 192.168.0.106 where the IP is the guest's IP.
Now host routes through the VPN on the guest.