The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Domain Redirects to different Ports

Discussion in 'General Discussion' started by osfdeath, Feb 16, 2004.

  1. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    I put in a support ticket for this but they said they wouldn't support it :(

    What I want to do is allow one of my customers to redirect based on different ports to he can use his domain name for his game servers (Half Life and Battlefield 1942)

    So if the domain is "domain.com"
    and the game server ip is 123.456.789.0 on port 14567
    Someone starts their game and inserts "domain.com" where they'd normally put the IP address - the request is sent to "domain.com" on port 14567 and it forwards the traffic to the IP 123.456.789.0:14567

    Ideas?
     
  2. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
  3. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    16
    Not too sure, but I believe you might be able to accomplish this with apache's mod_rewrite.

    The link to the docs:
    http://httpd.apache.org/docs/misc/rewriteguide.html

    Be warned, I personally think that finding Osama would be/is easier than learning all of the intrcacies of rewrite rules:D
     
  4. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    You'd think I could just plug in the ports onto the domain in the dns/mx entries and it'd work....

    Or something like that..
    Figured there'd be an easy way
    Maybe a script that'll do it?
     
  5. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    16
    You might "wish" for things to happen that way, but, in reality, DNS and http are two seperate puppies.

    Layman's terms ... DNS knows where your domain(s) reside. Httpd(d) tells requests where to go.

    The whole gaming issue might be easier to deal with (via a namebased schema) by creating subdomains for each game?
     
  6. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    Ya I did try that

    Game battlefield1942
    Subdomain = bf.domain.com

    In the game instead of an IP I use bf.domain.com:14657
    Didn't work
    Also tried using just bf.domain.com (with no port)
    No luck
     
  7. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    16
    Have you considered writing a simple script that would "sniff" the enviroment variables and then redirect based upon the http request?
     
  8. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    prolly would have done that already if i had the knowledge to do it :)
     
  9. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    Do you mean redirecting to different web pages, or is it some other server application?

    In any case all you need is to have a process listening on each port.
     
  10. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    no it's stuff on other ports on another IP

    the idea would be for the webserver to transfer any requests over to the new IP

    I can do it with gotnds.com ok - but that isn't what he wants.
    He wants his domain name to forward
     
  11. stillwaiting

    stillwaiting Member

    Joined:
    Jan 14, 2004
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    here's how cpanel redirect domain.com/whm to port 2086in whmredirect.cgi so it would be v v similar


    #!/usr/bin/perl

    if ($port eq "") { $port = '2086'; }

    if ($ENV{'HTTP_HOST'} ne "") {
    print "Location: http://$ENV{'HTTP_HOST'}:${port}\n\n";
    exit;
    }

    print "Location: http://$ENV{'REMOTE_ADDR'}:${port}\n\n";
     
  12. freshstartup

    freshstartup Member

    Joined:
    Jan 26, 2004
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    So you want video games to connect to other servers based on the port they use to communicate? I understand why CPanel support won't support it. It really has nothing to do with CPanel, or any of the programs CPanel uses.

    What you're looking is called Port Forwarding, or Port Redirection. The particular application you are trying to use it for might be simple, and might be a black art -- depending on how complex the game-protocols are.

    Look up port forwarding for your operating system (it's different on every one) -- it might be ipportfw -- learn to use it.. problem *maybe* solved.. there's about 1000 variables than can interfere...

    Oh and did I mention that if your network hierarchy isn't setup correctly for this application, you'll pay up to four times as much for bandwidth?

    I think you'd better work with that DNS idea.... give the different game machines different names -- wait for the info to propogate.. play to your hearts content.
     
  13. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    It just forwards the traffic once - doesn't use any extra bandwidth

    I use gotdns.com for a few servers I run myself because I have a dynamic ip
     
  14. freshstartup

    freshstartup Member

    Joined:
    Jan 26, 2004
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    If you use DNS, it will direct the gamers to the correct servers (ie: quake.whatever.com -- doom.whatever.com etc... forgive me, I'm not up on the latest games, but that's irrelevant). By that method you will only use nearly zero bandwidth on your server.

    If you rewrite packets to make them destined for another host (port forwarding, or any similar routing), the traffic will come into your server (1x) be forwarded to the correct server (possibly 2x), be returned to your server, and then returned to the gamer.

    DNS is the right approach.

    If your network center bills at the router (not at the switch) and you can reach the game servers without going through the router, then you can port forward individual ports without worrying about bandwidth, although, this will cost some dough if the game servers are normally billed to someone else, cause now all traffic destined for the game servers will instead show up as traffic destined for your server.

    Not really a CPanel issue, but I hope this helps you get on the right track.
     
  15. osfdeath

    osfdeath Well-Known Member

    Joined:
    Aug 29, 2003
    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    16
    I just want it to be a forwarder - didn't think it'd be such a big thing tbh
     
Loading...

Share This Page