[6] Aliasy (CNAME)
31 maja 2020Jeśli chcesz, możesz ustawić aliasy (dodatkowe nazwy) dla hostów. Aliasy ustawiamy w pliku strefy.
[1] Ustaw rekord CNAME w pliku strefy
[root@lsr01vm ~]# mcedit /var/named/zicher.lab.lan $TTL 86400 @ IN SOA lsr01vm.zicher.lab. root.zicher.lab. ( # zaktualizuj serial, jeśli zmieniasz plik strefy 2020052901 ;Serial 3600 ;Refresh 1800 ;Retry 604800 ;Expire 86400 ;Minimum TTL ) IN NS lsr01vm.zicher.lab. IN A 192.168.100.101 IN MX 10 lsr01vm.zicher.lab. lsr01vm IN A 192.168.100.1 lsr02vm IN A 192.168.100.2 # [alias] IN CNAME [oryginalna nazwa] ftp IN CNAME lsr01vm.zicher.lab. [root@lsr01vm ~]# rndc reload server reload successful [root@lsr01vm ~]# dig ftp.zicher.lab. ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el8 <<>> ftp.zicher.lab. ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 50474 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ; COOKIE: 7bd08844003a3df231eae5485ed3c231e7d9ba5752e2cc37 (good) ;; QUESTION SECTION: ;ftp.zicher.lab. IN A ;; ANSWER SECTION: ftp.zicher.lab. 86400 IN CNAME lsr01vm.zicher.lab.zicher.lab. ;; AUTHORITY SECTION: zicher.lab. 86400 IN SOA lsr01vm.zicher.lab. root.zicher.lab. 2020052901 3600 1800 604800 86400 ;; Query time: 0 msec ;; SERVER: 192.168.1.101#53(192.168.1.101) ;; WHEN: nie maj 31 16:41:53 CEST 2020 ;; MSG SIZE rcvd: 153