Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
Network Troublshooting => General Networking Support in Linux => Topic started by: ask2me on July 19, 2009, 02:49:23 AM
-
Iam a newbie in linux.Recently i tried iptables portforwarding feature in my linux router.I have alreay running a firewall script.
I tested a the portforwarding command
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -o eth1 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p udp --dport 8081 -j DNAT --to 192.168.10.99:8081
iptables -A FORWARD -i eth0 -p udp --dport 8081 -d 192.168.1.99 -j ACCEPT
But when i tested from outside to connect to the internal machine 192.168.10.99 port 8081, i couldnt.Iam pinned on this problem for the last one month.Kindly give me the reason for not working.
How can i exactly settle the problem.Iam using ubuntu 8.04 with a mailserver installed on it.
Thanks in advance
-
Just use command given below.
#iptables -t nat -A PREROUTING -i eth0 -p udp --dport 8081 -j DNAT --to-destination 192.168.10.99:8081
#iptables -t nat -A POSTROUTING -s 192.168.10.99 -o eth0 -j MASQUERADE
I think there is problem with the return traffic. This might solve your problem. To troubleshoot the exact issue you have to use tcpdump with the port and check what heppen.