I have two networks, one being the main, with a network card eth1 (found on an Ubuntu Server 18.04 configured to be a router) and internal IP address 192.168.5.1 (with is the gateway) and another network in different location, but connected together via a link provided by the internet service provider, with an interface card named ethx1, also on an Ubuntu Machine configured to be a router, and an internal IP address 192.168.6.1 (which is equally the gateway). Each Ubuntu machine has a second network interface card. The Ubuntu machine resident on the main network has eth2 as the second NIC with an internal IP address of 192.168.5.2. The Ubuntu machine on the other network has ethx2 with an internal IP address of 192.168.6.2.
I would like to use iptables to forward packets between the two networks. How do I do this? Currently, I cannot ping into either network directly.