Simple Linux routing using iptables

Network diagram

Set route on ubuntu-1

ip route add 192.168.58.0/24 via 192.168.57.3 dev enp0s3
    

Set routing on ubuntu-2

iptables -t nat -A POSTROUTING -s 192.168.57.0/24 -o enp0s8 -j MASQUERADE