LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Adding clients to DNS (https://www.linuxquestions.org/questions/linux-server-73/adding-clients-to-dns-4175462452/)

BuhRock 05-18-2013 05:11 AM

Adding clients to DNS
 
So I got bind set up, and when I do a "dig logic.bs" I can confirm it was set up. So say I have a computer called client1 with an ip of 192.168.153.128.

Here is my named.conf.local:
Code:

//include "/etc/bind/zones.rfc1918";
# This is the zone definition. replace example.com with your domain name
zone "logic.bs" {
        type master;
        file "/etc/bind/zones/logic.bs.db";
        };

# This is the zone definition for reverse DNS. replace 0.168.192 with your netw$
zone "153.168.192.in-addr.arpa" {
    type master;
    file "/etc/bind/zones/rev.153.168.192.in-addr.arpa";
};

Here is my rev.153.168.192.in-addr-rarp file

Code:

@ IN SOA ns1.logic.bs. admin.logic.bs. (
                        2006081401;
                        28800;
                        604800;
                        604800;
                        86400
)

                    IN    NS    ns1.logic.bs.
1                    IN    PTR    logic.bs

I add in my /zones/logic.bs.db file,

Code:


logic.bs.      IN      SOA    ns1.logic.bs. admin.logic.bs. (
// Do not modify the following lines!
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
 )

// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// example.com = domain name
example.com.      IN      NS              ns1.logic.bs.
example.com.      IN      MX    10      client1.logic.bs.

// Replace the IP address with the right IP addresses.
client1              IN      A      192.168.153.128
ns1              IN      A      192.168.153.254

Where ns1 is the DNS server and IP of the computer and the client1 is the one mentioned above. If I do a nslookup client1, then it can't find it. If I ping client1.logic.bs, same thing. What am I doing wrong?

bathory 05-18-2013 11:02 AM

Quote:

Where ns1 is the DNS server and IP of the computer and the client1 is the one mentioned above. If I do a nslookup client1, then it can't find it. If I ping client1.logic.bs, same thing. What am I doing wrong?
Your config look good. Does the following works?
Code:

nslookup client1.logic.bs
If yes, then add a
Code:

domain logic.bs
in /etc/resolv.conf

Regards

BuhRock 05-18-2013 02:09 PM

I edited my logic.bs.db file to this:

Code:

logic.bs.      IN      SOA    ns1.logic.bs. admin.logic.bs. (
// Do not modify the following lines!
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
 )

// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// example.com = domain name
logic.bs.      IN      NS              ns1.logic.bs.
logic.bs.      IN      MX    10      client1.logic.bs.

// Replace the IP address with the right IP addresses.
client1              IN      A      192.168.153.128
server              IN      A      192.168.153.254
s1                CNAME          server

And also edited the reverse file to this:

Code:

@              IN              SOA      www..logic.bs. admin.logic.bs. (
                        2006081401;
                        28800;
                        604800;
                        604800;
                        86400
)
                                NS      ns1.logic.bs

128                    IN    PTR    client1.logic.bs
254                    IN    PTR    server.logic.bs


When I do a nslookup client1.logic.bs it says it can't be found.

I added this int he named.conf.options:
Code:

listen-on port 53 { 127.0.0.1; };


listen-on port 53 { any; };

In my /etc/resolv.conf, should I have nameserver 127.0.0.1 ?

And when I dig logic.bs, should I be getting
SERVER: 127.0.0.1#53(127.0.0.1) because I was getting my 192.168.153.254 address before...

bathory 05-18-2013 04:43 PM

Please note that you should increase the serial number every time you change the zone file. So increase 2006081401 to 2006081402 and reload bind.
Also note that you have
Quote:

s1 CNAME server
I guess it's a typo and you meant ns1 instead of s1
Quote:

I added this int he named.conf.options:
Code:

listen-on port 53 { 127.0.0.1; };


listen-on port 53 { any; };

In my /etc/resolv.conf, should I have nameserver 127.0.0.1 ?

And when I dig logic.bs, should I be getting
SERVER: 127.0.0.1#53(127.0.0.1) because I was getting my 192.168.153.254 address before...
You should leave just
Code:

listen-on port 53 { any; };
The resolv.conf of the server is fine with 127.0.0.1. In the client(s) resolv.conf you should use "nameserver 192.168.153.254". And since you're using 127.0.0.1as a resolver, then the dig output is correct.

Regards

BuhRock 05-18-2013 06:27 PM

Thanks so much for the reply. I'm still not able to do a nslookup of client1.logic.bs

Code:

root@Server:/etc/bind# nslookup client1.logic.bs
Server:                127.0.0.1
Address:        127.0.0.1#53

** server can't find client1.logic.bs: SERVFAIL


bathory 05-19-2013 02:25 AM

Quote:

** server can't find client1.logic.bs: SERVFAIL
SERVFAIL means that you have an error in the zone file, or in the config file(s). After using named-checkzone with your zone file, I've found a couple of errors, like the CNAME for the NS that is illegal, the // for comment lines and so on. You can try to use the following instead, after adjusting the serial number
Code:

$TTL 86400
logic.bs.      IN      SOA    ns1.logic.bs. admin.logic.bs. (
; Do not modify the following lines!
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
 )

; Replace the following line as necessary:
; ns1 = DNS Server name
; mta = mail server name
; example.com = domain name
logic.bs.      IN      NS              ns1.logic.bs.
logic.bs.      IN      MX    10      client1.logic.bs.

; Replace the IP address with the right IP addresses.
client1              IN      A      192.168.153.128
server              IN      A      192.168.153.254
ns1                  IN      A  192.168.153.254

Also note that in the reverse zone you miss the trailing dots in the 2 RRs. They should be
Code:

128                    IN    PTR    client1.logic.bs.
254                    IN    PTR    server.logic.bs.


BuhRock 05-24-2013 07:05 PM

Ok thanks, I got it to work. I got it to work with windows clients as well. Is this what you have to do if you had a bigger network and about 100 machines? Would you have to put in 100 lines in the config file?

bathory 05-25-2013 12:39 PM

Quote:

Originally Posted by BuhRock (Post 4958449)
Ok thanks, I got it to work. I got it to work with windows clients as well. Is this what you have to do if you had a bigger network and about 100 machines? Would you have to put in 100 lines in the config file?

You can use dhcp and dynamic dns updates (ddns).
There are lots of tutorials on the net about that, so you should search for a guide that matches your distro and other needs.

Regards


All times are GMT -5. The time now is 11:13 PM.