I'm trying to setup my own nameservers like ns1.example.com on my VPS
I already setup the nameservers of my domain in Namecheap.com (ns1 and ns2, pointing to the IP address of my VPS). I can't seem to make it working. Opening example.com doesn't show-up anything:
$ curl example.com
curl: (7) Failed to connect to example.com port 80: No route to host
Note that Apache is working fine, since I can open it using VPS IP. Here's my server configuration
/etc/hostname
ns1
/etc/hosts
127.0.0.1 localhost.localdomain localhost
172.31.1.100 ns1.example.com ns1
172.31.1.100 ns2.example.com ns2
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
2a01:4f8:c17:1eeb::2 ns1.example.com ns1
2a01:4f8:c17:1eeb::2 ns2.example.com ns2
/etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
/etc/bind/named.conf.options
options {
directory "/var/cache/bind";
recursion no;
allow-transfer { none; };
dnssec-validation auto;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 {
any;
};
};
/etc/bind/named.conf.local
zone "example.com" {
type master;
file "/var/lib/bind/example.com.hosts";
allow-transfer {
127.0.0.1;
localnets;
172.31.1.100;
};
};
/etc/bind/named.conf.default-zones;
zone "." {
type hint;
file "/etc/bind/db.root";
};
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
/var/lib/bind/example.com.hosts
$ttl 38400
@ IN SOA example.com. root.example.com. (
1486054499
10800
3600
604800
38400 )
example.com. IN NS ns1.example.com.
example.com. IN NS ns2.example.com.
ns1.example.com. IN A 172.31.1.100
ns2.example.com. IN A 172.31.1.100
example.com. IN A 172.31.1.100
www.example.com. IN A 172.31.1.100
ftp.example.com. IN A 172.31.1.100
m.example.com. IN A 172.31.1.100
localhost.example.com. IN A 127.0.0.1
mail.example.com. IN A 172.31.1.100
example.com. IN MX 5 mail.example.com.
example.com. IN TXT "v=spf1 a mx a:example.com ip4:172.31.1.100 ip6:2a01:4f8:c17:1eeb::2 ?all"