BIND9ã§å åãDNSæ§ç¯ on Ubuntu
ã¯ããã«
ç¾å¨ã®æã家ã®ãããã¯ã¼ã¯æ§æã¯ãããªæãã§ãã
åºå®IPã¢ãã¬ã¹ãè¨è¿°ãã¦ãããã¹ãã«å¯¾ãã¦ãã¡ã¤ã³åã§ã¢ã¯ã»ã¹ã§ããããã«ããããªã¨èãã¾ããã
ã§ãUbuntuã«DNSãµã¼ããç«ã¦ã¦ãããã¨ã«ãã¾ããåºæ¥ä¸ããã¤ã¡ã¼ã¸ã¯ãã¡ãã
æ©å¨å | æ©å¨ã®ä¸»ãªç¨é | ãã¹ãå | ãã¼ã«ã«IPã¢ãã¬ã¹ | å¥å |
---|---|---|---|---|
WZR-HP-G450H | ã«ã¼ã¿ | tartan.mnb | 192.168.24.1 | router.mnb |
CG-NSC2100GT | NAS | glen.mnb | 192.168.24.3 | nas01.mnb |
MSI-Wind | å種ãµã¼ã | argyle.mnb | 192.168.24.93 | ns.mnb |
ãã¹ãåã¯ããããèãããã§ãããã§ãã¯æã®ç¨®é¡ã«ãã¾ãããæè¿ã¢ã¼ã¬ã¤ã«æã®ã«ã¼ãã£ã¬ã³ããããã¦ãã®ã§ãã¾ãè²·ã£ã¦ãªããã§ããã©ããã§ãã«ã¼ããã¡ã¤ã³åã¯èåããæ¯é³ãæãã"mnb"ã¨ããæååã«ãã¾ãããè¥ç«¹ãããªã"wktk"ãå·å´ãããªã"kwsk"ãªãã¦å ·åã«ãªãã¾ããã
BIND9ã®ã¤ã³ã¹ãã¼ã«
ã¾ãã¯DNSãµã¼ãã®ããã¥ã©ã¼ãªå®è£ BIND9ãã¤ã³ã¹ãã¼ã«ãã¾ãã
$ sudo apt-get install bind9
BIND9ã®è¨å®
è¨å®ãã¡ã¤ã«ãè¦ã¦ã¿ã¾ãã
/etc/bind/named.conf
// This is the primary configuration file for the BIND DNS server named. // // Please read /usr/share/doc/bind9/README.Debian.gz for information on the // structure of BIND configuration files in Debian, *BEFORE* you customize // this configuration file. // // If you are just adding zones, please do that in /etc/bind/named.conf.local include "/etc/bind/named.conf.options"; include "/etc/bind/named.conf.local"; include "/etc/bind/named.conf.default-zones";
3ã¤ã®è¨å®ãã¡ã¤ã«ãã¤ã³ã¯ã«ã¼ããã¦ããã ãã®ããã§ãã
åã
ã®ç¨éã®è¨å®ãã¡ã¤ã«ãæ¸ãæãã¦ããã¾ãã
ã¾ãã¯ãã®DNSãµã¼ãã«å¯¾ãã¦åãåããå¯è½ãªã®ã¯èªåèªèº«ããã³åããããã¯ã¼ã¯ããã®ãªã¯ã¨ã¹ãã®ã¿ã¨ãã¾ãã
/etc/bind/named.conf.options
options { directory "/var/cache/bind"; // If there is a firewall between you and nameservers you want // to talk to, you may need to fix the firewall to allow multiple // ports to talk. See http://www.kb.cert.org/vuls/id/800113 // If your ISP provided one or more IP addresses for stable // nameservers, you probably want to use them as forwarders. // Uncomment the following block, and insert the addresses replacing // the all-0's placeholder. // forwarders { // 0.0.0.0; // }; auth-nxdomain no; # conform to RFC1035 listen-on-v6 { any; }; // 以ä¸ã追å allow-query { // èªåèªèº«ï¼ localhost ï¼ 127.0.0.1; // 192.168.24.* ( Subnet 255.255.255.0 ) 192.168.24.0/24; }; };
次ã«ã©ããªãªã¯ã¨ã¹ãã«å¯¾ãã¦å¿çããããã¾ããã®å¿çã«é¢ããè¨å®ãã¡ã¤ã«ãã©ãã«ç½®ãããå®ç¾©ãã¾ãã
ä»åã¯ããmnbãã¨ããã«ã¼ããã¡ã¤ã³åãå«ããã¡ã¤ã³åã§ã®ãªã¯ã¨ã¹ãã192.168.24.* ã¨ããIPã¢ãã¬ã¹ã§ã®ãªã¯ã¨ã¹ãã«å¯¾ãã¦ã®å¿çãåãããã¨ã¨ãã¾ããã
/etc/bind/named.conf.local
// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; // mnb ã®æ£å¼ãã®è¨å® zone "mnb" { // Master DNS Serverã§ãããã¨ãæ示 type master; // è¨å®ãã¡ã¤ã«å file "/etc/bind/db.mnb"; }; // 192.168.24.* ã®éå¼ãã®è¨å® zone "24.168.192.in-addr.arpa" { // Master DNS Serverã§ãããã¨ãæ示 type master; // è¨å®ãã¡ã¤ã«å file "/etc/bind/db.24.168.192"; };
次ã«åã
ã®è¨å®ãã¡ã¤ã«ã®ä¸èº«ãè¨è¿°ãã¦ããã¾ãã
ã¾ãã¯æ£å¼ãã®è¨å®ãã¡ã¤ã«ã®ã»ãã
/etc/bind/db.mnb
; BIND reverse data file for empty rfc1918 zone ; $TTL 1D ; @ IN SOA mnb. root.mnb ( 2011102401 ; Serial 3H ; Refresh 1H ; Retry 1W ; Expire 1D ) ; Minimum IN NS argyle.mnb. ; tartan IN A 192.168.24.1 ; glen IN A 192.168.24.3 ; argyle IN A 192.168.24.93 ; router IN CNAME tartan ; nas01 IN CNAME glen ; ns IN CNAME argyle ;
å¼ãç¶ãéå¼ãã®è¨å®ã
/etc/bind/db.24.168.192
; BIND reverse data file for empty rfc1918 zone ; $TTL 1D ; @ IN SOA ns.mnb. root.ns.mnb ( 2011102301 ; Serial 3H ; Refresh 1H ; Retry 1W ; Expire 1D ) ; Minimum IN NS ns.mnb. ; Name Server ãæå® IN PTR mnb. ; 解決ãããã¡ã¤ã³ IN A 255.255.255.0 ; ãµãããããã¹ã¯ 1 IN PTR tartan ; 192.168.24.1 ã®éå¼ã 3 IN PTR glen ; 192.168.24.3 ã®éå¼ã 93 IN PTR argyle ; 192.168.24.93 ã®éå¼ã
è¨å®ã¯ä»¥ä¸ã
BIND9ããªã¹ã¿ã¼ããã¦ã¿ã¾ãã
$ sudo service bind9 restart
* Stopping domain name service... bind9
...done.
* Starting domain name service... bind9
...done.
åé¡ãªãèµ·åã§ããããã§ãã
DHCPãµã¼ãã®è¨å®
次ã«DHCPãµã¼ããIPä¾çµ¦ãã¦ãã端æ«ãã¡ã«ãã¼ã ãµã¼ãã®æå¨ãæãã¦ãããããã«è¨å®ãã¾ãã
ã«ã¼ã¿ã«DHCPãµã¼ããåãã£ã¦ããã®ã§Webã®è¨å®ç»é¢ããè¨å®ãã¦ããã¾ãã
使ç¨ãã¦ããã«ã¼ã¿ï¼WZR-HP-G450Hï¼ã®Webè¨å®ç»é¢ã«ãã°ã¤ã³ã㦠Internet/LAN > LAN ã®ç»é¢ã§ãDHCPãµã¼ãè¨å®[æ¡å¼µè¨å®]ãã®æ¡å¼µè¨å®ã表示ããããã§ãã¯ãã¾ãã
ããã¨è¨å®ç»é¢ãã¹ã«ã¹ã«ãã¨åºã¦ãã¾ãã
ããã§ãDNSãµã¼ãã¼ã®éç¥ãã§ãæå®ããIPã¢ãã¬ã¹ããé¸æãã¦ãã©ã¤ããªã«å
ã»ã©BIND9ãè¨ç½®ãããã·ã³ã®IPã¢ãã¬ã¹ãè¨å
¥ãã¾ããã»ã«ã³ããªã¼ã«ã¯ã«ã¼ã¿èªèº«ï¼DHCPãµã¼ãèªèº«ï¼ï¼ã®IPã¢ãã¬ã¹ããã¨ã®ãã¨ãåèã«ãããµã¤ããªã©ã«æ¸ãã¦ãã£ãã®ã§ãããã¦ããã¾ãããã®æç¨æ§ã«ã¤ãã¦ã¯ã¾ãæ©ä¼ãããã°èª¿ã¹ã¦ãããã¨ãããã¨ã§ã
MacBook Proã«ã¦ãããã¯ã¼ã¯æ§æããDHCPãªã¼ã¹ãæ´æ°ãã¦ã¿ã¾ããã
ã«ã¼ã¿ã§è¨å®ããå¤ãDNSãµã¼ãã¨ãã¦æ¡ç¨ããã¦ãã¾ãã
ã§ã¯ã¡ããã¨ã²ããã®ããã¹ãã©ï¼
確èª
mac$ nslookup > argyle.mnb Server: 192.168.24.93 Address: 192.168.24.93#53 Name: argyle.mnb Address: 192.168.24.93 > tartan.mnb Server: 192.168.24.93 Address: 192.168.24.93#53 Name: tartan.mnb Address: 192.168.24.1 > glen.mnb Server: 192.168.24.93 Address: 192.168.24.93#53 Name: glen.mnb Address: 192.168.24.3 > ns.mnb Server: 192.168.24.93 Address: 192.168.24.93#53 ns.mnb canonical name = argyle.mnb. Name: argyle.mnb Address: 192.168.24.93 > nas01.mnb Server: 192.168.24.93 Address: 192.168.24.93#53 nas01.mnb canonical name = glen.mnb. Name: glen.mnb Address: 192.168.24.3 > router.mnb Server: 192.168.24.93 Address: 192.168.24.93#53 router.mnb canonical name = tartan.mnb. Name: tartan.mnb Address: 192.168.24.1 > 192.168.24.1 Server: 192.168.24.93 Address: 192.168.24.93#53 1.24.168.192.in-addr.arpa name = tartan.24.168.192.in-addr.arpa. > 192.168.24.3 Server: 192.168.24.93 Address: 192.168.24.93#53 3.24.168.192.in-addr.arpa name = glen.24.168.192.in-addr.arpa. > 192.168.24.93 Server: 192.168.24.93 Address: 192.168.24.93#53 93.24.168.192.in-addr.arpa name = argyle.24.168.192.in-addr.arpa.
æ£å¼ããéå¼ããã§ãã¦ã¾ããå¥åã§ã®ã¢ã¯ã»ã¹ã大ä¸å¤«ããã§ãã
ããã£ãããã£ãã
åé ã®ãããã¯ã¼ã¯æ§æå³ã«ãã¹ãåãå ãã¦ããã¾ãã
次ã¯VPN越しにもホスト名でアクセスできるように設定ãã¦ã¿ãã¤ããã§ãã