server: Name or service not known BIND9 - linux

root#server: ping -c 4 servidor
ping: servidor: Name or service not known
Could someone please tell me if I have any syntax errors or is it some other kind of error? Thank you very much in advance.

The db.domain.com file should be as follows, You also forgot the NS records
$ORIGIN .
$TTL 604800 ; 1 week
domain.com IN SOA f95. root.domain.com. (
165 ; serial
604800 ; refresh (1 week)
86400 ; retry (1 day)
2419200 ; expire (4 weeks)
604800 ; minimum (1 week)
)
NS ns1.domain.com.
NS ns2.domain.com.
AAAA ::1
MX 10 mail.domain.com.
after any change to this file you should change serial number and then restart bind service.

Related

Is it possible to have a wildcard CNAME Record and an MX Record?

Is it possible to have a wildcard CNAME Record and an MX Record? Would these conflict?
*.example.com CNAME example.com
example.com MX 1 aspmx.l.google.com
They won't conflict since they are not on the same name (*.example.com vs example.com), once you put things in proper zonefile format.
But you could even simply say:
*.example.com MX 1 aspmx.l.google.com
Of course this is only half of the story, as the host under the MX record must also be properly configured to receive emails coming from all subdomains.
You can easily check things like that using named-checkzone.
$ cat zone1
example.com. 1 IN SOA ns.icann.org. noc.dns.icann.org. (
2019112601 ; serial
7200 ; refresh (2 hours)
3600 ; retry (1 hour)
1209600 ; expire (2 weeks)
3600 ; minimum (1 hour)
)
example.com. 1 IN NS a.iana-servers.net.
example.com. 1 IN NS b.iana-servers.net.
*.example.com 1 CNAME example.com
example.com 1 MX 1 aspmx.l.google.com
$ named-checkzone -i none example.com zone1
zone example.com/IN: loaded serial 2019112601
OK

DNS not resolving after configuring it with BIND

I have a new VPS with CWP installed. This is the file for my domain:
; Generated by CWP
; Zone file for erpuno.cl
$TTL 14400
erpuno.cl. 86400 IN SOA erpuno.cl. contacto.erpuno.cl. (
2019050600 ; serial, todays date+todays
86400 ;refresh, seconds
7200 ;retry, seconds
3600000 ;expire, seconds
86400 )
erpuno.cl. 86400 IN NS ns1.erpuno.cl.
erpuno.cl. 86400 IN NS ns2.erpuno.cl.
erpuno.cl. IN A 45.7.228.32
vps.erpuno.cl. IN A 45.7.228.32
ns1.erpuno.cl. IN A 45.7.228.32
ns2.erpuno.cl. IN A 45.7.228.32
localhost.erpuno.cl. IN A 127.0.0.1
erpuno.cl. IN MX 0 erpuno.cl.
mail IN CNAME erpuno.cl.
www IN CNAME erpuno.cl.
ftp IN CNAME erpuno.cl.
; Add additional settings below this line
_dmarc 14400 IN TXT "v=DMARC1; p=none"
But the DNS is not resolving. I can't access de URL and DNS lookup services don't find it. What am I doing wrong?
When I run dig erpuno.cl, I get:
; <<>> DiG 9.9.4-RedHat-9.9.4-73.el7_6 <<>> erpuno.cl
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23843
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;erpuno.cl. IN A
;; ANSWER SECTION:
erpuno.cl. 14400 IN A 45.7.228.32
;; AUTHORITY SECTION:
erpuno.cl. 86400 IN NS ns1.erpuno.cl.
erpuno.cl. 86400 IN NS ns2.erpuno.cl.
;; ADDITIONAL SECTION:
ns1.erpuno.cl. 14400 IN A 45.7.228.32
ns2.erpuno.cl. 14400 IN A 45.7.228.32
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon May 06 21:43:27 -04 2019
;; MSG SIZE rcvd: 122
Everything seems normal. And both the config file and the zone file have no errors.
From my PC I can ping the IP of the server, but not the domain. But from the console of the VPS I can ping the domain.
The firewall has the ports open, so that's not the issue either.
Any ideas??
Make sure your resolv.conf file have the following lines:
domain yourdomain
nameserver ipaddr(of the machine with the dns server installed)

BIND9 is running but not pinging my domain

There is a cloud server with IP 51.254.79.239
tt1.domain.com and tt2.domain.com are the name servers.
these are the zone options used
zone "domain.com" {
type master;
file "/etc/bind/db.domain.com";
};
zone "79.254.51.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.51";
};
db.domain.com file
$TTL 14400
# IN SOA tt1.domain.com. root.domain.com. (
17
7200
3600
1209600
180 )
# 14400 IN NS tt1.domain.com.
# 14400 IN NS tt2.domain.com.
tt1 14400 IN A 51.254.79.239
tt2 14400 IN A 51.254.79.239
# 14400 IN A 51.254.79.239
mail 14400 IN A 51.254.79.239
www 14400 IN A 51.254.79.239
pop 14400 IN A 51.254.79.239
ftp 14400 IN A 51.254.79.239
# 14400 IN MX 10 mail.domain.com.
# 14400 IN TXT "v=spf1 a mx ip4:51.254.79.239 ?all"
_dmarc 14400 IN TXT "v=DMARC1; p=none"
and the rev
$TTL 604800
# IN SOA tt1.domain.com. root.domain.com. (
16 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
IN NS tt1.domain.com
IN NS tt2.domain.com.
79.254.51 IN PTR tt1.domain.com. ; 51.254.79.239
79.254.51 IN PTR tt2.domain.com. ; 51.254.79.239
and it's Active: active (running) since Mon !
what it could be the problem that there is no ping answer on domain.com?!
Ping, if you use it with a hostname, involves looking up the name, but what you check is connectivity not DNS.
From your example, I can see, that both of your supposed "nameservers" are in fact the same server, as the one they are resolving. So I strongly assume, this "name server" is not authoritative, which means, no other name server in the hierarchy cares for the information it has. Did you think, you can just setup a nameserver and it would be queried for the domain, you told it?
You can easily check for the primary name server, with:
dig +short SOA domain.com
Or for all authoritative name servers with:
dig +short NS domain.com
whois also gives you this information.
Usually your provider gives you some interface to the resource records pertaining to your domain and updates the authoritative name servers accordingly, so you should probably look for this first.
You can then check, if everything with your changes is ok, with many online tools, for example this:
http://viewdns.info/dnsreport/

Bind9 Servfail, unknown host

I'm new to bind9. I've fixed a lot of issues, but now I need some help.
I basically just want to bind my domain magestionfacile.fr and some subdomains to 94.23.108.206.
Here's my configuration files:
named.conf.local
zone "magestionfacile.fr" {
type master;
allow-transfer {94.23.108.206;};
file "/etc/bind/db.magestionfacile.fr";
};
db.magestionfacile.fr
;
; BIND reverse data file for broadcast zone
;
; Time To Live
$TTL 604800
; General Informations
# IN SOA magestionfacile.fr. root.magestionfacile.fr. (
10 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; Domain TTL IN Type Value
IN NS ns354747.ovh.net.
IN NS sdns1.ovh.net.
IN NS sdns2.ovh.net.
# IN A 94.23.108.206
vmx IN A 94.23.108.206
vimexcom IN CNAME vmx.magestionfacile.fr.
ownercheck IN TXT "some_number"
The three NS directives, I'm not sure if it's the right values. I mean, I'm not even sure if only one DNS server is sufficient so...
Some tests:
odoo#yann-acer-portable:~$ nslookup magestionfacile.fr 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: magestionfacile.fr
Address: 94.23.108.206
odoo#yann-acer-portable:~$ nslookup magestionfacile.fr
Server: 127.0.1.1
Address: 127.0.1.1#53
** server can't find magestionfacile.fr: SERVFAIL
odoo#yann-acer-portable:~$ ping magestionfacile.fr
ping: unknown host magestionfacile.fr
odoo#yann-acer-portable:~$ ping vmx.magestionfacile.fr
ping: unknown host vmx.magestionfacile.fr
I'm aware that usually, you need two DNS servers, right ? Can I do with one ? Thanks for the help !
SERVFAIL means that the nameserver for one reason or another could not produce a valid answer to the question. For more information, you need to look in the nameserver log file (although if what you posted up there is the entire zone file, the problem likely is a missing $ORIGIN).

Create a DNS NSRecord

My server is a Ubuntu, and I have installed webmin/virtualmin and I´m trying to create my NSRecord ns1 and ns2.
I run this command:
dig #localhost mydomain.info
; DiG 9.7.3 #localhost mydomain.info
; (1 server found)
;; global options: +cmd
;; Got answer:
;; HEADER opcode: QUERY, status: NOERROR, id: 64570
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;mydomain.info. IN A
;; ANSWER SECTION:
mydomain.info. 38400 IN A 10.28.166.120
;; AUTHORITY SECTION:
mydomain.info. 38400 IN NS ns1.mydomain.info.
;; ADDITIONAL SECTION:
ns1.mydomain.info. 38400 IN A 10.28.166.120
But 10.28.166.120 it´s my local IP, I try to find any information on /var/log/syslog about Bind and I didn´t see anything.
In Firewall I configured the ports like this:
Incoming open ports:
TCP/53
UDP/53
Outgoing open ports:
TCP/53
UDP/53
TCP/1024-65535
UDP/1024-65535
So, know I put my complete dns record:
$ttl 38400
# IN SOA ns1.mydomain.info. root.ns1.mydomain.info. (
1342267814
10800
3600
604800
38400 )
# IN NS ns1.mydomain.info.
mydomain.info. IN A 10.28.166.120
www.mydomain.info. IN A 10.28.166.120
ftp.mydomain.info. IN A 10.28.166.120
m.mydomain.info. IN A 10.28.166.120
ns1.mydomain.info. IN A 999.999.999.999
localhost.mydomain.info. IN A 127.0.0.1
webmail.mydomain.info. IN A 10.28.166.120
admin.mydomain.info. IN A 10.28.166.120
mydomain.info. IN TXT "v=spf1 a mx a:mydomain.info ip4:10.28.166.120 ?all"
999.999.999.999 = my external IP
I´m tried post some questions like this and anyone help on other forums. If anyone don´t undestand something I will try to explain.
Thank´s.
BIND runs as named, so that is what you should look for in the logs. (Though nothing is actually wrong with this setup, so I doubt there would be anything in the logs).
I'm not sure how you've set up the records in your zone, but each NS record points to an A record. The NS record looks fine, but the A record is wrong. The other NS record and/or its corresponding A record are missing. You will have to change the A record for ns1.mydomain.info. to your external address. There is no simple way to use both an internal and external IP for a single machine (for a complicated way, see split-horizon views).

Resources