0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure DNS に Bind ゾーンファイルのインポートを試してみた

Posted at

検証用の Bind ゾーンファイルを作成

bash
$ cat /etc/os-release | grep PRETTY_NAME
PRETTY_NAME="Ubuntu 22.04.1 LTS"

$ sudo apt install bind9

$ systemctl status named

$ cd /etc/bind

$ sudo cp db.empty db.example.jp

$ sudo sed -i 's/localhost/example.jp/g' db.example.jp

$ echo "@       IN      A       192.168.10.10" | sudo tee -a db.example.jp

$ cat db.example.jp
; BIND reverse data file for empty rfc1918 zone
;
; DO NOT EDIT THIS FILE - it is used for multiple zones.
; Instead, copy it, edit named.conf, and use that copy.
;
$TTL    86400
@       IN      SOA     example.jp. root.example.jp. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                          86400 )       ; Negative Cache TTL
;
@       IN      NS      example.jp.
@       IN      A       192.168.10.10

$ named-checkzone example.jp db.example.jp 
zone example.jp/IN: loaded serial 1
OK

検証用の Azure DNS を作成

bash
$ az network dns zone create \
  --resource-group mnrlabo-rg \
  --name example.jp

$ az network dns zone import \
  --resource-group mnrlabo-rg \
  --name example.jp \
  --file-name db.example.jp

In the future, zone name will be case insensitive.
== BEGINNING ZONE IMPORT: example.jp ==

(1/3) Imported 1 records of type 'soa' and name '@'
(2/3) Imported 1 records of type 'NS' and name '@'
(3/3) Imported 1 records of type 'a' and name '@'

== 3/3 RECORDS IMPORTED SUCCESSFULLY: 'example.jp' ==

$ az network dns zone export \
  --resource-group mnrlabo-rg \
  --name example.jp

; Exported zone file from Azure DNS
;      Zone name: example.jp
;      Resource Group Name: mnrlabo-rg
;      Date and time (UTC): Sat, 11 Mar 2023 08:40:27 +0900

$TTL 86400
$ORIGIN example.jp.
    
@ 86400 IN SOA ns1-09.azure-dns.com. root.example.jp. (
               1 ; serial
               604800 ; refresh
               86400 ; retry
               2419200 ; expire
               86400 ; minimum
               )

  86400 IN A 192.168.10.10

  86400 IN NS ns1-09.azure-dns.com.
  86400 IN NS ns2-09.azure-dns.net.
  86400 IN NS ns3-09.azure-dns.org.
  86400 IN NS ns4-09.azure-dns.info.

$ az network dns zone delete \
  --resource-group mnrlabo-rg \
  --name example.jp \
  --yes

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?