LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   bind DNS issues resolving MX (https://www.linuxquestions.org/questions/linux-server-73/bind-dns-issues-resolving-mx-4175535620/)

tripialos 03-03-2015 07:23 AM

bind DNS issues resolving MX
 
Hi everyone.

I am quiye new to DNS (bind) and i started recently to setup my own domain and dns servers in order to gain some experience and see how things working from practical view.

So i got my domain, lets say "mysite.net" and rented two (2) cheap vps which act as nameservers (ns1 and ns2). One primary and one secondary. Actually the one server also act as a mail server with postfix.

My problem is that when i "dig" for mx records i dont get any answear. I only get answear if i query my dns server but when i query lets say google`s servers still dont get any respond.

Here is my bind config:


Code:


; A_RECORDS
ns1        IN A 111.111.111.111
ns2        IN A 222.222.222.222
server    IN A 111.111.111.111
junior    IN A 222.222.222.222
mail      IN A 111.111.111.111

; CNAME
vpn        IN CNAME server
gitlab    IN CNAME server
www        IN CNAME server

; MX_RECORDS
mysite.net.  IN MX 10 mail.mysite.net.

and some tests:

Code:

dude@station:~$ping -c 5 server.mysite.net
PING server.mysite.net (111.111.111.111) 56(84) bytes of data.
64 bytes from 111.111.111.111: icmp_seq=1 ttl=47 time=150 ms
64 bytes from 111.111.111.111: icmp_seq=2 ttl=47 time=150 ms
64 bytes from 111.111.111.111: icmp_seq=3 ttl=47 time=150 ms
64 bytes from 111.111.111.111: icmp_seq=4 ttl=47 time=150 ms
64 bytes from 111.111.111.111: icmp_seq=5 ttl=47 time=150 ms

--- server.mysite.net ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 150.188/150.359/150.862/0.553 ms



dude@station:~$ping -c 5 mail.mysite.net
PING mail.mysite.net (111.111.111.111) 56(84) bytes of data.
64 bytes from 111.111.111.111: icmp_seq=1 ttl=47 time=149 ms
64 bytes from 111.111.111.111: icmp_seq=2 ttl=47 time=155 ms
64 bytes from 111.111.111.111: icmp_seq=3 ttl=47 time=148 ms
64 bytes from 111.111.111.111: icmp_seq=4 ttl=47 time=150 ms
64 bytes from 111.111.111.111: icmp_seq=5 ttl=47 time=149 ms

--- mail.mysite.net ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 148.999/150.842/155.766/2.584 ms



dude@station:~$dig mx @8.8.8.8 mail.mysite.net.

; <<>> DiG 9.9.5-3ubuntu0.2-Ubuntu <<>> mx @8.8.8.8 mail.mysite.net.
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7307
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;mail.mysite.net.                IN        MX

;; AUTHORITY SECTION:
mysite.net.                1799        IN        SOA        ns1.mysite.net. admin.mysite.net. 9 604800 86400 2419200 604800

;; Query time: 212 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Tue Mar 03 15:04:52 EET 2015
;; MSG SIZE  rcvd: 93




dude@station:~$dig mx @ns1.mysite.net mail.mysite.net.

; <<>> DiG 9.9.5-3ubuntu0.2-Ubuntu <<>> mx @ns1.mysite.net mail.mysite.net.
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15097
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;mail.mysite.net.                IN        MX

;; AUTHORITY SECTION:
mysite.net.                14400        IN        SOA        ns1.mysite.net. admin.mysite.net. 9 604800 86400 2419200 604800

;; Query time: 152 msec
;; SERVER: 107.150.8.230#53(107.150.8.230)
;; WHEN: Tue Mar 03 15:04:56 EET 2015
;; MSG SIZE  rcvd: 93

As it seems it cant resolve the mx record.


Any advices?

linuxtech99 03-03-2015 09:16 AM

OK. You setup MX record of mysite.net to mail.mysite.net. So you need to lookup the MX record of mysite.net, not mail.mysite.net.


Code:

dig MX mysite.net
dig MX mysite.net @8.8.8.8


tripialos 03-04-2015 02:19 AM

Quote:

Originally Posted by linuxtech99 (Post 5326207)
OK. You setup MX record of mysite.net to mail.mysite.net. So you need to lookup the MX record of mysite.net, not mail.mysite.net.


Code:

dig MX mysite.net
dig MX mysite.net @8.8.8.8


Hi, thanks for your comment. Indeed you are right trying to resolve the server for a hostname rather than the zone however that was an error during the many steps.

I tried to tig with correct zone name and still had no luck. What it did work tho was when i raised the version number in bind configuratom file and now seems to work fine.

I dont know if that was the case but i think when i added the mx record i didnt increase the version number which might have caused this behavour.

Nevertheless things work properly now.

Thnaks for your time


All times are GMT -5. The time now is 06:39 PM.