I'm having a hard time figuring out how to set this up right. I can barely formulate a google query that explains it, so I'll try to do my best.
I have a Ubuntu PC with two NIC cards.
eth0 (192.168.1.0) goes to the main default gateway and out to the internet, and
eth1 (192.168.176.0) goes to a network switch with a bunch of IP cams connected to it.
I've enabled IP forwarding and iptables rules and hosts on the router PC. Hosts inside the eth1 network can reach the internet and can reach other hosts on the eth0 network. So this is good.
What I'm trying to do now, is get hosts inside the eth0 network to be able to access the hosts inside the eth1 network.
The computers are on eth0 network but the network cameras are on eth1 network. A single computer with two NIC cards acts as the bridge. Ultimately I want the computers on eth0 to be able to see the IP cameras on eth1.
Trying to map it out: hosts on 192.168.1.1 should be able to see hosts on 192.168.176.1 but can't.
hosts on 192.168.176.1 CAN see hosts on 192.168.1.1 (these hosts can also get out to the internet). So all good here.
So far I have these IP rules and these have allowed the eth1 network to get out.
iptables --table nat --append POSTROUTING --out-interface enp1s0 -j MASQUERADE iptables --append FORWARD --in-interface enp3s0 -j ACCEPT
I guess my question is: how can the eth0 network get to hosts in the eth1 network?
Do I have to add routes on the individual computers that want to access the eth1 network?
Do I need to set up forwarding between the eth0 & eth1 interfaces on the router PC?
Here's my current add route command, /etc/network/interfaces and iptables rules:
(On macos:) sudo route -n add -net 192.168.176.0/24 192.168.1.1
(on two-NIC PC) /etc/network/interfaces #primary interface enp3s0 auto enp1s0 iface enp1s0 inet static address 192.168.1.12 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 dns-nameservers 18.104.22.168 22.214.171.124
#secondary interface enp3s0 auto enp3s0 iface enp3s0 inet static address 192.168.176.1 netmask 255.255.255.0 broadcast 192.168.176.255 network 192.168.176.0
(on two-NIC PC) iptables -t filter -A FORWARD -i enp1s0 -o enp3s0 -j ACCEPT iptables -t filter -A FORWARD -i enp3s0 -o enp1s0 -j ACCEPT iptables -t nat -A POSTROUTING -j MASQUERADE