Pages

Sunday 11 February 2018

Configure SRV recorde

An SRV record is intended to provide information on available services for your systems, most commonly used with SIP configuration. SRV records have a unique system for naming. The naming system is an underscore followed by the name of the service, followed by a period, and underscore, and then the protocol, another dot, and then the name of the domain

SRV records are often used to help with service discovery. For example, SRV records are used in Internet Telephony for defining where a SIP service may be found.

An SRV record typically defines a symbolic name and the transport protocol used as part of the domain name, and defines the priority, weight, port and target for the service in the record content.


Here is an example of two SRV records. 

_web._tcp.zmailtech.com.   3600 IN    SRV 10       60     80 web.zmailtech.com.
_web._tcp.zmailtech.com.   3600 IN    SRV 10       20     80 web1.zmailtech.com.




 
From the name, _web is the symbolic name for the service and _tcp is the transport protocol. Note that the symbolic name and transport always start with an underscore. 

The content of the SRV record defines a priority of 10 for both records. The first record has a weight of 60 and the second a weight of 20. The priority and weight values can be used to encourage use of certain servers over others.

The final two values in the record define the port and hostname to connect to for accessing the service.

Edit srv record in local dns service forward zone file. 

[root@master ~]# vim /var/named/zmailtech.com.zone
[root@master ~]# cat /var/named/zmailtech.com.zone
$TTL 1D
@       IN SOA  ns1.zmailtech.com.      admin.zmailtech.com. (
                                        2018021002      ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        IN      NS      ns1.zmailtech.com.
ns1     IN      A       192.168.10.2
master  IN      A       192.168.10.2
mail    IN      A       192.168.10.2
web     IN      A       192.168.10.2
web1    IN      A       192.168.10.2

;CNAME Record
www     IN      CNAME   master.zmailtech.com.
ftp     IN      CNAME   master.zmailtech.com.
smtp    IN      CNAME   master.zmailtech.com.

;MX Record
zmailtech.com.  IN      MX      10      mail.zmailtech.com.
zmailtech.com.  IN      MX      20      smtp.zmailtech.com.

;spf recrod
zmailtech.com.  IN      TXT     "v=spf1 a:192.168.10.2 mx:mail.zmailtech.com ptr:master.zmailtech.com -all"

;srv record
_web._tcp.zmailtech.com.   3600 IN    SRV 10       60     80 web.zmailtech.com.
_web._tcp.zmailtech.com.   3600 IN    SRV 10       20     80 web1.zmailtech.com.

[root@master ~]#

Restart named service after add srv record in forward zone file.

[root@master ~]# systemctl restart named 

Check SRV Record with dig command 
 
[root@master ~]# dig -t SRV _web._tcp.zmailtech.com
 

; <<>> DiG 9.9.4-RedHat-9.9.4-50.el7 <<>> -t SRV _web._tcp.zmailtech.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34416
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 4
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;_web._tcp.zmailtech.com.       IN      SRV

;; ANSWER SECTION:
_web._tcp.zmailtech.com. 3600   IN      SRV     10 20 80 web1.zmailtech.com.
_web._tcp.zmailtech.com. 3600   IN      SRV     10 60 80 web.zmailtech.com.

;; AUTHORITY SECTION:
zmailtech.com.          86400   IN      NS      ns1.zmailtech.com.

;; ADDITIONAL SECTION:
web.zmailtech.com.      86400   IN      A       192.168.10.2
web1.zmailtech.com.     86400   IN      A       192.168.10.2
ns1.zmailtech.com.      86400   IN      A       192.168.10.2

;; Query time: 0 msec
;; SERVER: 192.168.10.2#53(192.168.10.2)
;; WHEN: Sun Feb 11 16:35:43 IST 2018
;; MSG SIZE  rcvd: 193
 

[root@master ~]#
 

No comments:

Post a Comment