Port redirecting with IPtables
I have 1 server is still running with web service and reverse proxy service. My server also have 2 IPs.
Web service with port: 80 Reverse proxy service with port: 6060 IP: 1.2.3.4 and 5.6.7.8 So, I want config with iptables to redirect port, example: Code:
iptables -t nat -A PREROUTING -p tcp --dport 80 ! -s 1.2.3.4 -j REDIRECT --to-ports 6060 Yes, it's time second rule not effective. I don't want to re-config web service to listen other port. Thank all read. |
Quote:
You mention that you're running a web server on port 80. Should this server be accessed directly rather than through the proxy service? If so, and if 1.2.3.4 is assigned to eth0 and 5.6.7.8 to eth1, this should work: Code:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 ! -d 1.2.3.4 -j REDIRECT --to-ports 6060 |
All times are GMT -5. The time now is 07:01 PM. |