Results 1 to 10 of 10
  1. #1

    DNS / Bind problem - easiest method to redirect a domain to another?

    Hey folks,

    I've got two domains (for sake of example, domain A and domain B). Domain A resolves correctly to my web server. Domain B is just sitting collecting dust. I didn't set these domains up, a previous programmer at my job did.

    How do I configure resolv.conf, named.conf and the zone file(s) correctly to have domain B redirect to domain A?

    I've already set up httpd.conf so that any requests for the host name of domain A will redirect.

    e.g. http://www.domainB.com -> http://www.domainA.com

    I just need the DNS part of this fixed (that I'm a bit of a noob at).

    Do I have to do something like this in named.conf:

    Code:
    zone "domaina.com" {
            type master;
            file "/var/named/domaina.com.hosts";
            };
    
    zone "domainb.com" {
            type master;
            file "/var/named/domaina.com.hosts";
            };
    Then in the domaina.com.hosts zone file add an alias like this?

    Code:
    domainb.com.   IN   CNAME   domaina.com.
    Or do I need to create a domainb.com.hosts zone file with basic info emulating domaina.com.hosts zone file, and add its entry in named.conf?

    Thanks if ya can help. ;-)

  2. #2
    Join Date
    Jun 2004
    Posts
    525
    Even if domaina is pointing at domainb via a DNS record if your webserver is not configured correctly to display domainb it won't work.

    You will need to ensure the virtual host is setup correctly on your webserver.
    System Administrator

  3. #3
    I've handled the virtual host part in httpd.conf, that much I'm familiar with. It's the DNS part I'm confused at.

  4. #4
    Join Date
    Jun 2004
    Posts
    525
    domainb.com. IN CNAME domaina.com.

    Would point domainb to whichever IP address domaina points to.

    If the virtual host setup is done correctly this should work.
    System Administrator

  5. #5
    Well I tried that, and it didn't work--or at least I think.

    nslookup isn't yielding any results at least on my domainb.

  6. #6
    Join Date
    Jun 2004
    Posts
    525
    Try reloading bind.

    If you don't have access to the DNS server its most likely that the record will take some time to update and propigate to your ISP's DNS server.

    Also try flushing dns. Via a windows command prompt enter "ipconfig /flushdns"
    System Administrator

  7. #7
    Double check that domainB is current and has the correct NS1 and NS2. I am sure you have covered that though.
    Caro.Net: Support is everything
    Offering High Quality Dedicated Servers.

  8. #8
    The domainb nameservers from the registrar are pointing to domaina nameserver (e.g. ns1.domaina.com, ns2.domaina.com).

    A lookup on domainb right now gives:

    Code:
    nslookup <domainb>
    Server:         127.0.0.1
    Address:        127.0.0.1#53
    
    ** server can't find <domainb>: SERVFAIL
    I restarted Bind after doing the changes too.

    Hrm..

    (dedicated server is Linux btw, that Bind is on)

  9. #9
    Join Date
    Aug 2005
    Location
    Los Angeles, CA
    Posts
    169
    Quote Originally Posted by velocd
    Code:
    nslookup <domainb>
    Server:         127.0.0.1
    Address:        127.0.0.1#53
    
    ** server can't find <domainb>: SERVFAIL
    I restarted Bind after doing the changes too.
    SERVFAIL indicates that the server failed to load the zone. Restart BIND again and check the error log (usually /var/log/messages) for any errors BIND might've generated while starting. There might be a problem with the zonefile that prevents it from being loaded.

    (If I had to guess, I'd say that the problem is that you used the same zonefile for both domains, and the zonefile has the zone name hardcoded into it. The domainb.com zonefile must not say "domaina.com" on the left side of any records. Fix it by copying the zonefile and changing "domaina.com" to "domainb.com" as appropriate.)

  10. #10
    Figured it out, had to do the second method or waht gevg mentioned and put it in its own zone file.

    Thanks all. =)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •