| Linode Forum https://forum.linode.com/ |
|
| Two IP's and forward a port - help. https://forum.linode.com/viewtopic.php?f=19&t=4126 |
Page 1 of 1 |
| Author: | pic.micro23 [ Sat Apr 18, 2009 11:57 pm ] |
| Post subject: | Two IP's and forward a port - help. |
Hello, I'm new with iptables but I would like some pointers. My linode has two ip addresses (ipA and ipB) and I have two processes that I want to expose using port 80 (internally the process run as processA:80 and processB:8080) So I would like to do this ipA:80 -> processA:80 (webserver) ipB:80 -> processB:8080 (test custom webserver) Any info is appriciated... be gentle Thanks |
|
| Author: | nknight [ Sun Apr 19, 2009 3:45 am ] |
| Post subject: | |
There is no reason for iptables to be involved here. Ports are IP-specific, not system-wide. You need to bind your webserver to a specific IP address/port combination rather than blindly binding to all IPs on the system. Check the documentation for the webserver daemon you're using. If it's Apache, it's the 'Listen' directive you'll want to read about. |
|
| Author: | fukawi2 [ Wed Apr 22, 2009 1:51 am ] |
| Post subject: | |
As mentioned, you should be able to get the server(s) to bind on the same port with different IP's... But if you can't (for whatever reason): Code: iptables -t nat -A PREROUTING -p tcp -m tcp -d XXX.XXX.XXX.XXX --dport 80 -j REDIRECT --to-ports 8080 Replace XXX.XXX.XXX.XX with your second IP. |
|
| Author: | pic.micro23 [ Wed Apr 22, 2009 12:24 pm ] |
| Post subject: | |
Thanks a lot Nknight,Fukawi2. I used the example of webserver port 80 becuase i thought somebody had run in to it before. BUT that helped understand what the solution was. I'm using a piece of code that does not have a way to bind to a specific IP (it will be fixed). But now I have a temp solution using iptables until it's fixed. Thanks for answering these basic questions which made me realized what the real problem was and the temp solution. |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|