LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-25-2012, 03:15 AM   #1
Slyke
LQ Newbie
 
Registered: Jul 2012
Posts: 19

Rep: Reputation: Disabled
BIND9 CNAME/A Records


So, I've got Bind9 running and configured on a router which acts as the DNS for my LAN.

I want to setup so that when I resolve a hostname, it goes to a certain IP.

I currently have:
Quote:
$ORIGIN home.mydomain,com. ; designates the start of this zone file in the namespace
$TTL 1h ; default expiration time of all resource records without their own TTL value
;
; BIND data file for mydomain,com
;
;$TTL 604800
IN SOA home.mydomain,com. home.mydomain,com. (
2011120301 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
604800) ; Default TTL
;

IN NS localhost.

ns A 10.0.0.1
home.mydomain,com. IN A 10.0.0.1
voip.mydomain,com. IN A 10.0.0.11
voip IN A 10.0.0.11
;winpc IN A 10.0.0.4
;voip. mydomain,com. CNAME home.mydomain,com.
;ld IN CNAME hotmail,com.
All hostnames work in my current search domain ($ORIGIN) (So, for example, if I ping winpc, it will resolve to 10.0.0.4)

I can also type in ld and it will resolve to hotmail,com.

If I type in home.mydomain,com, it resolve to 10.0.0.1 (Or what ever I set it to), however, if I type in voip.mydomain,com, or any other TLD, or sub-domain, it resolves to what ever my ISP would.

So, it's only resolving home.mydomain,com, or what ever else I place in the $ORIGIN correctly.

Is there any way to configure BIND9 to do A records, or CNAME records for all domains?

Basically, I want it to look in its own internal records, before requesting from the internet, if it can't find a record, then request from ISP.
 
Old 11-25-2012, 08:06 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Using FQDNs followed by the tailing dot in the zone file should work. With just hostname, the record is composed by as hostname.$ORIGIN. So in your case you have records like: voip.home.mydomain,com and so no.
For this you should use "mydomain,com" as the zone name in named.conf and no $ORIGIN in the zone file.

Regards
 
Old 11-25-2012, 08:31 AM   #3
Slyke
LQ Newbie
 
Registered: Jul 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Hey Bathory,

I changed the zone, and the zone file named.conf.local was pointing to.

I also changed the name of the zone db file in /etc/bind/zones/master to reflect just mydomain.com (So it was mydomain.com.db). I also commented out the $ORIGIN line in the zone file.

I restarted bind9, and then cleared the DNS cache on my Windows machine. I tried pinging voip.mydomain.com on both my Windows machine, and the Linux server.

It still resolves to the external IP address.

I also tried adding in:
Quote:
example.com. IN A 10.0.0.1
But it resolved to 192.0.43.10 (Which is its normal IP).

Not sure where I'm going wrong.

Please note, mydomain.com is in place of another domain I currently own. There's a subdomain called voip on it which I setup on the hosting.

Last edited by Slyke; 11-25-2012 at 08:32 AM.
 
Old 11-25-2012, 09:17 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I also changed the name of the zone db file in /etc/bind/zones/master to reflect just mydomain.com (So it was mydomain.com.db). I also commented out the $ORIGIN line in the zone file.
Why change the filename? And if you add/edit records, you should increase the serial number.

Quote:
I tried pinging voip.mydomain.com on both my Windows machine, and the Linux server.
Are you sure your windows boxes are using your nameserver as a resolver?
If you're still in error, please post the new zonefile, along with the zone definition in named.conf.
 
1 members found this post helpful.
Old 11-27-2012, 06:20 AM   #5
Slyke
LQ Newbie
 
Registered: Jul 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Hey Bathory,

I changed it because:
Quote:
zone "home.mydomain.com" {
type master;
file "/etc/bind/zones/master/home.mydomain.com.db";
};
To:
Quote:
zone "mydomain.com" {
type master;
file "/etc/bind/zones/master/mydomain.com.db";
};
In named.conf.local

Yes, I'm 100% sure they are. I checked with ipconfig /all

I will update the serial number shortly and get back to you.

Thanks!

Last edited by Slyke; 11-27-2012 at 06:22 AM.
 
Old 11-27-2012, 12:50 PM   #6
nijinashok00
LQ Newbie
 
Registered: Sep 2012
Posts: 28

Rep: Reputation: Disabled
Some solutions are

1. Restart the named service otherwise the configuration will not get updated.
2. Make sure that the zone file is readable by named user.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] MX Records / A Records / CNAME Records - Advice Please fusion1275 Linux - Newbie 15 01-18-2011 04:06 AM
TinyDNS Data - Cname's vs A records GDarkBladE Linux - Networking 0 01-17-2010 11:26 AM
CNAME records sci3ntist Linux - Server 4 09-08-2009 05:38 AM
Email configuration -CNAME records - on server File.am Linux - Server 2 10-19-2007 08:18 AM
Do we really need CNAME records in DNS? ivj Linux - Networking 3 05-19-2006 03:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration