Defining view statement in DNS server running on Ubnutu 20.02

Discussion in 'Installation/Configuration' started by muruganandan, Dec 31, 2020.

  1. muruganandan

    muruganandan New Member

    I have configured Authoritative DNS server in ubuntu 20.04 and its running fine. But when I tried define view statement to classify internal, external zones, I got the error that all the zone must be under view statements. I knew it and tried to define the zone in multiple ways under the view statements but none worked it gave different error.

    Please anyone give suggestion where to place the view statements whether in
    named.conf.local or named.conf.options or in named.conf.default-zones.
    My config is below

    named.conf.options

    act "trusted" { localhost; "trusted" };

    options {
    listen-on port {trusted; 127.0.0.1; };
    directory "/var/cache/bind";
    listen-on { trusted; 127.0.0.1; };
    recursion yes;
    allow recursion { trusted; };
    allow-transfer {sec IP }

    dnssec-validation auto;

    listen-on-v6 { any; };
    };
    named.conf.local

    zone "128.88.103.in-addr.arpa" {
    type master;
    file "/etc/bind/db.128";
    allow-transfer { 103.224.129.3; };
    also-notify { 103.224.129.3; };
    };
    zone "129.88.103.in-addr.arpa" {
    type master;
    file "/etc/bind/db.129";
    allow-transfer { 103.224.129.3; };
    also-notify { 103.224.129.3; };
    };

    In named.conf, named.conf.default-zone files I have not changed anything. Now the server works fine without view statements.But I need to include that statements. Please help. I already have configured these things in CENTOS and worked fine. But in the ubuntu it seems little confusing. I have tried it in

    in the named.conf.options file as below

    };
    view "in" {
    match-clients { trusted; };
    recursion yes;
    };
    include "/ect/bind/named.conf.default-zones";

    it did not work, then I changed it like

    view "in" {
    include "/ect/bind/named.conf.default-zones";
    match-clients { trusted; };
    recursion yes;
    };
    include :/etc/bind/zone.rfc1918;"

    but no luck. I did this same thing on files named.conf.local and even in named.conf no one method gave me success and I'm tired
    The same server is working fine without view statements.
    Please suggestt how to define view statements in the bind version 19.6
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Check what your bind version really is. Then verify that version does support views.
     
  3. muruganandan

    muruganandan New Member


    Yes it does the version of bind version is 9.16.1 stable release. The documents it has been mentioned.

    If it does not support it won't give error. Please correct me if I'm wrong. I tried all the possible ways at some the error stopped but it gives another error like expected " (" near line 17 in named.conf where really no config exist.
     
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  5. muruganandan

    muruganandan New Member

    Thanks,,

    Bu I have tried this already, it even gave the same error that is all the zone should inside the view statement. I just copied the same config.
    at the one point I have managed to set config but it started to give some another error on named.conf.
    Even I tried some others links also I have spent two days on this and gave up and configured the server without it.
    I tried the different config on possible on all the files ( named.conf, named.conf.options and named.conf.default-zones
    like the blow

    view "in" {
    include "/ect/bind/named.conf.default-zones";
    match-clients { trusted; };
    recursion yes;
    };
    include :/etc/bind/zone.rfc1918;"


    view "in" {
    include "/ect/bind/named.conf.default-zones";
    include :/etc/bind/zone.rfc1918";
    include :/etc/bind/named.conf.local";
    match-clients { trusted; };
    recursion yes;
    };

    but nothing helped out.
    Thinking some minute mistake Im making that I could not find out, Once I configured this on old ubuntu version that was different than Centos7.
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    This looks like authoritative documentation:
    https://kb.isc.org/docs/aa-00851
    There the view name is not in quotation marks. Also, I would be wary naming view "in", it may be reserved word.
    What is on line 17 and a few lines before that?
     
    muruganandan likes this.
  7. muruganandan

    muruganandan New Member

    There the view name is not in quotation marks. Also, I would be wary naming view "in", it may be reserved word.

    What is on line 17 and a few lines before that?[/QUOTE]
    Thanks for the link

    There is nothing before line 17, there are only three lines in the named.conf file that are
    include "/etc/bind/named.conf.options";
    include include "/ect/bind/named.conf.default-zones";
    include "/etc/bind/named.conf.local";

    and the zones have been configured on named.local file, in the named.conf.option I have declared the acls.
    for the view statement I have different named like internal , inside and other name
    If the name in is reserved it would have thrown error. its recommened in the docs to declare zone in the named.local.

    while defining the view I have included the named.conf.default-zones file link which has default zones, and zone.rfc1918
    named.conf.local

    view "in" {
    match-clients { trusted; };
    recursion yes;

    zone "129.88.103.in-addr.arpa" {
    type master;
    file "/etc/bind/db.129";
    allow-transfer { 103.224.129.3; };
    also-notify { 103.224.129.3; };
    };
    include "/ect/bind/named.conf.default-zones";
    include "/etc/bind/zone.rfc1918
    ";

    this is what I have added in the named.conf.local
    where can the view be defined, in the named.conf file or in the options file and local file. If it defined in named.options file I have mentioned all the zone links.
     
  8. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Where is ACL trusted defined?
     
    muruganandan likes this.
  9. muruganandan

    muruganandan New Member

    It is named.conf.options and in the very beginning of thr line.
    named.conf.options

    act "trusted" { localhost; prefixes; };
    options {
    listen-on port {trusted; 127.0.0.1; };
    directory "/var/cache/bind";
    listen-on { trusted; 127.0.0.1; };
    recursion yes;
    allow recursion { trusted; };
    allow-transfer {sec IP; };

    dnssec-validation auto;

    listen-on-v6 { any; };
    };
     
  10. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Try defining your views on named.conf and move the include statements for default zones and named.conf.local inside the view definition.
     
    muruganandan likes this.
  11. muruganandan

    muruganandan New Member

    Thanks a lot this works, I made it.. I just missed this step when I tried

    acl "MTEL" { 103.88.128.0/24; };
    include "/etc/bind/named.conf.options";
    view "internal" {
    match-clients { localhost; MTEL; };
    recursion yes;
    allow-recursion { MTEL; };
    include "/etc/bind/named.conf.default-zones";
    include "/etc/bind/named.conf.local";

    };
    view "external" {
    match-clients { any; };
    match-destinations { any; };
    allow-query { any; };
    recursion no;

    include "/etc/bind/named.conf.local";
    };

    Thanks you so much I have spent two days in different ways but nothing worked. These simple steps made the day.
     
    Jesse Norell likes this.

Share This Page