PDA

View Full Version : bind problem. domain.com doesn't resolve to domain.net


bob808
26th April 2009, 15:42
Hello people,

I have domain.net but I recently bought domain.com and want a redirect to domain.net when accessed via www ftp or mail.
I wish that when I access www.domain.com the browser should instant redirect me to www.domain.net. I want www.domain.com to be an alias for www.domain.net . I managed to set this up by defining domain.com as a separate zone with it's own settings, then modified index.html to redirect to www.domain.net but I don't like that, doesn't seem proffesional enough :)
So I tried a DNAME setting but still doesnt' work. Can't seem to find www.domain.com online on any service.

I will post my config:


/etc/bind/named.conf


options {
pid-file "/var/run/bind/run/named.pid";
directory "/etc/bind";
auth-nxdomain no;
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};

//
// a caching only nameserver config
//
zone "." {
type hint;
file "db.root";
};

zone "0.0.127.in-addr.arpa" {
type master;
file "db.local";
};


zone "domain.com" {
type master;
file "pri.domain.com";
};
zone "domain.net" {
type master;
file "pri.domain.net";
};
//// MAKE MANUAL ENTRIES BELOW THIS LINE! ////
zone "zzz.yyy.xxx.89.in-addr.arpa" {
type master;
file "rev.yyy.xxx.89.in-addr.arpa";
};



/et/bind/pri.domain.net


$TTL 86400
@ IN SOA ns1.domain.net. administrator.domain.net. (
2009032501 ; serial, todays date + todays serial #
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
NS ns1.domain.net. ; Inet Address of name server 1
NS ns2.domain.net. ; Inet Address of name server 2
;

MX 10 mail.domain.net.

domain.net. A 89.xxx.yyy.zzz
mail A 89.xxx.yyy.zzz
www A 89.xxx.yyy.zzz
ns1 A 89.xxx.yyy.zzz
ns2 A 89.xxx.yyy.zzz

ftp CNAME domain.net.

domain.net. TXT "v=spf1 a mx ptr ~all"

;;;; MAKE MANUAL ENTRIES BELOW THIS LINE! ;;;;





/etc/bind/pri.domain.com

$TTL 86400
@ IN SOA ns1.domain.net. administrator.domain.net. (
2009032007 ; serial, todays date + todays serial #
28800 ; refresh, seconds
7200 ; retry, seconds
604800 ; expire, seconds
86400 ) ; minimum, seconds
;
NS ns1.domain.net. ; Inet Address of name server 1
NS ns2.domain.net. ; Inet Address of name server 2
;


domain.com. DNAME domain.net.

;;;; MAKE MANUAL ENTRIES BELOW THIS LINE! ;;;;


I also set up as name server ns1.domain.net for domain.com at the company from witch I bought the domains.

falko
27th April 2009, 18:37
It must be CNAME, not DNAME.

bob808
28th April 2009, 15:50
Are you sure? On some other forum someone said to me to put DNAME for a domain that I want to resolve to another domain. If i have example1.com and example2.com, how do I define both so each one ends up on the same page? Let's say I own yahoo.com ( :D ) and google, and I want when someone accesses www.google.com to automatically get on www.yahoo.com. How can I define that in bind without making 2 separate zone files with all the zone declarations (www,ftp,mail etc...) and redirect in index.html ?

falko
29th April 2009, 11:43
There's a DNAME record indeed (http://www.informit.com/articles/article.aspx?p=19798 ), but I haven't worked with it so far.

I'd create a CNAME record:
www.google.com. CNAME www.yahoo.com.
and then add www.google.com as a ServerAlias to the www.yahoo.com vhost.

tebokkel
29th April 2009, 12:07
I second the CNAME, but he want's a redirect, not an alias. :)

Have a look at:
http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect

This way, the browser changes the address line.

Paul