Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Apr 18, 2009 11:57 pm 
Offline
Senior Newbie

Joined: Sat Apr 18, 2009 11:33 pm
Posts: 7
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


Top
   
 Post subject:
PostPosted: Sun Apr 19, 2009 3:45 am 
Offline
Junior Member

Joined: Sun Nov 16, 2008 4:35 am
Posts: 38
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.


Top
   
 Post subject:
PostPosted: Wed Apr 22, 2009 1:51 am 
Offline
Senior Member

Joined: Mon Feb 02, 2009 1:43 am
Posts: 67
Website: http://fukawi2.nl
Location: Melbourne, Australia
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.


Top
   
 Post subject:
PostPosted: Wed Apr 22, 2009 12:24 pm 
Offline
Senior Newbie

Joined: Sat Apr 18, 2009 11:33 pm
Posts: 7
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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group