Look up a mail server by domain name
To find out which host is running as a mail server within a domain, you can check the MX (Mail Exchanger) record set for that domain.
In this section we will examine the mailservers for the metro.tokyo.jp domain.
From the result of the dig command, you can see that there is a mail server named ml1.tisc.tokyo.jp running in the metro.tokyo.jp domain.
[root@Lion ~]# dig -t mx metro.tokyo.jp
; <<>> DiG 9.9.4-RedHat-9.9.4-72.el7 <<>> -t mx metro.tokyo.jp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50229
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 8, ADDITIONAL: 16
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;metro.tokyo.jp. IN MX
;; ANSWER SECTION:
metro.tokyo.jp. 3253 IN MX 5 ml1.tisc.tokyo.jp.
;; AUTHORITY SECTION:
jp. 149609 IN NS g.dns.jp.
jp. 149609 IN NS h.dns.jp.
jp. 149609 IN NS c.dns.jp.
jp. 149609 IN NS d.dns.jp.
jp. 149609 IN NS b.dns.jp.
jp. 149609 IN NS a.dns.jp.
jp. 149609 IN NS f.dns.jp.
jp. 149609 IN NS e.dns.jp.
;; ADDITIONAL SECTION:
a.dns.jp. 80535 IN A 203.119.1.1
b.dns.jp. 16745 IN A 202.12.30.131
c.dns.jp. 56084 IN A 156.154.100.5
d.dns.jp. 8824 IN A 210.138.175.244
e.dns.jp. 61835 IN A 192.50.43.53
f.dns.jp. 84159 IN A 150.100.6.8
g.dns.jp. 31885 IN A 203.119.40.1
h.dns.jp. 64026 IN A 65.22.40.25
a.dns.jp. 80535 IN AAAA 2001:dc4::1
b.dns.jp. 16745 IN AAAA 2001:dc2::1
c.dns.jp. 56084 IN AAAA 2001:502:ad09::5
d.dns.jp. 8824 IN AAAA 2001:240::53
e.dns.jp. 85423 IN AAAA 2001:200:c000::35
f.dns.jp. 26337 IN AAAA 2001:2f8:0:100::153
h.dns.jp. 64026 IN AAAA 2a01:8840:1ba::25
;; Query time: 5 msec
;; SERVER: 192.168.11.1#53(192.168.11.1)
;; WHEN: Sat 9 26 17:16:17 JST 2020
;; MSG SIZE rcvd: 524 |
The number (5) in front of ml1.tisc.tokyo.jp. indicates the priority.
If more than one mailserver is running, the one with the smaller value will have higher priority.
The DNS client selects the mail server with the highest priority from among several mail servers.