how would you put different sites on different servers, but same network?

Discussion in 'Web Design and Development' started by twoodcc, Sep 22, 2009.

  1. twoodcc macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #1
    so, let's just use macrumors for an example.

    let's say that macrumors.com is on one server, and forums.macrumors.com is on another server.

    can they be on the same local network? and if so, how would it know to go to the forums server when someone went to the forums.macrumors.com site?

    i thought with port forwarding, all port 80 would go to one machine on the local network. am i correct?

    and so then, each server would have to have it's own external static ip address?
     
  2. rowsdower macrumors 6502

    Joined:
    Jun 2, 2009
    #2
    DNS allows each "name" address like macrumors.com or forums.macrumors.com to resolve to a different IP address. In this case both servers would have external IP addresses.

    It would be possible for both sites to be on the same server. In that case, both names would resolve to the same address. HTTP requests include the address that was requested, so that the server knows which page to send.

    It is also possible to have one server act as a sort of traffic controller, directing incoming traffic to different servers in order to balance the load. Large sites typically use variations of this strategy.
     
  3. twoodcc thread starter macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #3
    so with DNS, you could route images.macrumors.com to the images server? or would it need it's own external ip address (sorry, just to clarify)
     
  4. rowsdower macrumors 6502

    Joined:
    Jun 2, 2009
    #4
    Each name in DNS resolves to a single IP address, which in general is an external address, otherwise no one from the outside will be able to get in. This is a simple one-to-one mapping, like a phone book. DNS itself doesn't do any routing; it just returns an IP address when you give it a name.

    To address your original question, if you only have one external IP address and you set your router to forward port 80 to some local address, you are correct that all port 80 traffic will go to that address. There are ways to have a router or a server redirect requests based on the name that was used, even though they all have the same IP address. In general, this only works for HTTP because HTTP has a special header that includes the name that was used. Sites that are set up this way might have multiple servers dealing with requests to the same IP address. However, to the client it looks like a single server doing all of the work.
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    In fact they are on different servers, 5 servers.
     
  6. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #6
    Not totally correct. DNS can resolve to multiple IPs:

    Code:
    Name:    www.l.google.com
    Addresses:  64.233.169.104, 64.233.169.147, 64.233.169.99, 64.233.169.103
    Aliases:  www.google.com
    These IPs can be on very separate networks. DNS will then rotate these addresses, usually in a round robin fashion, but some DNS servers can check the load of the boxes to determine which IP is the primary.

    So, DNS doesn't do any IP routing per se, but it can route traffic to different networks in an indirect fashion.
     
  7. twoodcc thread starter macrumors P6

    twoodcc

    Joined:
    Feb 3, 2005
    Location:
    Right side of wrong
    #7
    thanks for the reply. so you can have multiple sites on different servers, but the same external ip.
     
  8. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #8
    Yes, you would then use the VirtualHost directive in Apache or Host Headers in IIS. You can then just open port 80 to the machine.

    Keep in mind this adds load to your server. Depending on the amount of traffic, it can impact it significantly.
     
  9. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #9
    Isn't this for multiple sites on the same server?

    To use a single IP for multiple servers, you would use a gateway (there are software and hardware based gateways) to direct traffic to the various servers inside your network.
     
  10. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #10
    Yes, you're right. I misread the reply. That's what I get for posting while sick. Ack!
     
  11. NoNameBrand macrumors 6502

    Joined:
    Nov 17, 2005
    Location:
    Halifax, Canada
    #11

    Yes, a common way to do this is to have the box that gets all the requests running a proxy, like Squid, which knows which servers to talk to deeper in your network for different content.
     

Share This Page