Jump to content

Routing traffic based off Domain Name?

ionbasa

So does anyone know how to do this? 

I have 2 FQDNs pointed to one server running Ubuntu. That server is running two virtual machines. I want example1.com pointed to VM1 and example2.net pointed to VM2. 

There is only one outside (WAN) IP. I have heard that this could be possible as long as the applications running on each VM have separate ports.

 

So any thoughts? 

 

PS: I asked on Ubuntu forums, people say it is possible, but nobody has posted any specifics.

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

So does anyone know how to do this? 

I have 2 FQDNs pointed to one server running Ubuntu. That server is running two virtual machines. I want example1.com pointed to VM1 and example2.net pointed to VM2. 

There is only one outside (WAN) IP. I have heard that this could be possible as long as the applications running on each VM have separate ports.

 

So any thoughts? 

 

PS: I asked on Ubuntu forums, people say it is possible, but nobody has posted any specifics.

Squid proxy server will be able to do this based on domain names depending on the kind of traffic. what applications/servers are you hosting?

 

IPTables (or any other firewall) will be bale to do it based on port numbers.

Link to comment
Share on other sites

Link to post
Share on other sites

Squid proxy server will be able to do this.

That is exactly what others have said. Now which module in specific?

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

That is exactly what others have said. Now which module in specific?

It depends what you are hosting.

 

What services are you providing? How come youre using multiple virtual servers on the same physical hardware?

Link to comment
Share on other sites

Link to post
Share on other sites

It depends what you are hosting.

 

What services are you providing? How come youre using multiple virtual servers on the same physical hardware?

The reason I am using VMs is for sandboxing. This is a personal server. As to what services: MySQL, Apache, and a game server. 

 

My main thing that I want to achieve is to separate my game server to run off a different domain. The reason being is that I host my own personal website that is basically a portfolio of my professional and academic work. I don't want my professional domain associated with my game server. :P

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

The reason I am using VMs is for sandboxing. This is a personal server. As to what services: MySQL, Apache, and a game server. 

 

My main thing that I want to achieve is to separate my game server to run off a different domain. The reason being is that I host my own personal website that is basically a portfolio of my professional and academic work. I don't want my professional domain associated with my game server. :P

Oh in that case it is really simple.

 

Just forward the port for the game server to the virtual machine that is hosting your game server. The domain name is irrelevant in this case.

Link to comment
Share on other sites

Link to post
Share on other sites

Oh in that case it is really simple.

 

Just forward the port for the game server to the virtual machine that is hosting your game server. The domain name is irrelevant in this case.

That is what I am doing currently, but I want to give a VM a separate domain name.

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

W/ Apache, you can associate a certain domain name with a virtual server which you could use for your academic stuff, which would only server the files if the request is from X domain. Then point the game server address at your IP, and add another virtual server so that if they go to the FQDN in their browser they get a page.

15" MBP TB

AMD 5800X | Gigabyte Aorus Master | EVGA 2060 KO Ultra | Define 7 || Blade Server: Intel 3570k | GD65 | Corsair C70 | 13TB

Link to comment
Share on other sites

Link to post
Share on other sites

W/ Apache, you can associate a certain domain name with a virtual server which you could use for your academic stuff, which would only server the files if the request is from X domain. Then point the game server address at your IP, and add another virtual server so that if they go to the FQDN in their browser they get a page.

Yes, I know. I currently have Virtual hosts set up. The issue is that there is 1 WAN IP.

Essentially what has to happen:

post-419-0-52055100-1402806883.png

I need to figure out how to get Squid to proxy based on the domain name requested.

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

Yes, I know. I currently have Virtual hosts set up. The issue is that there is 1 WAN IP.

Essentially what has to happen:

attachicon.gifDrawing1.png

I need to figure out how to get Squid to proxy based on the domain name requested.

 

 

That is what I am doing currently, but I want to give a VM a separate domain name.

 

The domain name isnt used for routing. The IP addresses are.

 

Nobody is going to know that you have two different domain names pointing at the same address. The domain is only carried in the payload of packets where the application uses the domain name. It is 100% irrelevant in this case.

 

The best you can do (since you only have a single IP address) is to forward ports to your servers.

 

Squid is good at redirecting HTTP requests, and things like that, but you cant route packets based on things they contain in their payloads.

Link to comment
Share on other sites

Link to post
Share on other sites

The domain name isnt used for routing. The IP addresses are.

 

Nobody is going to know that you have two different domain names pointing at the same address. The domain is only carried in the payload of packets where the application uses the domain name. It is 100% irrelevant in this case.

 

The best you can do (since you only have a single IP address) is to forward ports to your servers.

 

Squid is good at redirecting HTTP requests, and things like that, but you cant route packets based on things they contain in their payloads.

Yes, I now realize that. The reason being that most reverse proxies look at the HTTP header when determining how to route traffic. Sigh. 

 

Someone on server fault suggest using dual stack ipv6/ipv4. Each VM can get a dedicated ipv6 using hurricane electric's broker service. I can then use various 6 to 4 routes available as services, some even free. This would mean that I could tunnel to a different outside ipv4! Assuming I can set up various DNS records at my registrar, which I can.

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×