I use UFW and here is my setup:
eth0 is configured as a bridge interface (br0):
inet adr:10.0.4.10 Bcast:10.0.4.255 Mask:255.255.255.0
eth2 is connected to a private network:
inet adr:10.10.14.65 Bcast:10.10.14.71 Mask:255.255.255.248
I setup a route to 192.168.70.238 on ifup:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.70.238 10.10.14.66 255.255.255.255 UGH 0 0 0 eth2
A machine on the 10.0.4.0/24 side needs to access the computer at 192.168.70.238 on port 50417. SO, basically all I need is a port forwarding from 10.0.4.10:50417 to 192.168.70.238:50417
Here what I have added to my before.rules, at the very top:
#
# rules.before
#
# Rules that should be run before the ufw command line added rules. Custom
# rules should be added to one of these chains:
# ufw-before-input
# ufw-before-output
# ufw-before-forward
#
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Forward traffic from eth0 (br0) through eth2.
-A POSTROUTING -s 10.0.4.0/24 -o eth2 -j MASQUERADE
-A PREROUTING -i eth2 -p tcp --dport 50417 -j DNAT --to 192.168.70.238:50417
COMMIT
# Don't delete these required lines, otherwise there will be errors
But it is not working at all even after a server reboot. (I get a timeout)
What have I done wrong ?
Regards