BIND9 is running but not pinging my domain - dns

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/

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

Replace patterns on file except one line in it

I am looking for a solution to replace one pattern on a file except one line in it.
For example:
zone file:
> cat /var/named/test.com.db
; cPanel first:11.11.0-BETA_16994 (update_time):1468656855 Cpanel::ZoneFile::VERSION:1.3 hostname:server.test.com latest:11.56.0.13
; Zone file for test.com
$TTL 14400
test.com. 86400 IN SOA ns1.test.com. cpanel.test.com. (
2016071602 ;Serial Number
14400 ;refresh
7200 ;retry
2419200 ;expire
43200 )
test.com. 14400 IN A 192.168.1.100
localhost 14400 IN A 127.0.0.1
test.com. 14400 IN MX 0 test.com.
mail 14400 IN CNAME test.com.
www 14400 IN CNAME test.com.
ftp 14400 IN CNAME test.com.
webdisk 14400 IN A 192.168.1.100
cpcalendars 14400 IN A 192.168.1.100
test.com. IN TXT "v=spf1 +a +mx +ip4:192.168.1.100 ~all"
I want to replace all current IP address 192.168.1.100 in it with 192.168.1.101 except the "spf" record line.
How can this be done?.
sed '/spf/! s/192\.168\.1\.100/192.168.1.101/'
On lines which do not match /spf/ do the requested substitution. The backslashes prevent the . from matching any character, of course. If you have any lines where the IP address could appear multiple times, you could add a g at the end. If you think it is a real problem, you could worry about matching 9192.168.1.1001 (that is, you if you think the IP address might appear as a substring of something that isn't an IP address).
Try this
sed -i -r 's/192.168.1.100$/192.168.1.101/g' /var/named/test.com.db

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).

how to configure hostname to have identical name as subdomain?

I've accomplished the following easily on a unix system, but I don't manage to get the same configured on a MS Windows server:
subdomain.example.org is a zone, so that I can setup child hostnames like host.subdomain.example.org. Furthermore, subdomain.example.org is also an entry point to the subdomain and runs a webserver. For that purpose I create an A record that points to an IP address. That is, the hostname is identical with the subdomain name.
I don't seem to be able to reproduce this on the windows server. once I create the subdomain, I can't add the A record. What's the secret to getting this up and running?
When creating A records you can use the # symbol for the record name to indicate the parent record i.e. no record name. In your case this applies to subdomain zones (and beyond).
example.com = # IN A 1.2.3.4
www.example.com = www IN A 192.168.0.2
Example raw dns zone file:
$TTL 14400
$ORIGIN example.com.
# 1D IN SOA ns1.example.com. hostmaster.example.com. (
2002022401 ; serial
3H ; refresh
15 ; retry
1w ; expire
3h ; minimum
)
IN NS ns1.example.com. ; in the domain
IN NS ns2.smokeyjoe.com. ; external to domain
IN MX 10 mail.another.com. ; external mail provider
# IN A 1.2.3.4 ; root record here would be value for example.com
ns1 IN A 192.168.0.1 ;name server definition
www IN A 192.168.0.2 ;web server definition
ftp IN CNAME www.example.com. ;ftp server definition
bill IN A 192.168.0.3
fred IN A 192.168.0.4

Bind DNS host pointing name servers to different IPs

Okay, at the moment i have my domain's host file which was generated by the Webmin control panel. I have a box to myself with several IPs and i want to make use of more than one. I don't fully understand everything to do with host files but I know enough to get by.
Can anyone suggest how i would go about changing the below host file to make my two name servers and mail server have their own IPs and then my domains and sub domains share another?
$ttl 120
# IN SOA ns1.example.com. webmaster.example.com. (
1283718781
1D
120
7D
120 )
example.com. IN NS ns1.example.com.
example.com. IN A 192.168.0.1
www.example.com. IN A 192.168.0.1
ftp.example.com. IN A 192.168.0.1
m.example.com. IN A 192.168.0.1
localhost.example.com. IN A 127.0.0.1
webmail.example.com. IN A 192.168.0.1
admin.example.com. IN A 192.168.0.1
mail.example.com. IN A 192.168.0.1
example.com. IN MX 5 mail.example.com.
example.com. IN NS ns2.example.com.
[edit]
Just to add, can you also suggest any improvements because at present initial loading of the website is slow, i did a dns test from an online tool and resolving was taking a long while. After the first page load the site's home page then loads in less than 2 seconds, presumably because stuff has been cached after the first load.
please and thanks in advance for any help.
I'm not sure if I understood your question but I would use following zone file for example.com domain:
$ttl 120
# IN SOA ns1.example.com. webmaster.example.com. (
2010091401 ; Serial format YYYYmmddXX where XX is 01-99
1D
120
7D
120 )
IN NS ns1.example.com.
IN NS ns2.example.com.
IN MX 5 mail.example.com.
IN A 192.168.0.1
ns1 IN A 192.168.xxx.xxx ; ns1 ip
ns2 IN A 192.168.xxx.xxx ; ns2 ip
www IN A 192.168.0.1
ftp IN A 192.168.0.1
m IN A 192.168.0.1
webmail IN A 192.168.0.1
admin IN A 192.168.0.1
mail IN A 192.168.0.1
localhost IN A 127.0.0.1

Resources