Virtual Hosts?

3 replies [Last post]
clams
Offline
Joined: Aug 2014
Posts:

Hi there,

I'm wondering if it's possible to set up Quake servers as Apache-style virtual hosts, as in:

dm.chickswithducks.net
spacerail.chickswithducks.net

...instead of:

chickswithducks.net:27960
chickswithducks.net:27961

Can't find anything about it on Google. Any ideas?

Cheers,

clam

epsiplayer
THE ONE AND ONLY
intact-epsilon's picture
Offline
Joined: Dec 2006
Posts:
Re: Virtual Hosts?

There is a fine line between not writing the port and knowing the port.

When you write the domain host in your browser, the browser automatically adds the port to it. For http or www the port is 80: http://www.google.com:80

In the same way when you write to connect to a domain host in quake 3 the game will automatically add the default port to it. And that is port 27960. So writing:
chickswithducks.net:27960 or just chickswithducks.net its the same thing.
If you really need a different port you will need to specify it. Otherwise the game will try to connect to the same port 27960.

Apache is clearly a web server and the virtual host configuration there cannot help you in this.
What you would want to have is a domain host that has its port 27960 made to forward to another port. It is called port forwarding. In linux you can use iptables command to do so like this:
iptables -t nat -A PREROUTING -p tcp --dport 27960 -j REDIRECT --to-port 27961
In windows do like:
netsh interface portproxy add v4tov4 listenport=27960 listenaddress=[your ip] connectport=27961 connectaddress=[your ip]
This means you need to have access to server console to execute these commands. Otherwise check in the server's admin panel provided for such option called port forwarding. (Can also be configured on the router/some internet modems)
This also means that the server cannot use 27960 in the same time of course.
And also that the server can forward 27960 port only to One other port.

For other reasons, there is the method of writing the port like you do it now.
____________
epsislow


clams
Offline
Joined: Aug 2014
Posts:
Re: Virtual Hosts?

Thanks, Epsilon. I understand the theory behind it. So there is no way of having a Quake server delimit the actual "vhost" (in this case a Quake server) the user goes to? Gathering from your response, I'd need to lease another public IP address to do the trick. (Come to think of it: is anyone already doing this using IPv6?)

To be precise: I'd like both subdomains of chickswithducks.com to resolve to the same IP and have the actual server behind that IP send the user to the right place based on the hostname, like a web server would do. Something like this:

dm.cwd.net    = 1.1.1.1
insta.cwd.net = 1.1.1.1
 
dm.cwd.net   :27960 --> server --> localhost:27960
insta.cwd.net:27960 --> server --> localhost:27961 (internally redirected)

epsiplayer
THE ONE AND ONLY
intact-epsilon's picture
Offline
Joined: Dec 2006
Posts:
Re: Virtual Hosts?

You cannot have a port forwarding to 2 different machines.
Like i said above: the port 27960 must be unused when you do the port forward. For the 2nd port forward you'll wanna add, will see it in use.

You'll need to have 2 different machines and each with own port forward to the 3rd machine that has the servers.

But Now that i look at your quake 3 servers ports. why don't you do like this:

dm.cwd.net    = localhost's external ip
insta.cwd.net = 1.1.1.1
 
dm.cwd.net:27960 --> localhost:27960 (no port forward is required)
insta.cwd.net:27960 --> server --> localhost:27961 (internally redirected)

Read again my first post. If you have a server with 27960 port, thats the default one. You don't need to write the port to connect to it => No need for port forward.
______________
epsislow