1

I'm trying to create a web server using CentOS7 and Bind DNS on the same server.

If I understand the process correctly then the below inputs should enable me to do an nslookup from a different machine and locate dns1.example.com.

It does not though and I suspect it has to do with DNS1=127.0.0.1.

So I need to change it to the static IP address or server IP address maybe, but when I do this I get an error when doing nslookup (from a different windows pc):

[hub can't find dns1.example.com: Non existant domain] 

Grateful if you can help with this.

[root@server ~]# hostname --fqdn
server.example.com

Below is my /etc/sysconfig/network-scripts/ifcfg-eno1

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno1
UUID=777777-77777-7777-7777-7777777
DEVICE=eno1
ONBOOT=yes
IPADDR=122.168.1.20
PREFIX=24
GATEWAY=122.168.1.24
DOMAIN="example.com"
DNS1=127.0.0.1
NETMASK=255.255.255.0 

Below is my resolv.conf

# Generated by NetworkManager
search example.com home
nameserver 127.0.0.1

Forward zone

$ORIGIN example.com.
$TTL 86400
@       IN SOA dns1.example.com. hostmaster.example.com. (
                                        0       ; serial
                                        21600   ; refresh after 6 hours
                                        3600    ; retry after 1 hour
                                        604800  ; expire after 1 week
                                        86400 ) ; minimum TTL 1 day
        IN      NS              dns1.example.com.
        IN      MX      10      mail.example.com.
        IN      A               122.168.1.20
dns1    IN      A               122.168.1.20
ftp     IN      A               122.168.1.20
mail    IN      CNAME           server
www     IN      CNAME           server

Reverse zone

$ORIGIN 1.168.122.in-addr.arpa.
$TTL 86400
@       IN SOA dns1.example.com. hostmaster.example.com. (
                                        0       ; serial
                                        21600   ; refresh after 6 hours
                                        3600    ; retry after 1 hour
                                        604800  ; expire after 1 week
                                        86400 ) ; minimum TTL 1 day
@       IN      NS              server.example.com.
1       IN      PTR             server.example.com.
2       IN      PTR             server.example.com.
3       IN      PTR             server.example.com.
4       IN      PTR             server.example.com.

`_

options {
    listen-on port 53 { 127.0.0.1; 122.168.1.20; };
    listen-on-v6 port 53 { ::1; };
    directory       "/var/named";
    dump-file       "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { localhost;any; };
    recursion yes;
    dnssec-enable yes;

    dnssec-validation yes;
    /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";
    managed-keys-directory "/var/named/dynamic";
    pid-file "/run/named/named.pid";
    session-keyfile "/run/named/session.key";
};


logging {
    channel default_debug {
            file "data/named.run";
            severity dynamic;
    };
};


zone "." IN {
    type hint;
    file "named.ca";
};

zone "example.com" IN {
    type master;
    file "forward.example.com";
    allow-update { none; };
};

zone "1.168.122.in-addr.arpa" IN {
    type master;
    file "reverse.example.com";
    allow-update { none; };
};


include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";_

`

closed as too broad by user88036, RalfFriedl, A.B, Shadur, Thomas Sep 27 '18 at 17:42

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Show where you include these zone files into your bind config. – wurtel Sep 25 '18 at 12:30
  • HI @wurtel ==> /etc/sysconfig/network-scripts/ifcfg-eno1 ==> /etc/resolv.conf ==> /var/named/reverse.example.com ==> /var/named/forward.example.com ==> service named status ==> Active and running. I hope I am answering your question correctly.. – ian Sep 25 '18 at 12:56
  • No. resolv.conf only directs to you locally installed nameserver (bind). Where in your bind configuration do you add those zone files, so that bind knows what domains and records to serve? – wurtel Sep 25 '18 at 13:36
  • 1
    It's common practice to add the requested extra information to your question by editing it. Could you do that please? That makes it a lot more readable. – wurtel Sep 25 '18 at 14:34
  • 1
    You need to add your local network to the allow-query definition (e.g. 122.168.1.0/24;), if you want to be able to query from different systems on your network. Does the resolving work on the same host as where the nameserver is running? You did use 122.168.1.22 as the nameserver for the windows pc? – wurtel Sep 25 '18 at 14:38

Browse other questions tagged or ask your own question.