We have 3 PCs, two of it are connected to internet (both of it have 2 NIC)
eth0 - 18.104.22.168 (external IP) eth1 - 172.16.0.1 (internal IP)
eth0 - 22.214.171.124 (external IP) eth1 - 172.16.0.2 (internal IP)
eth0 - 172.16.0.3 (internal IP)
Now we want to forward port 80 from PC1 and PC2 to PC3.
But there is the problem: iptables port forwarding works well from PC1 or PC2, but only in case if PC3 have PC1 or PC2 as gateway.
IPtables rules (for PC1):
iptables -t nat -A PREROUTING -p tcp -d 126.96.36.199 --dport 80 -j DNAT --to-destination 172.16.0.3:80 iptables -A FORWARD -p tcp -d 172.16.0.3 --dport 80 -j ACCEPT
So, question is: can we have port mapping from both PC1 and PC2 regardless of gateway settings on PC3?
Thank you in advance.