Article 6Q4N0 Help need forwarding ports from one server to another

Help need forwarding ports from one server to another

by
GigaHacker
from LinuxQuestions.org on (#6Q4N0)
All, I am very green so please don't yell :) This is a HAM radio project.

I have two web servers (both port 80). One is on a public IP the other is behind a firewall that is only available via VPN. I need to make both available to the public. The VPN is working as expected. I THINK I have both firewalls disabled for now. I am using IPTABLES and DNAT but it is not working. This is what I have for code:

[public server]
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -p tcp --dport 8181 -j DNAT --to-destination 172.22.220.231:80

[private server]
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 172.22.158.218:8181

If I use:
sudo iptables -L -v -n -t nat

I do see traffic on both prerouting rules but it never comes back to my browser.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments