BIND and CNAME-ing

View: New views
11 Messages — Rating Filter:   Alert me  

BIND and CNAME-ing

by Parvinder Bhasin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am stuck at this situation:

Where I have a domain:  abc.com :

I would like to have user who type  http://abc.com (without the www)  
redirected to a a different site for example :  www.xyz.com
Redirection for www.abc.com to www.xyz.com works fine.

I have tried CNAME-ing abc.com to www.xyz.com but that wouldn't work  
(I can see it why).
Is there a way to do this in BIND zone configuration?

Thanks


Re: BIND and CNAME-ing

by Jussi Peltola :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Short answer: use HTTP redirects.
Long answer: provide more information, and read about the HTTP Host:
header and think how it applies to your setup.


Re: BIND and CNAME-ing

by Daniel Ouellet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Parvinder Bhasin wrote:
> Hi,
>
> I am stuck at this situation:
>
> Where I have a domain:  abc.com :
>
> I would like to have user who type  http://abc.com (without the www)
> redirected to a a different site for example :  www.xyz.com
> Redirection for www.abc.com to www.xyz.com works fine.

 From memory, the easiest way would be:

If you use the stock httpd and you control your web server, the easiest
way would be in your httpd.conf with the "LoadModule rewrite_module"
enable in your httpd.conf.

assuming your DNS A records for both the abc.com and www.abc.com goes to
1.2.3.4 as example.

Something like that would work:

<VirtualHost 1.2.3.4>
         ServerName abc.com
         RewriteEngine on
        RewriteRule ^/(.*)              http://site1.xyz.com/$1
</VirtualHost>


<VirtualHost 1.2.3.4>
         ServerName www.abc.com
         RewriteEngine on
        RewriteRule ^/(.*)              http://site2.xyz.com/$1
</VirtualHost>

and then you can have both your URL go else where assuming you are OK
with the URL to be changed as well in the users browsers as it will do that.

DNS resolved name, not redirection in the content really.

Hope this help you.

Best,

Daniel


Re: BIND and CNAME-ing

by Parvinder Bhasin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

HTTP redirects don't apply to our setup.

 From the info that I gather, I really can't do CNAME so I will just  
write small script to accomodate changing of Ips.

-Parvinder Bhasin

On Jul 23, 2008, at 1:33 PM, Jussi Peltola wrote:

> Short answer: use HTTP redirects.
> Long answer: provide more information, and read about the HTTP Host:
> header and think how it applies to your setup.


Re: BIND and CNAME-ing

by Daniel Ouellet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Parvinder Bhasin wrote:
> HTTP redirects don't apply to our setup.
>
>  From the info that I gather, I really can't do CNAME so I will just
> write small script to accomodate changing of Ips.

May we the question wasn't so clear.

You refer to "Redirection" in the original question, now you say IP's
would work.

Well, if only the IP is what you want then, just have this in your bind
configuration for abc.com:

<snip>
                        A       1.2.3.4
$ORIGIN abc.com.
www                    A       5.6.7.8
<snip>

where www.abc.com would reply with the IP 5.6.7.8 and the abc.com reply
with 1.2.3.4.

Is that what you want?

Obviously the server at 1.2.3.4 will need to be configure to accept also
reply by name for just abc.com and the server at 5.6.7.8 to reply by
name to www.abc.com as this in httpd.conf:

<VirtualHost 1.2.3.4>
         ServerName site1.xyz.com
        ServerAlias abc.com
</VirtualHost>

And on the second destination server:

<VirtualHost 5.6.7.8>
         ServerName site2.xyz.com
        ServerAlias www.abc.com
</VirtualHost>

Is that what you were asking?

Anyway, hope it help you more, if not, then sorry for the noise and I
obviously don't understand your question.

Best,

Daniel


Re: BIND and CNAME-ing

by Almir Karic-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 23, 2008 at 01:17:04PM -0700, Parvinder Bhasin wrote:

> Hi,
>
> I am stuck at this situation:
>
> Where I have a domain:  abc.com :
>
> I would like to have user who type  http://abc.com (without the www)  
> redirected to a a different site for example :  www.xyz.com
> Redirection for www.abc.com to www.xyz.com works fine.
>
> I have tried CNAME-ing abc.com to www.xyz.com but that wouldn't work (I
> can see it why).
> Is there a way to do this in BIND zone configuration?

with this in my zone i get to google.com when i try to access
test.mydomain.org:

test            IN      CNAME   google.com.


--
vi vi vi -- the number fo the beast


Re: BIND and CNAME-ing

by Giancarlo Razzolini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Almir Karic escreveu:

> On Wed, Jul 23, 2008 at 01:17:04PM -0700, Parvinder Bhasin wrote:
>  
>> Hi,
>>
>> I am stuck at this situation:
>>
>> Where I have a domain:  abc.com :
>>
>> I would like to have user who type  http://abc.com (without the www)  
>> redirected to a a different site for example :  www.xyz.com
>> Redirection for www.abc.com to www.xyz.com works fine.
>>
>> I have tried CNAME-ing abc.com to www.xyz.com but that wouldn't work (I
>> can see it why).
>> Is there a way to do this in BIND zone configuration?
>>    
>
> with this in my zone i get to google.com when i try to access
> test.mydomain.org:
>
> test            IN      CNAME   google.com.
>
>
>  
This works, yes. But you can't have a CNAME that has the same name as
the zone. It would conflict with the SOA and with the NS entries.
Parvinder will have to use it's scripts to make this work, as he can't
use http redirect.

My regards,

--
Giancarlo Razzolini
http://lock.razzolini.adm.br
Linux User 172199
Red Hat Certified Engineer no:804006389722501
Verify:https://www.redhat.com/certification/rhce/current/
Moleque Sem Conteudo Numero #002
OpenBSD Stable
Ubuntu 8.04 Hardy Heron
4386 2A6F FFD4 4D5F 5842  6EA0 7ABE BBAB 9C0E 6B85


Re: BIND and CNAME-ing

by Parvinder Bhasin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks guys for clearing this up.  So in short you cannot CNAME an  
entire domain (domain.com   IN CNAME google.com <-------- can't do ).

Thanks for the input.  Really appreciate it.

Cheers!
-Parvinder Bhasin

On Jul 24, 2008, at 6:10 AM, Giancarlo Razzolini wrote:

> Almir Karic escreveu:
>> On Wed, Jul 23, 2008 at 01:17:04PM -0700, Parvinder Bhasin wrote:
>>
>>> Hi,
>>>
>>> I am stuck at this situation:
>>>
>>> Where I have a domain:  abc.com :
>>>
>>> I would like to have user who type  http://abc.com (without the www)
>>> redirected to a a different site for example :  www.xyz.com
>>> Redirection for www.abc.com to www.xyz.com works fine.
>>>
>>> I have tried CNAME-ing abc.com to www.xyz.com but that wouldn't  
>>> work (I
>>> can see it why).
>>> Is there a way to do this in BIND zone configuration?
>>>
>>
>> with this in my zone i get to google.com when i try to access
>> test.mydomain.org:
>>
>> test            IN      CNAME   google.com.
>>
>>
>>
> This works, yes. But you can't have a CNAME that has the same name as
> the zone. It would conflict with the SOA and with the NS entries.
> Parvinder will have to use it's scripts to make this work, as he can't
> use http redirect.
>
> My regards,
>
> --
> Giancarlo Razzolini
> http://lock.razzolini.adm.br
> Linux User 172199
> Red Hat Certified Engineer no:804006389722501
> Verify:https://www.redhat.com/certification/rhce/current/
> Moleque Sem Conteudo Numero #002
> OpenBSD Stable
> Ubuntu 8.04 Hardy Heron
> 4386 2A6F FFD4 4D5F 5842  6EA0 7ABE BBAB 9C0E 6B85


Re: BIND and CNAME-ing

by Paul de Weerd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 24, 2008 at 04:49:55PM -0700, Parvinder Bhasin wrote:
> Thanks guys for clearing this up.  So in short you cannot CNAME an entire
> domain (domain.com   IN CNAME google.com <-------- can't do ).

You should google for DNAME some time. Then form your own opinion on
the topic matter ;)

Cheers,

Paul 'WEiRD' de Weerd

--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/                 


Re: BIND and CNAME-ing

by Parvinder Bhasin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Paul!!!
Wow!!! is the only thing that comes to my mind.  Didn't even know that  
DNAME existed.
I will definately read up on it.

Thanks a bunch!
-Parvinder Bhasin

On Jul 25, 2008, at 12:14 AM, Paul de Weerd wrote:

> On Thu, Jul 24, 2008 at 04:49:55PM -0700, Parvinder Bhasin wrote:
>> Thanks guys for clearing this up.  So in short you cannot CNAME an  
>> entire
>> domain (domain.com   IN CNAME google.com <-------- can't do ).
>
> You should google for DNAME some time. Then form your own opinion on
> the topic matter ;)
>
> Cheers,
>
> Paul 'WEiRD' de Weerd
>
> --
>> ++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
> +++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
>                 http://www.weirdnet.nl/


Re: BIND and CNAME-ing

by Brian-79 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

But can't you overwrite in cache both the A and NS record to re-direct the whole domain with an answer and authority answer spoofed from the NS server?  Isn't this the other poisoning problem that really hasn't been spoken about much?  However, then you would need to have a NS to redirect with.  Please correct me if I'm wrong.

--- On Mon, 7/28/08, Parvinder Bhasin <parvinder.bhasin@...> wrote:

> From: Parvinder Bhasin <parvinder.bhasin@...>
> Subject: Re: BIND and CNAME-ing
> To: "Paul de Weerd" <weerd@...>
> Cc: linux-fan@..., "Almir Karic" <almir@...>, "openbsdML" <misc@...>
> Date: Monday, July 28, 2008, 11:27 AM
> Thanks Paul!!!
> Wow!!! is the only thing that comes to my mind.  Didn't
> even know that  
> DNAME existed.
> I will definately read up on it.
>
> Thanks a bunch!
> -Parvinder Bhasin
>
> On Jul 25, 2008, at 12:14 AM, Paul de Weerd wrote:
>
> > On Thu, Jul 24, 2008 at 04:49:55PM -0700, Parvinder
> Bhasin wrote:
> >> Thanks guys for clearing this up.  So in short you
> cannot CNAME an  
> >> entire
> >> domain (domain.com   IN CNAME google.com
> <-------- can't do ).
> >
> > You should google for DNAME some time. Then form your
> own opinion on
> > the topic matter ;)
> >
> > Cheers,
> >
> > Paul 'WEiRD' de Weerd
> >
> > --
> >>
> ++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
> >
> +++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
> >                 http://www.weirdnet.nl/

LightInTheBox - Buy quality products at wholesale price