Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
I have an internal server named cp-server that needs to be resolved via DNS over our intranet. I edited localdomain.zone and added the A record as shown in the attached ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9

    Help creating DNS A record for internal PC


    I have an internal server named cp-server that needs to be resolved via DNS over our intranet. I edited localdomain.zone and added the A record as shown in the attached text file but this did not work. Thanks for the help.
    Attached Files Attached Files

  2. #2
    Just Joined!
    Join Date
    Sep 2013
    Location
    Alberta, Canada
    Posts
    17
    Hmmm! Not enough information.
    Are you the DNS administrator (as in small home network) or is this server part of a larger organization and someone else it the DNS admin.?

    I am assuming that the cp-server and the DNS server are two different servers but normally you would not find a domain zone text file on a server unless it had a DNS server application installed on it.
    So, where is this 'localdomain.zone.txt' file located? On the cp-server or on the actual DNS server for your intranet.

    If the file you edited was on the actual DNS server for your organization (and the DNS server was reloaded) then you should be able to type "ping cp-server.localdomain" and get a response.
    If not then try typing "nslookup nothing". You should probably get a NXDOMAIN response but notice the two lines that say Server and Address. This is the name and IP of the name server which your computer is looking to for DNS answers.

    Let us know if this a small home network or a small org network where you are the admin or if this is a network where someone else does the DNS admin stuff.
    Also, what OS is on the cp-server (I'm assuming linux) and what your workstation OS is. It will help us provide you with commands to do testing.

  3. #3
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9
    Sorry for the lack of details....

    This is a small business network. The Linux server is a local server (192.168.1.200) and cp-server (192.168.1.2) is a local Windows server. I use the Linux server for DNS because my IP phones need it as the primary. My DHCP sends out the Linux server as the DNS for phones and computers.

    I am the admin for both servers. The DNS server running on the Linux box has been running for a couple of years.

    localdomain.zone (which by the way I had to add .txt so I could upload to this forum) is referenced from /etc/named.conf and is located in /var/named. I did not create it, just attempted to modify it. I tested with nslookup cp-server and it does not find it (also nslookup cp-server.localdomain). Same with ping cp-server.

    I just want to be able to ping cp-server from one of my Windows PCs and it resolve to 192.168.1.2. I may need to create a new zone file and add it to the named.conf file but do not know, was just guessing to put the A record in the localdomain.zone file.

    Hope this clarifies.

  4. #4
    Just Joined!
    Join Date
    Sep 2013
    Location
    Alberta, Canada
    Posts
    17
    That helps a lot!
    Ok, so you edited the localdomain.zone file in the /var/named directory and added the A record.
    I assume the cp-server is getting it's dns config from the dhcp server.
    Putting the A record into the localdomain.zone file means that your should be able to type “ping cp-server.localdomain” from any machine in your network and it should resolve to the proper IP.
    If not, then try “ping localhost.localdomain” and see if it responds. If it doesn't then we need to troubleshoot why. If it responds to localhost but not cp-server then we should just need to restart the “named” service. I don't know your brand of linux but you should be able to type “service named restart” on your DNS server to restart it. Once it restarts, try the ping to cp-server.localdomain again.

    A couple of other things:
    You may want to attach your named.conf file so we can see if localdomain is avail
    Also, download and install a program called “dig”. It is very useful in testing dns servers. It comes with bind-utils or you can download it as "htdig".
    For instance, “dig localdomain axfr” should show you everything that the dns server knows about localdomain. You could also substitute your normal domainname for localdomain.
    Finally, what application are you using to administer your dns server? I generally use an application called "webmin" which you can also download from the internet.

  5. #5
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9
    I captured the output of the commands suggested and attached as a text file. I don't have an app to admin the server since it runs my IP phones and might be worried it would affect something with them, maybe not?? The box is CentOS 4.4. Also I don't care about localdomain, just seemed like the place to put an intranet A record, maybe cp-server needs it's own zone file. In fact, if I have to ping cp-server.localdomain that won't help me anyway, just need to resolve cp-server. Thanks.
    Attached Files Attached Files

  6. #6
    Just Joined!
    Join Date
    Sep 2013
    Location
    Alberta, Canada
    Posts
    17
    So, it's an Asterisk PBX box!
    After a look at the named.conf it appears that this is a very minimal DNS implementation and it looks like your primary domain is a subset of fonality.com. All zones have allow-update set to none so that means that it is not registering new IPs via the DHCP server. Therefore, I am assuming that as you add new ip phones that you do it through some console which then updates the DNS. I also notice that there is no reverse lookup table for the 192.168.x.x subnet. I am not familiar with the tools avail to program the twixbox pbx but I am assuming that you don't want to have “s146063.trixbox.fonality.com” as your domain name.

    So ..... you are about to go into a steep learning curve. We will need to configure a new DNS zone for your intranet. Then once we get that working we will need to set up the devices to recognize the new zone. (most likely via your dhcp server).

    We will call your intranet zone “mgarey”. We don't need a .com or .net, etc because no one else will see or have access to this anyway – it's strictly internal.

    We will need to do this a step at a time and since we are doing it via this forum we will need to be fairly verbose as to what is being done and why.

    So, lets get underway ....

    Get on your DNS server and cd to /var/named. Use your favorite editor to create two files:

    1. mgarey.zone; and
    2. 168.192.in-addr.arpa

    mgary.zone will look like this: (without the ------ lines)

    ------------------------------------------------------------
    Code:
    $TTL    86400
    @		IN SOA  ns1.mgarey root (
     			1		; serial ()
    			3H		; refresh
    			15M		; retry
    			1W		; expiry
    			1D )		; minimum
    		IN NS		ns1.mgary.
    
    ns1.mgarey.	IN A		192.168.1.200
    cp-server	IN A		192.168.1.2
    ------------------------------------------------------------

    168.192.in-addr.arpa will look like this: (without the ------ lines)

    ------------------------------------------------------------
    Code:
    $TTL    86400
    @		IN SOA  ns1.mgarey root (
     			1		; serial ()
    			3H		; refresh
    			15M		; retry
    			1W		; expiry
    			1D )		; minimum
    		IN NS		ns1.mgary
    
    200.1.168.192.in-addr.arpa.		IN	PTR	ns1.mgarey.
    2.1					IN	PTR	cp-server.mgarey.
    ------------------------------------------------------------

    Notice the two different formats for the PTR directive. In the first one we used the FQDN so we had to terminate it with a “.” In the second one, since this is the file for the “ 168.192.in-addr.arpa” zone we can use the shorthand of “2.1” which is the reverse of 192.168.1.2. Notice no “.” in the shorthand form. So, in this file we could have shortened the entry for ns1.mgarey to read
    “200.1 IN PTR ns1.mgarey.”
    And finally, notice that a PTR record ends with a “.” This is because it is a FQDN. Whenever you specify a FQDN it always ends with a “.”

    Now that we have those two files created, we need to inform the DNS server about them.
    You are going to edit your /etc/named.conf file but before we do that we do this:
    cp -a /etc/named.conf /etc/named.conf.save

    Ok, now use your favorite editor to edit /etc/named.conf. We will be adding the following entries:

    ------------------------------------------------------------
    Code:
    zone "168.192.in-addr.arpa" {
            type master;
            file "/var/named/168.192.in-addr.arpa";
    };
    
    zone "mgarey" {
            type master;
            file "/var/named/mgarey.zone";
            allow-update { none; };
    };
    ------------------------------------------------------------

    Insert those two entries at the end of the named.conf file just before the include “/etc/rndc.key” statement.

    OK, we are ready! But .... before we restart the DNS we will take a copy of the new file.
    cp -a /etc/named.conf /etc/named.conf.new

    Now we can restart the DNS. If it gives any errors or refuses to start we can just do,
    cp -a /etc/named.conf.save /etc/named.conf” and restart the DNS again to go back to the original settings.

    Ok, lets restart the DNS - “service named restart

    We should have two new working zones so lets test them ....

    dig @192.168.1.200 cp-server.mgarey

    dig @192.168.1.200 -x 192.168.1.2

    and the last command should also work as just:

    dig -x 192.168.1.2

    If it works thus far then we can continue with getting the machines to recognize the new domains.

  7. #7
    Just Joined!
    Join Date
    Sep 2013
    Location
    Alberta, Canada
    Posts
    17
    I tested the settings on my server and there were a few errors. These settings should work correctly.

    create: /var/named/mgarey.zone
    Code:
    $ttl 1D
    mgarey.	IN      SOA     ns1.mgarey. root (
                            2013100401	; Serial - YYYYMMDDnn
                            3600		; Refresh - 1 Hour
                            120		; Retry - 2 Minutes
                            1209600	; Expire - 2 Weeks
                            86400 )	; Minimum - 24 Hours
    
    mgarey.		IN      NS      ns1.mgarey.
    mgarey.		IN      NS      s146063.trixbox.fonality.com.
    
    ns1.mgarey.		IN      A       192.168.1.200
    cp-server		IN      A       192.168.1.2
    create: /var/named/168.192.in-addr.arpa.zone
    Code:
    $TTL 1D
    
    @       IN      SOA     ns1.mgarey.  root (
     		2009042801		; Serial - YYYYMMDDnn
     		3600			; Refresh - 1 Hour
     		120			; Retry - 2 Minutes
     		1209600		; Expire - 2 Weeks
    		86400)			; Minimum - 24 Hours
    
    ; ------------------------- Name Server Records -------------------------- ;
            IN      NS      ns1.mgarey.
            IN      NS      s146063.trixbox.fonality.com.
    ; ------------------------- Backbone Equipment --------------------------- ;
    
    200.1.168.192.in-addr.arpa.	PTR	ns1.mgarey.
    2.1				PTR	cp-server.mgarey.


    add to: /etc/named.conf
    Code:
    zone "mgarey" {
            type master;
            file "/var/named/mgarey.zone";
            };
    
    zone "168.192.in-addr.arpa" {
            type master;
            file "/var/named/168.192.in-addr.arpa.zone";
    };

  8. #8
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9
    First of all, thanks for all the detailed help! Your explanations and samples make sense. I followed your steps (and used your 2nd group of files) and named restarts ok. I then ran the dig commands:

    Code:
    [root@trixbox146063 named]# dig @192.168.1.200 cp-server.mgarey
    
    ; <<>> DiG 9.2.4 <<>> @192.168.1.200 cp-server.mgarey
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 62347
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;cp-server.mgarey.              IN      A
    
    ;; Query time: 0 msec
    ;; SERVER: 192.168.1.200#53(192.168.1.200)
    ;; WHEN: Mon Oct  7 13:48:03 2013
    ;; MSG SIZE  rcvd: 34
    
    [root@trixbox146063 named]# dig @192.168.1.200 -x 192.168.1.2
    
    ; <<>> DiG 9.2.4 <<>> @192.168.1.200 -x 192.168.1.2
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 16089
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;2.1.168.192.in-addr.arpa.      IN      PTR
    
    ;; Query time: 0 msec
    ;; SERVER: 192.168.1.200#53(192.168.1.200)
    ;; WHEN: Mon Oct  7 13:48:21 2013
    ;; MSG SIZE  rcvd: 42
    
    [root@trixbox146063 named]# dig -x 192.168.1.2
    
    ; <<>> DiG 9.2.4 <<>> -x 192.168.1.2
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 39805
    ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;2.1.168.192.in-addr.arpa.      IN      PTR
    
    ;; AUTHORITY SECTION:
    168.192.in-addr.arpa.   10800   IN      SOA     localhost. nobody.invalid. 1 360
    0 1200 604800 10800
    
    ;; Query time: 25 msec
    ;; SERVER: 4.2.2.2#53(4.2.2.2)
    ;; WHEN: Mon Oct  7 13:48:38 2013
    ;; MSG SIZE  rcvd: 101
    I tried nslookup and ping on the Linux box but still cannot find it.

  9. #9
    Just Joined!
    Join Date
    Sep 2013
    Location
    Alberta, Canada
    Posts
    17
    Bit confusing why this is not working. However, let us replace the code with:

    /var/named/mgarey.zone
    Code:
    $ttl 24H
    mgarey.	IN	SOA	ns1.mgarey. root (
    			2013100703
    			1H
    			2M
    			2W
    			38400 )
    mgarey.	IN	NS	ns1.mgarey.
    ns1.mgarey.	IN	A	192.168.1.200
    cp-server.mgarey.	IN	A	192.168.1.2
    and in:

    /etc/named.conf
    Code:
    zone "mgarey" {
            type master;
            file "/var/lib/named/master/mgarey.zone";
            };
    Restart named and then try"
    Code:
    dig @192.168.1.200 mgarey axfr
    You should see something like:
    Code:
    root@trixbox146063 named]# dig @192.168.1.200 mgarey axfr
    
    ; <<>> DiG 9.6-ESV-R7-P3 <<>> @192.168.1.200 mgarey axfr
    ; (1 server found)
    ;; global options: +cmd
    mgarey.                 86400   IN      SOA     ns1.mgarey. root.mgarey. 2013100703 3600 120 1209600 38400
    mgarey.                 86400   IN      NS      ns1.mgarey.
    cp-server.mgarey.       86400   IN      A       192.168.1.2
    ns1.mgarey.             86400   IN      A       192.168.1.200
    mgarey.                 86400   IN      SOA     ns1.mgarey. root.mgarey. 2013100703 3600 120 1209600 38400
    ;; Query time: 0 msec
    ;; SERVER: 192.168.1.200#53(192.168.1.200)
    ;; WHEN: Mon Oct  7 13:24:14 2013
    ;; XFR size: 5 records (messages 1, bytes 161)

  10. #10
    Just Joined!
    Join Date
    Oct 2013
    Posts
    9
    That did not seem to make any difference. If this is too much trouble, we can punt and I can put in another DNS server.
    Code:
    [root@trixbox146063 ~]# service named restart
    Stopping named:                                            [  OK  ]
    Starting named:                                            [  OK  ]
    [root@trixbox146063 ~]# ping cp-server
    ping: unknown host cp-server
    [root@trixbox146063 ~]# nslookup cp-server
    Server:         4.2.2.2
    Address:        4.2.2.2#53
    
    ** server can't find cp-server: NXDOMAIN
    
    [root@trixbox146063 ~]# dig @192.168.1.200 mgarey axfr
    
    ; <<>> DiG 9.2.4 <<>> @192.168.1.200 mgarey axfr
    ; (1 server found)
    ;; global options:  printcmd
    ; Transfer failed.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •