How do I share an IP address for two domains? - Networking

This is a discussion on How do I share an IP address for two domains? - Networking ; I have two domains and I want both of them to point to the same web server using the same IP address. One domain is called teachkids.us and the other is b-matrix.org. >From my understanding, it should be possible to ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: How do I share an IP address for two domains?

  1. How do I share an IP address for two domains?

    I have two domains and I want both of them to point to the same web
    server using the same IP address. One domain is called teachkids.us
    and the other is b-matrix.org.

    >From my understanding, it should be possible to use the same IP

    address and then on the web server setup two virtual websites: one
    site for teachkids.us and the other for b-matrix.org.

    This should be possible because in the recent past I had multiple
    domains using a shared IP address but each domain had its own website
    on the same server. I suppose that the web server doesn't look at the
    IP address but probably gets information about domain from the sender
    and knows what site to access.

    Unfortunately I cannot do this on someone elses system and am not sure
    why.

    If I ping teachkids.us, the IP address is 71.249.137.181
    If I ping b-matrix.org, the IP address is 63.251.92.195 Why??

    Both domains are registered at the same location and both use the same
    DNS entries:

    dns1.name-services.com
    dns2.name-services.com
    dns3.name-services.com
    dns4.name-services.com
    dns5.name-services.com

    So where am I getting a different IP address for b-matrix.org from?
    Where is this set?

    If I use NSLookup and set the server to dns1.name-services.com and
    then type in b-matrix.org, it shows the IP address as 69.25.142.3

    I'm entirely confused. For b-matrix.org, I get 63.251.92.195 pinging,
    then I get 69.25.142.3 using NSLookup. Why does NSLookup give me
    something entirely different again? What do I have to do to get the IP
    address for b-matrix.org to be 71.249.137.181?

    Thanks for your help!


  2. Re: How do I share an IP address for two domains?

    On 2007-05-09, Polaris431 wrote:
    >>From my understanding, it should be possible to use the same IP

    > address and then on the web server setup two virtual websites: one
    > site for teachkids.us and the other for b-matrix.org.


    Just point both domain to the same IP in the DNS and then configure
    your web server for name-based virtual hosts.

    > If I ping teachkids.us, the IP address is 71.249.137.181
    > If I ping b-matrix.org, the IP address is 63.251.92.195 Why??


    'cause you didn't configure it correctly.

    > So where am I getting a different IP address for b-matrix.org from?


    From the DNS

    > Where is this set?


    In the DNS.

    > If I use NSLookup and set the server to dns1.name-services.com and
    > then type in b-matrix.org, it shows the IP address as 69.25.142.3


    Then one of the DNS is wrong.

    > I'm entirely confused. For b-matrix.org, I get 63.251.92.195 pinging,
    > then I get 69.25.142.3 using NSLookup. Why does NSLookup give me
    > something entirely different again?


    'cause NSlookup uses a different set of libraries and works in complete
    different way from ping. Ping is *NOT* a way to test DNS.

    Davide

    --
    Normally, machines behave, 'cause they know what's good for them. This
    is the main way to tell servers apart from lusers. The lusers don't know
    what's good for them. -- Graham Reed on alt.sysadmin.recovery

  3. Re: How do I share an IP address for two domains?

    > 'cause NSlookup uses a different set of libraries and works in complete
    > different way from ping. Ping is *NOT* a way to test DNS.
    >


    Are you saying that Ping does not indicate the true IP address and
    NSLookup does?


  4. Re: How do I share an IP address for two domains?

    On 2007-05-09, Polaris431 wrote:
    >
    > Are you saying that Ping does not indicate the true IP address and
    > NSLookup does?


    I am saying that Ping is not to be used for testing dns because is not
    designed to do so. Ping doesn't use the same dns-libraries that nslookup
    does, in fact, nslookup has the libraries built-in and is considered
    obsolete for that reason. nslookup can return a complete different
    result than any other network-related tool or software because of the
    different implementation. A quick google search will tell you so.

    Davide

    --
    All programs evolve until they can send email. -- Richard Letts
    Except Microsoft Exchange. -- Art

  5. Re: How do I share an IP address for two domains?

    Davide Bianchi wrote:

    > On 2007-05-09, Polaris431 wrote:
    >>
    >> Are you saying that Ping does not indicate the true IP address and
    >> NSLookup does?

    >
    > I am saying that Ping is not to be used for testing dns because is not
    > designed to do so. Ping doesn't use the same dns-libraries that nslookup
    > does, in fact, nslookup has the libraries built-in and is considered
    > obsolete for that reason. nslookup can return a complete different
    > result than any other network-related tool or software because of the
    > different implementation. A quick google search will tell you so.
    >
    > Davide
    >


    I agree with the final conclusion, but there is a slight error in this:

    GNU ping does not have name resolution libraries built in, but uses glibc's
    gethostbyname() which, on GNU/linux at least uses libnss and can derive
    it's source data from DNS, LDAP, NIS, files (/etc/hosts) or any number of
    other places that someone cares to configure or write a plugin for in some
    particular priority order.

    nslookup of course interrogates the DNS servers, as does it's more modern
    variant: dig

    So, to support the point that Davide made, Polaris might want to try adding
    this to his /etc/hosts:

    10.0.0.1 www.ibm.com

    and make sure that /etc/nsswitch.conf contains:

    hosts: files dns

    Try:

    ping www.ibm.com
    nslookup www.ibm.com

    before and after.

    Cheers

    Tim

  6. Re: How do I share an IP address for two domains?

    On Wed, 09 May 2007 06:16:29 -0700, Polaris431 wrote:

    > I have two domains and I want both of them to point to the same web
    > server using the same IP address. One domain is called teachkids.us
    > and the other is b-matrix.org.
    >
    >>From my understanding, it should be possible to use the same IP

    > address and then on the web server setup two virtual websites: one
    > site for teachkids.us and the other for b-matrix.org.
    >
    > This should be possible because in the recent past I had multiple
    > domains using a shared IP address but each domain had its own website
    > on the same server. I suppose that the web server doesn't look at the
    > IP address but probably gets information about domain from the sender
    > and knows what site to access.
    >
    > Unfortunately I cannot do this on someone elses system and am not sure
    > why.
    >
    > If I ping teachkids.us, the IP address is 71.249.137.181
    > If I ping b-matrix.org, the IP address is 63.251.92.195 Why??
    >
    > Both domains are registered at the same location and both use the same
    > DNS entries:
    >
    > dns1.name-services.com
    > dns2.name-services.com
    > dns3.name-services.com
    > dns4.name-services.com
    > dns5.name-services.com
    >
    > So where am I getting a different IP address for b-matrix.org from?
    > Where is this set?
    >
    > If I use NSLookup and set the server to dns1.name-services.com and
    > then type in b-matrix.org, it shows the IP address as 69.25.142.3
    >
    > I'm entirely confused. For b-matrix.org, I get 63.251.92.195 pinging,
    > then I get 69.25.142.3 using NSLookup. Why does NSLookup give me
    > something entirely different again? What do I have to do to get the IP
    > address for b-matrix.org to be 71.249.137.181?
    >
    > Thanks for your help!


    You need to contact name-services.com, and ask them to set the right DNS
    entries. (A records)

    repo@cannabis:~$ nslookup b-matrix.org
    Server: 127.0.0.1
    Address: 127.0.0.1#53
    Non-authoritative answer:
    Name: b-matrix.org
    Address: 63.251.92.195
    repo@cannabis:~$

    repo@cannabis:~$ nslookup teachkids.us
    Server: 127.0.0.1
    Address: 127.0.0.1#53
    Non-authoritative answer:
    Name: teachkids.us
    Address: 71.249.137.181
    repo@cannabis:~$



    --
    Chaos, panic & disorder - my work here is done
    http://beginnerslinux.org

  7. Re: How do I share an IP address for two domains?

    Polaris431 wrote:
    >>From my understanding, it should be possible to use the same IP

    > address and then on the web server setup two virtual websites: one
    > site for teachkids.us and the other for b-matrix.org.


    Yep. This is called "virtual hosting" and is a standard feature of web
    servers such as apache.


    > If I ping teachkids.us, the IP address is 71.249.137.181
    > If I ping b-matrix.org, the IP address is 63.251.92.195 Why??


    Your DNS provider is providing duff information:

    $ dig +short b-matrix.org @dns1.name-services.com
    69.25.142.3
    $ dig +short b-matrix.org @dns2.name-services.com
    216.52.184.240
    $ dig +short b-matrix.org @dns3.name-services.com
    63.251.92.195
    $ dig +short b-matrix.org @dns4.name-services.com
    64.74.96.243
    $ dig +short b-matrix.org @dns5.name-services.com
    64.74.96.243

    All of those should have been the same value - unless you've deliberately
    set up multiple A records for your domain.


    While we're here, the SOA shows a strangely lov value (typically but
    not necessarily it's usually YYYYMMDDNN, where NN is a sequence value
    for changes on that day), but worryingly it's the same for all five
    DNS servers:

    $ for N in `seq 5`; do dig +short soa b-matrix.org @dns$N.name-services.com; done
    dns1.name-services.com. info.name-services.com. 2002050701 10001 1801 604801 181
    dns1.name-services.com. info.name-services.com. 2002050701 10001 1801 604801 181
    dns1.name-services.com. info.name-services.com. 2002050701 10001 1801 604801 181
    dns1.name-services.com. info.name-services.com. 2002050701 10001 1801 604801 181
    dns1.name-services.com. info.name-services.com. 2002050701 10001 1801 604801 181

    You did increment the SOA serial number when you changed the zone
    information, didn't you...?

    Chris

+ Reply to Thread