The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

search dns entry

Discussion in 'Bind / DNS / Nameserver Issues' started by crazyaboutlinux, Aug 3, 2009.

  1. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    there are 200 domains hosted on our linux (Centos) server & we would like to know that which domain or domains have below dns entry

    ns1.example.com
    ns2.example.com

    we can check this thing manually by edit dns function , but it takes to much time to check
     
  2. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    You would need to manually check all the domains for the DNS entry. You can also check the DNS entry for the particular domains from the dnstools.com.
     
  3. david510

    david510 Well-Known Member

    Joined:
    Aug 22, 2004
    Messages:
    473
    Likes Received:
    0
    Trophy Points:
    16
    You need to search in the zone files present in the server for the said nameservers? Do you have root access to the server?
     
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Do you want to know which domains you host actually have your DNS servers
    setup as the authoritive nameservers or do you want to see what servers
    are being named in the zone file for the domains in your DNS server(s)?

    There is a huge difference! ;)

    For the former, you would need to perform a "WHOIS" for each domain
    that you host and check what nameservers are shown on the results
    for each domain. You could script this process to make it faster and
    flag those domains that don't return results listing your DNS servers.

    For the later, you can either manually view all the zone files on your server
    at /var/named/*.db or you can grep for those zone files which don't have
    those nameservers listed and then view just those files:

    Code:
    #  cd /var/named
    #  grep -c "ns1.example.com" *.db | grep "\:0" | cut -d':' -f1
    
     
  5. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    i had run above mentioned command but i got following error
    grep: *.db: No such file or directory
     
  6. logicsupport

    logicsupport Well-Known Member

    Joined:
    Jun 5, 2007
    Messages:
    138
    Likes Received:
    0
    Trophy Points:
    16
    Run the following commands and this will help you

    cd /var/named


    grep -il ns1.example.com *.db

    grep -il ns2.example.com *.db
     
  7. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    yes it is nice command it solved my problem but one more question

    i have found that some domains has test.example.com in SOA email option

    check below for further clarification

    SOA
    server: ns1.domain.com
    email: test.example.com
    serial: 2009062904
    refresh: 86400
    retry: 7200
    expire: 3600000
    minimum ttl: 86400

    now i want to remove test.example.com entries which domains has & add some other e.g my.example.com
     
    #7 crazyaboutlinux, Aug 7, 2009
    Last edited: Aug 7, 2009
  8. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    Run this command

    replace test.example.com my.example.com -- file.com.db

    This will replace test.example.com with my.example.com in file.com.db
     
  9. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    is this for one domain only ? if so then it is good but it is much better if you use WHM

    we want to change same entry for multiple domains
     
    #9 crazyaboutlinux, Aug 7, 2009
    Last edited: Aug 7, 2009
  10. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    replace -v test.example.com my.example.com -- *.com.db
     
  11. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    for testing purpose i used this command replace test.example.com my.example.com -- file.com.db but its not success for me

    after run above i checked dns entry from dns function for the domain & i found that my.example.co. note : its not completed " m " is missing after run above command

    Then i have tried to add manually from WHM edit dns function though getting same
     
  12. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    It works for me.

    Code:
    [root@cpanel named]# head example.com.db 
    ; cPanel 11.24.5-STABLE_37946
    ; Zone file for example.com
    $TTL 14400
    @      86400    IN      SOA     ns.server.com. [B]test.example.com[/B]. (
                    2009080701      ; serial, todays date+todays
                    86400           ; refresh, seconds
                    7200            ; retry, seconds
                    3600000         ; expire, seconds
                    86400 )         ; minimum, seconds
    
    [root@cpanel named]# replace -v test.example.com my.example.com -- example.com.db 
    example.com.db converted
    
    User time 0.00, System time 0.00
    Maximum resident set size 0, Integral resident set size 0
    Non-physical pagefaults 266, Physical pagefaults 0, Swaps 0
    Blocks in 0 out 0, Messages in 0 out 0, Signals 0
    Voluntary context switches 1, Involuntary context switches 1
    [root@cpanel named]# head example.com.db 
    ; cPanel 11.24.5-STABLE_37946
    ; Zone file for example.com
    $TTL 14400
    @      86400    IN      SOA     ns.server.com. [B]my.example.com[/B]. (
                    2009080701      ; serial, todays date+todays
                    86400           ; refresh, seconds
                    7200            ; retry, seconds
                    3600000         ; expire, seconds
                    86400 )         ; minimum, seconds
    
     
    #12 JawadArshad, Aug 7, 2009
    Last edited: Aug 7, 2009
  13. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    which command will display above details

    i used head example.com.db "replaced example.com.db with my original domain" but it gives below error

    head: cannot open `example.com.db' for reading: No such file or directory
     
  14. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    wait a minute Howard got a conclusion to this

    you have given this command in first thread " replace test.example.com my.example.com -- file.com.db " (without quote)

    & then i carefully read your another thread & there you use " replace -v test.example.com my.example.com -- example.com.db " so the missing word is " -v "
     
  15. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    -v will just print what the command does, it has no other function like changing how the command will execute on the file/s.
     
  16. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    now i used your actual command which you used

    replace -v test.example.com my.example.com -- example.com.db but it gives another different error

    replace: File 'mytest.com.db' not found (Errcode: 2)

    User time 0.00, System time 0.00
    Maximum resident set size 0, Integral resident set size 0
    Non-physical pagefaults 106, Physical pagefaults 6, Swaps 0
    Blocks in 0 out 0, Messages in 0 out 0, Signals 0
    Voluntary context switches 10, Involuntary context switches 5
     
  17. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    Replace the file names according to the files you are using.
     
  18. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    that is for example only in order to prevent hackers

    i used actual domain & file name where your find test , example & my
     
  19. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    when i run replace command i got following error for every domains

    replace: File 'example.com.db' not found (Errcode: 2)
     
  20. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    Make sure you are in the /var/named folder when you run this command.
     
Loading...

Share This Page