Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Subdomain Redirection
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Taevin
n00b
n00b


Joined: 09 Feb 2005
Posts: 6

PostPosted: Fri Mar 04, 2005 10:05 pm    Post subject: Subdomain Redirection Reply with quote

What I would like to be able to do is redirect subdomains to different PCs on my internal network. That is, say I have mydomain.com registered, I would like all traffic on server1.mydomain.com sent to say, 192.168.1.20 and all traffic on server2.mydomain.com sent to say, 192.168.1.30. The tricky part is, of course, that I have only one external IP address. Is there ANY way to do this?

It doesn't matter what I have to use to do this if it is possible and I don't mind doing my own research, I just need to know where to start. From what I can tell, iptables can only route from the external IP address to different internal IP addresses based on ports and Apache virtual hosting only works with HTTP traffic right? Any information would help me a lot, even if it's "you can do it but you'll have to spend thousands of dollars doing it with x, y, and z."
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Fri Mar 04, 2005 11:19 pm    Post subject: Reply with quote

This will not work. Some protocols don't even use or send the DNS name when they connect.

For example SMTP:

server 1:
ip: 1.2.3.4
fqdn: server1.mydomain.com

server 2:
ip: 1.2.3.4
fqdn: server2.mydomain.com

Now if a client or a server connect to server2.mydomain.com, then the SMTP server lissening at 1.2.3.4 does not know anything about to what fqdn you connected. Techicaly it could be server1.mydomain.com or server2.mydomain.com.


cheers

SteveB
Back to top
View user's profile Send private message
rang3r
n00b
n00b


Joined: 09 Jun 2004
Posts: 25

PostPosted: Wed Apr 13, 2005 4:34 am    Post subject: Reply with quote

Sorry if this post is too old. I ran across it and thought I would try to help.

Actually if I understand the question right, you could use mod_proxy which is included in apache2 to do this.

Example:

test.domain.com
test2.domain.com

both domains point to the same IP address on DNS

On one of the servers try something like this:

<VirtualHost *.80>
ServerName test.domain.com
DocumentRoot /var/www/localhost/htdocs
</VirtualHost>

<VirtualHost *.80>
ServerName test2.domain.com
ProxyPass / http://server2.local/
ProxyPassReverse / http://server2.local/
</VirtualHost>

This would direct all traffic going to test2.domain.com to a second server internally at http://server2.local.

Hope this helps.
_________________
rang3r
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum