LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-19-2006, 12:19 AM   #1
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Rep: Reputation: 31
Routing to a server based on subdomain


I'm in the process of selecting a package/distro to use as a border router. I was wondering if the following is generally supported by most routers, and whether there is a specific name for it:

I currently have jasonantman.com redirecting to jantman.dyndns.org:10011 because not only do I have a dynamic IP, but my ISP seems to block incoming requests on port 80.

I have two Apache servers running internally, one "saturn" as 192.168.0.6 and one "testbed" on 192.168.0.9.

At the moment, I have the subdomain testbed.jasonantman.com (just taken offline this week) redirected to jantman.dyndns.org:10012

Is there any way that I can have them both redirect to jantman.dyndns.org:10011 and then have the router (once it is setup) "know" to route requests for testbed.jasonantman.com to 192.168.0.9 and all others to 192.168.0.6?

Will the fact that I use dyndns.org to redirect my domain screw this up?

Thanks,
Jason
 
Old 10-19-2006, 02:14 AM   #2
Galaxy_Stranger
Member
 
Registered: Oct 2003
Distribution: CentOS 6 and Fedora
Posts: 252

Rep: Reputation: 36
Apache can recieve traffic for virtual hosts on the same port and distinguish them based on host name. And you should be able to do redirects from there.

I'm doing basically the same thing, only I haven't tried it with both hosts using the same port, so I'm not sure it'll work without extra tweaking.

I wonder if you'd need to run your own dns server...
 
Old 10-23-2006, 04:59 PM   #3
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by Galaxy_Stranger
Apache can recieve traffic for virtual hosts on the same port and distinguish them based on host name. And you should be able to do redirects from there.
Perhaps you misunderstood me. I want this ROUTER side so that they go to DIFFERENT PHYSICAL MACHINES. Can routing software (free, linux-based) do this?

I.e. I have four physical webserver boxes that need to remain seperate. Right now, I have the router seperate them by port, and have them mapped to different WAN ports.

Is there any way I can do away with the ports, and have the ROUTER tell that HTTP requests to testbsed.mydomain.com should be forwarded to the LAN host 192.168.0.9, requests to webint.mydomain.com go to 192.168.0.8, and everything else to 192.168.0.6?
 
Old 10-27-2006, 09:32 PM   #4
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
If you setup a linux router share out the server directories on the servers then mount them to shares on the router run Apache on the router and redirect the sub domains to the shares, only way I think of it right now
 
Old 10-28-2006, 02:12 PM   #5
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
But that's not redirecting to different SERVERS - say I have one subdirectory on Server A running apache, another on Server B running an embedded webserver... etc.

Is there any ruleset for a router that filters by the REQUESTED URL from an HTTP request?
 
Old 10-28-2006, 03:14 PM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Sorry to sound dumb, but wouldn't it be simpler to leave the two redirects to different ports (10011 and 10012) and use port redirection on the router to two different machines based on the ports?

I think any firewall type solution is going to use DNS to resolve, not any domain name information in the packet, hence the apache suggestion above
 
Old 10-31-2006, 10:09 AM   #7
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
Yes, it would be simpler to do that.

But at the moment, because of this, I have about six different HTTP ports open.

I wasn't looking for a simple solution, I was wondering whether there was any sort of packet-inspection router out there that could handle this.
 
Old 10-31-2006, 12:07 PM   #8
Galaxy_Stranger
Member
 
Registered: Oct 2003
Distribution: CentOS 6 and Fedora
Posts: 252

Rep: Reputation: 36
The simplest thing to do is to put them all on one machine and just use virtual hosts, using either multiple ports or host names.
 
Old 11-18-2006, 09:02 PM   #9
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
found a possible workaround, if you can get your DNS to make the subdomain a webhop tn set your router to forward traffic on a given port to a server and you make the webhop address http://www.yourmainname.comortforthesubdomain

i.e. alex.scheidel21.net webhops to www.scheidel21.net:1005

My router gets the request for port 1005 and forwards it to the computer that has the alex data on it, forwarding to data to port 80 on that machine.
 
Old 11-20-2006, 07:08 PM   #10
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
The webhop address got cut... seems like there's an emoticon in the middle...
 
Old 11-20-2006, 08:22 PM   #11
scheidel21
Senior Member
 
Registered: Feb 2003
Location: CT
Distribution: Debian 6+, CentOS 5+
Posts: 1,323

Rep: Reputation: 100Reputation: 100
Along the lines of what I did with cerebrus.scheidel21.net if you paste that into your web browser it should to hop to ftp://scheidel21.net:21 for ftp service. I don't have any web servers running right now or I would have given you an example exactly like yours, but you can specify the port number in your webhop. give it a bit to propogate too as I just set it up five minutes ago.
 
Old 11-21-2006, 12:16 AM   #12
Roddles
LQ Newbie
 
Registered: Nov 2005
Location: Sydney Australia
Distribution: Gentoo
Posts: 14

Rep: Reputation: 0
Question Content Based Routing in Linux

Sorry - wrong thread ....

Last edited by Roddles; 11-21-2006 at 12:21 AM.
 
Old 11-21-2006, 06:13 AM   #13
Sertys
Member
 
Registered: Oct 2006
Posts: 42

Rep: Reputation: 15
If you really need to do real packet routing to the separate machines, you can always use the string match from the netfilter framework and DNAT onwards. But still - be really careful with how you set string match rules, it's really resource hungry and cpu intensive.
 
Old 12-04-2006, 11:08 AM   #14
jantman
Member
 
Registered: Nov 2005
Location: New Jersey, USA
Distribution: SuSE
Posts: 492

Original Poster
Rep: Reputation: 31
Hmmm... sounds a bit above my head, but I'll keep it into mind.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Routing from OpenVPN server jjge Linux - Networking 1 08-29-2006 10:34 AM
Port based routing neos Linux - Networking 1 09-21-2005 02:15 PM
help with policy based routing GaijinPunch Linux - Networking 4 06-19-2005 07:35 PM
subdomain in the dns server bind c0nsur Linux - Software 4 03-29-2005 05:11 PM
question on flow-based routing cainiao Linux - Networking 1 08-20-2004 07:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration