# B has 2 network interaces, A reachable through one, C reachable through other
# We want A to C communiation (over B)
A----B----C
# on A
ip route add C_SUBNET/24 via B_IP
# e.g. ip route add 192.168.1.0/24 via 192.168.0.B_ADDRESS
# on B
sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s A_SUBNET/24 -j MASQUERADE
# e.g. sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE