Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Question on iptables and port forwarding



Hi all

I have two machines on the same local network, 192.168.2.6 and 192.168.2.7
and I want to forward say TCP connections to 192.168.2.7:12345 to 192.168.2.6:80
(just for the hell of it, it's Friday ;) ).

All available sources indicate I should be doing something like this
(on 192.168.2.7):

iptables -A PREROUTING  -i eth0 -t nat -p tcp --dport 12345 -m state
--state NEW,ESTABLISHED,RELATED -j DNAT --to 192.168.2.6:80
iptables -A FORWARD -i eth0 -p tcp --dport 80 -m state --state
NEW,ESTABLISHED,RELATED -j ACCEPT

but accessing 192.168.2.7:12345 just results in a timeout.

Both machines are running recent standard Ubuntu installations and
as far as I can tell, IP forwarding is enabled.

root@example.com:~# cat /proc/sys/net/ipv4/ip_forward
1

No other iptables rules exist on either of the machines.

Any ideas what I am doing wrong? Could it be a problem that for the
desired setup, 192.168.2.7 is not forwarding from one interface to another?

Thanks for any hints (this kind of stuff is not really my forte)


Ian Barwick


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links