networking – Use online VM as default Gateway (Jump box)

I have to Ubuntu servers:

Server 1 (IP: 192.168.10.11)

is online and connect to two network interface (internal, public)

Server 2 (IP: 192.168.10.10)

with no public access (internal)

now I am trying to use server1 as a default gateway for server2, and this is what I’ve done:

# on online server (Jumpbox)
iptables -t nat -A POSTROUTING -s 192.168.10.10 ! -d 192.168.30.1/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

# On offline server
route add default gw 192.168.10.11

btw on both docker is installed (172.17.0.0)

They can ping each other, but from server2 not possible to ping google.