I have a Beaglebone back with two interfaces USB0 IP 192.168.9.1 and eth0 IP 192.168.5.1. I would like to route all IP traffic from USB0 to eth0 and visa-versa. I have set the following
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
ip route add 192.168.9.0/24 via 192.168.5.1 dev eth0
ip route add 192.168.5.1 via 192.168.9.1 dev usb0
also set net.ipv4.ip_forward=1
From a PC connected to USB0 i was able to ping eth0 on 192.168.5.1 but unable to see any messages sent from the host pc connected to USB0.