Web redirection by bind(CNAME)

HI,
From bind i am trying to redirect the web request from this domain abc.com to xyz.com
dont know if it will work or not.

i know , i can setup A record for the webserver or from apache i can redirect or even by using redirect script ( php or asp)

but I am just doing Dns management for the domain, and the client is not paying me for hosting.and he want me to redirect all the traffic request  to another web site

i got this one : http://www.experts-exchange.com/Networking/Protocols/DNS/Q_22921515.html

but its not really clear
so can any one tell me, is this possible by CNAME ??

 
LVL 29
fosiul01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ravenplCommented:
setting CNAME only will not change the http host header required for name based virtual hosts(majority).
So unless the target www is IP based virtual host - CNAME will not work.
0
fosiul01Author Commented:
ommmm problem is


if i type : http://56.555.66.55 the web site will not come

thats the problem, other wise, i would of just change the A record to that IP

do you mean this ??
0
ravenplCommented:
I'm not following?
In fact, if xyz.com is nameBasedVirtualServer - no matter A or CNAME You set - it will not work.
You either need to send proper HTTP redirect, or ask xyz.com to add abc.com as alias of xyz.com in the webserver configuration.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

fosiul01Author Commented:
yes, i will be responsible for xyz.com

and any trafiq is comming to xyz.com will be redirect to abc.com


your comments : " ask xyz.com to add abc.com as alias of xyz.com in the webserver configuration."  -> how will i do this ??

can i not do this from zone file ?? ( as i said, client is not paying me for hosting, so i am not configuring webserver for them )
0
edster9999Commented:
You can add in the domain records with CNAMEs.

you have an A record for xyz.com and then point
xyz.com (and www.xyz.com) to the A record

abc.com                IN      A      60.70.80.90
xyz.com                IN      CNAME   abc.com
www.xyz.com       IN      CNAME   abc.com

When the traffic arrives at abc.com they need to set up the server to accept that domain name or it will fall through to the default vhost.
They just need to add a doaminalias to the httpd.conf file on that vhost
(or add a parked domain in plesk / cpanel)




0
ravenplCommented:
The option under apache's config is

<VirtualHost www.xyz.com:80>
ServerName www.xyz.com
ServerAlias xyz.com www.abc.com abc.com
...
</VirtualHost>
0
fosiul01Author Commented:
HI yah sorry due to night didnot able to reply.

as i am saying, I dont have control to abc.com , but i have full control on xyz.com

and any trafiq will come to xyz.com will redirect to abc.com

now as edster9999 said, if create just  cname, will it work ??
0
edster9999Commented:
I said creating a cname will redirect the traffic.  Thing of it as a forwarding address for a domain name.  if they go to www.xyz.com it will look up the dns address and get the ip address for the record the cname point to.
All the traffic will then go to that server.

BUT on that server there is nothing to receive the traffic as it will still say 'www.xyz.com' on the URL so someone needs to add the doaminalias line (or park that domain which does the same thing) as above.
0
fosiul01Author Commented:
omm you  wait, i am confused too much

let me tell you then explain me please.


I am responsible for xyz.com domain. so in xyz.com.zone file i will insert this :

abc.com                IN      A      60.70.80.90
xyz.com                IN      CNAME   abc.com
www.xyz.com       IN      CNAME   abc.com

so as you saying : any trafiq comes to www.xyz.com    will be redirect to abc.com  , right ??    [ but why i will have add the doamin list in abc.com ??]  
0
ravenplCommented:
In the above scenario You have definied
abc.com.xyz.com as 60.70.80.90
xyz.com.xyz.com as cname to abc.com.xyz.com
www.xyz.com.xyz.com as cname to abc.com.xyz.com

anyway, even if You properly configure those A/CNAMEs, nobody will see them - they will not ask Your nameserver, but the one responsible(authoritative) for abc.com domain.

> so as you saying : any trafiq comes to www.xyz.com    will be redirect to abc.com  , right ??
No, to the IP of abc.com. What will do with this the wwwserver on abc.com it depends on it's config.
0
ravenplCommented:
> anyway, even if You properly configure those A/CNAMEs, nobody will see them - they will not ask Your nameserver
correction - it's only about A record. Your nameserver will probably send a hint, but clients should reject it, as Your nameserver is not auth for abc.com domain.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
edster9999Commented:
Sorry - ravenpl is correct.  You do not need the abc.com 'a' record if you are not controling that.  I messed that bit up and though you were running that system.

So just set up cnames for the xyz domain to go to the abc.com domain and it will get the a record from them.  The rest of the stuff about serveralias / domain parking still stands.
0
fosiul01Author Commented:
omm  both of you send me 2 different configuraiton one said : abc.com                IN      A      60.70.80.90 and other one is abc.com.xyz.com as 60.70.80.90  but  i have tryed with both solution in zone file, but still it does not work.

ravenpl , can you please explain me what you meant by this ? "No, to the IP of abc.com. What will do with this the wwwserver on abc.com it depends on it's config."

[ as i said, i can forward by using apache or programming but i dont want to do that ]  here, abc.com will not do anything. and also i dont have any access to abc.com  , only i have access to xyz.com
0
fosiul01Author Commented:
ok you saying, aftter doing Cname for xyz.con.zone file, still i  will have to request abc.com autority to allow web request from xyz.com ??
0
ravenplCommented:
C'on - I havent sent You any config, but explained that Yours is wrong.

> ravenpl , can you please explain me what you meant by this ?
What web browser do if You enter xyz.com? determines it's IP, follows any CNAMES. So it gets the ip of abc.com but still sends the http Host: header as xyz.com. The webserver on abc.com tries to match the xyz.com to one of those virtualHosts - but no match there! Usually webservers are configured to display "not found" message or display the default virtualHost(whatever it is).

So either You have to redirect it with Your webserver/script or ask abc.com webmaster to add xyz.com as an alias of abc.com virtualHost.
0
edster9999Commented:
ok here is an example file for
xyz.com.conf :
; zone file for xyz.com
$TTL 2d    ; 172800 secs default TTL for zone
@             IN      SOA   ns1.xyz.com. hostmaster.xyz.com. (
                        2008111800 ; se = serial number
                        12h        ; ref = refresh
                        15m        ; ret = update retry
                        3w         ; ex = expiry
                        3h         ; min = minimum
                        )
              IN      NS      ns1.xyz.com.
NS1           IN      A       50.60.70.80    ;   <-  This is your Nameserver
@             IN      CNAME   abc.com
www           IN      CNAME   abc.com

Open in new window

0
fosiul01Author Commented:
ok so in my case, adding CNAMe in xyz.com.zone file it not a solution ??

is not it ??
0
ravenplCommented:
fixup to the bind config

@             IN      CNAME   abc.com.
www           IN      CNAME   abc.com.

> ok so in my case, adding CNAMe in xyz.com.zone file it not a solution ??
It's not all. Maybe it is, if the abc.com is not nameBased virtualHost - unlikely.
0
fosiul01Author Commented:
hahahahah hahahahahahahah

at my very first comment is said,  

if i type : http://56.555.66.55 the web site will not come

if they would of define Ip for this abc.com ,then i would not ask so many question, but its name based hosting, thats why i am confused ,what to do!!
0
ravenplCommented:
Already explained what need to be done.
0
edster9999Commented:
you need two things.

On your DNS server a cname to point the traffic for xyz.com -> their server

On their server an entry in the httpd.conf file to show the page to people using xyz.com as the url
0
fosiul01Author Commented:
ok i have added this 2 lines in xyz.co.uk.zone file


@                       IN CNAME xxxcollection.co.uk.
www                     IN CNAME xxxcollection.co.uk.


when i am restarting the named  its giving me error


dns_master_load: xyz.co.uk.zone:13: xyz.co.uk: CNAME and other data
dns_master_load: xyz.co.uk.zone:13: xyz.co.uk: CNAME and other data
dns_master_load: xyz.co.uk.zone:13: xyz.co.uk: CNAME and other data
zone xyz.co.uk/IN: loading master file xyz.co.uk.zone: CNAME and other data
_default/xyz.co.uk/IN: CNAME and other data
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42
0
edster9999Commented:
I dont think it has a dot on the end
(a bit like my example above he he he)
0
ravenplCommented:
That's correct - You can't have
www IN CNAME something
www IN A 1.2.3.4

same applies to @ - can You bring here whole zone config file?
0
fosiul01Author Commented:
without . its still same
0
fosiul01Author Commented:
$TTL 14400
@ 86400   IN      SOA     ns1.ityou.co.uk. ns2.ityou.co.uk. (
                2008021501      ; serial
                86400           ; refresh
                7200            ; retry
                3600000         ; expire
                86400 )         ; minimum

                        IN NS ns1.ityou.co.uk.
                        IN NS ns2.ityou.co.uk.
                        IN MX 10  mail.web4u.co.uk.
                        IN MX 20  mail1.web4u.co.uk.
@                       IN CNAME elcollection.co.uk
ns1                     IN A 78.xx.xx.196
ns2                     IN A 78.xx.xx.135
www                     IN CNAME elcollection.co.uk

so when trafiq will come to web4u it will redirct to elcollection.co.uk

[here web4u and elcollection is imaginary domain ]

0
ravenplCommented:
No, You need the dot at the end! See my fixup message. Why will not You listen?
0
fosiul01Author Commented:
I didnot put . !! where are u seeing i put . ??

@                       IN CNAME elcollection.co.uk

www                     IN CNAME elcollection.co.uk

0
fosiul01Author Commented:
ok i have removed every .

$TTL 14400
@ 86400   IN      SOA     ns1.ityou.co.uk ns2.itou.co.uk (
                2008021501      ; serial
                86400           ; refresh
                7200            ; retry
                3600000         ; expire
                86400 )         ; minimum

                        IN NS ns1.itou.co.uk
                        IN NS ns2.ityou.co.uk
                        IN MX 10  mail.web4u.co.uk
                        IN MX 20  mail1.web4u.co.uk
;@                      ; IN ;CNAME ;elcollection.co.uk   [ I tryed both]                    
@                       IN CNAME 62.253.216.10      [ I tryed both]
ns1                     IN A 78.xx.xx.196
ns2                     IN A 78.xx.xx.135
www                     IN CNAME elecollection.co.uk

same thing, named is giving error as i past earlier
0
ravenplCommented:
You not reading my comments, are You?
- You need the dot in "?? IN CNAME elecollection.co.uk."
- You cannot have both CNAME and other records for @, basically You cannot have CNAME for @ (according to rfc)
0
fosiul01Author Commented:
hahah ok i am mixing your comments with you edstrr ..

ok this is my zone file now

if its still wrong, can you just edit the zone file and past here please

$TTL 14400
@ 86400   IN      SOA     ns1.ityou.co.uk. ns2.ityou.co.uk. (
                2008021501      ; serial
                86400           ; refresh
                7200            ; retry
                3600000         ; expire
                86400 )         ; minimum

                        IN NS ns1.ityou.co.uk.
                        IN NS ns2.ityou.co.uk.
                        IN MX 10  mail.web4u.co.uk.
                        IN MX 20  mail1.web4u.co.uk.
@                       IN CNAME elecollection.co.uk.
ns1                     IN A 78.xx.xx.196
ns2                     IN A 78.xx.xx.135
www                     IN CNAME eleecollection.co.uk.

and named is still giving same error with CNAME
0
ravenplCommented:
> @                       IN CNAME elecollection.co.uk.
You cannot have this... It would delegate whole domain to elecollection.co.uk - but You adding next records - this is invalid.
0
fosiul01Author Commented:
ok so this is final one


$TTL 14400
@ 86400   IN      SOA     ns1.ityou.co.uk. ns2.ityou.co.uk. (
                2008021501      ; serial
                86400           ; refresh
                7200            ; retry
                3600000         ; expire
                86400 )         ; minimum

                        IN NS ns1.ityou.co.uk.
                        IN NS ns2.ityou.co.uk.
                        IN MX 10  mail.web4u.co.uk.
                        IN MX 20  mail1.web4u.co.uk.

ns1                     IN A 78.xx.xx.196
ns2                     IN A xx.110.xx.135
www                     IN CNAME eleollection.co.uk.

with this named restart well.
but the purpose i was trying to solved it does not work. so i guess, i will have to use apache then for forwarding is not it ???

;
0
edster9999Commented:
I think that one is pretty much correct.

I still say you can add :

*     IN     CNAME    eleollection.co.uk.

I've swapped to '*' as I was looking in my bind files and this is what I have.  I think you can use * or @ interchangeably at this point but I'm swapping to '*' as that might help you. (maybe)

The only records that disagree with this are NS1 and NS2.  These have already been defined up at the .com level as the nameservers.  having them in this file is just a 'cover every base' option.  It is the correct thing to do but by the time you get to this box to look that up you already know it as you... got to the box in the first place.

If you define other records in the zone file I think they are excluded from the '*' everything clause.  It may not be in the original spec but I have used this and lots of other poeple do and it seems to work with all modern clients.
Try it and see.
0
edster9999Commented:
Oh one correction.  The top line :

@ 86400   IN      SOA     ns1.ityou.co.uk. ns2.ityou.co.uk

the last entry should be an email address with the '@' sign changed to a dot.

@ 86400   IN      SOA     ns1.ityou.co.uk. postmaster.ityou.co.uk

would be more correct.... although this is just layout and is not used for anything so it is not causing any problems here.
0
edster9999Commented:
Opps and it should have a dot after it (sorry)

@ 86400   IN      SOA     ns1.ityou.co.uk. postmaster.ityou.co.uk.    (

0
ravenplCommented:
Note: the asterisk does not apply to the @ itself :(
0
edster9999Commented:
which is fine as that does not contain the server names we want to redirect.

Please give it a try.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.