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

I have to Ubuntu servers:

Server 1 (IP:

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

Server 2 (IP:

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 ! -d -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

# On offline server
route add default gw

btw on both docker is installed (

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