LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-10-2013, 10:48 AM   #1
chinese_ys
LQ Newbie
 
Registered: Aug 2007
Posts: 8

Rep: Reputation: 0
DNS question


Hey,

I have a temp DNS server (172.16.0.100) on internal network running openSUSE. There is a special host "host1.test.com" on network that I need internal user to have its private IP when resolving. I created a zone "test.com" in named.conf as redirect and statically added host1.test.com into /etc/hosts file.

named.conf:
zone "test.com" in {
type forward;
forwarders { 127.0.0.1; };
};


I also have 8.8.8.8 configured as my upstream forwarder. My issue is Client PC with 172.16.0.100 as DNS server is not able to resolve host1.test.com. I got timeout message.

So how should I configure the DNS server to be smart enough to forward request to itself to check /etc/hosts and/or upstream forward when client asks for host on test.com domain?

Last edited by chinese_ys; 01-10-2013 at 12:59 PM.
 
Old 01-11-2013, 03:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
forwarders { 127.0.0.1; };

?? you're just telling it to forward to itself, that clearly makes no sense, and would just be an infinite loop.

it's really unclear what you're actually asking for. Where does /etc/hosts fit into this? If it's just one client, why bother with DNS at all, just put the entry on the single client surely?
 
Old 01-11-2013, 06:57 AM   #3
chinese_ys
LQ Newbie
 
Registered: Aug 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
forwarders { 127.0.0.1; };

?? you're just telling it to forward to itself, that clearly makes no sense, and would just be an infinite loop.

it's really unclear what you're actually asking for. Where does /etc/hosts fit into this? If it's just one client, why bother with DNS at all, just put the entry on the single client surely?
I was expecting forward request to itself in order to use /etc/hosts.

Let me try to explain again:
I have multiple clients(WIFI Guests) on this LAN. When they connect to network, I need to have host1.test.com to be resolved as 172.16.0.254 and host2.test.com as 1.2.3.4; When they are on Internet, I need host1.test.com to be resolved as 1.2.3.3 and host2.test.com as 1.2.3.4 (This part has done via godaddy already). Please keep in mind, there are more than host1 and host2 need to be resolvable.

Any suggestion?
 
Old 01-11-2013, 07:12 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Hmm, well firstly no, the 127.0.0.1 ideas are nonsense. a BIND instance will never revert to local files, It's a proper service, not a simple utility like dnsmasq. You'd define a proper BIND zone for it, and put the appropriate A record in the zone file.
 
Old 01-11-2013, 07:30 AM   #5
chinese_ys
LQ Newbie
 
Registered: Aug 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
Hmm, well firstly no, the 127.0.0.1 ideas are nonsense. a BIND instance will never revert to local files, It's a proper service, not a simple utility like dnsmasq. You'd define a proper BIND zone for it, and put the appropriate A record in the zone file.
I did have the zone for test.com configured the first attempt but did not work as I expected.
So if I have 50 hosts needs to be resolvable on Internet including this host1.test.com, i would need to manaully add all 50 records into the ZONE configuration?
 
Old 01-11-2013, 07:32 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
If you're forwqarding all other unknown addresses, you'd only need the local entries on the local server, asssuming that this local server plays no part at all in the resolution from the interwebs.
 
Old 01-11-2013, 08:32 AM   #7
chinese_ys
LQ Newbie
 
Registered: Aug 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
If you're forwqarding all other unknown addresses, you'd only need the local entries on the local server, asssuming that this local server plays no part at all in the resolution from the interwebs.
Sure that is making sense on paper but can you be more specific?

Here was the one I had initially and it did not work as I expected:
named.conf:
zone "test.com" in {
type master;
file "/var/lib/named/master/test.com.hosts";
};


test.com.hosts:
$TTL 2D
@ IN SOA DNS01.test.com. root.DNS01.test.ca. (
2011111800 ; serial
3H ; refresh
1H ; retry
1W ; expiry
1D ) ; minimum

IN NS DNS01.test.com.
vpn IN A 172.16.0.254


My DNS server is the DNS01.test.com.
 
Old 01-11-2013, 08:52 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
OK, looking it up a little more, a slight tweak to what I suggested.

So you have your forwarders set up, so you're resolving all sites to public addresses via your local DNS server. then you add a ZONE PER HOSTNAME, so a zone for test.example.com and othertest.example.com, not for example.com itself:

Code:
    zone "test.example.com" {
            type master;
            file "/etc/bind/zones/test.example.com";
    };
with a zone file like:
Code:
$TTL    604800
@       IN      SOA     test.example.com. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
;
@                       IN      NS      test.example.com.
test.webdomain.com.    IN      A       10.0.1.20
 
1 members found this post helpful.
Old 01-11-2013, 10:13 AM   #9
chinese_ys
LQ Newbie
 
Registered: Aug 2007
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
OK, looking it up a little more, a slight tweak to what I suggested.
...
then you add a ZONE PER HOSTNAME, so a zone for test.example.com and othertest.example.com, not for example.com itself:
...
That is an awesome idea. Fixed my issue
 
  


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
Question about BIND and windows DNS compatibility, enabling scavenging on Windows DNS simon@tpmcomm.com Linux - Server 0 08-24-2012 11:22 AM
Before setup DNS and after DNS question sportivo888 Linux - Enterprise 7 12-13-2009 09:47 PM
A DNS learner's question->Is my DNS configuration right? saagar Linux - Newbie 4 01-12-2009 08:44 AM
dns question -- new to dns gadhiraju Linux - Networking 7 05-09-2001 05:59 PM
dns question -- new to dns gadhiraju Linux - General 2 05-09-2001 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:06 PM.

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