troubleshooting Question

iptables port forwarding not working

Avatar of greenftechn
greenftechn asked on
LinuxLinux Networking
4 Comments1 Solution859 ViewsLast Modified:
I want to port forward to a computer on my LAN. I am using iptables on an unbuntu dapper drake (LTS 6.06) server that functions as gateway, webserver and (to my LAN) DHCP server. I flush both nat and iptables and start from scratch:

   iptables -A PREROUTING -t nat -p tcp --dport 5500 -i eth0 -j DNAT --to-destination 192.168.0.15:5500

   iptables -I FORWARD 1 -d 192.168.0.15 -p tcp --dport 5500 -j ACCEPT

Then I add my "regular" NAT capabilities:

   iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
   iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED
      -j ACCEPT
   iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

The above is not working. I verify this using t4eportping, a command line utility. I also try using UltraVNC viewer in listen mode, the purpose for the forward in the first place. It doesn't work.

I run:

   iptables -L

Output:

   Chain INPUT (policy ACCEPT)
   target     prot opt source               destination

   Chain FORWARD (policy ACCEPT)
   target     prot opt source               destination
   ACCEPT     tcp  --  anywhere             192.168.0.15        tcp dpt:5500
   ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
   ACCEPT     all  --  anywhere             anywhere

   Chain OUTPUT (policy ACCEPT)
   target     prot opt source               destination

Is there another place, other than iptables, where port forwarding must be enabled?

If not, why is the above not working?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros