7,164
edits
(→内部 DNS) |
(→内部 DNS) |
||
Line 126: | Line 126: | ||
<syntaxhighlight lang="bash" enclose="div"> | <syntaxhighlight lang="bash" enclose="div"> | ||
/bin/hostname -s | /bin/hostname -s | ||
# | # host名が返る | ||
/bin/hostname -f | /bin/hostname -f | ||
# | # fqdnが返る | ||
/bin/hostname -d | /bin/hostname -d | ||
# | # ドメイン名が返る | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 204: | Line 204: | ||
ec2-set-dns-zone | ec2-set-dns-zone | ||
(内部 DNS 設定用) | (内部 DNS 設定用) | ||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python" enclose="div"> | ||
#!/usr/bin/python | #!/usr/bin/python | ||
# | # | ||
Line 267: | Line 267: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight> | <syntaxhighlight lang="bash" enclose="div"> | ||
sudo chmod +x /usr/local/etc/init/ec2-set-dns-zone | sudo chmod +x /usr/local/etc/init/ec2-set-dns-zone | ||
</syntaxhighlight> | </syntaxhighlight> | ||
/usr/local/etc/bind/templates/zone.tmpl | /usr/local/etc/bind/templates/zone.tmpl | ||
<syntaxhighlight lang="text" enclose="div"> | |||
; | ; | ||
; BIND data file for Split DNS | ; BIND data file for Split DNS | ||
Line 285: | Line 286: | ||
@ 604800 IN A $localipv4 | @ 604800 IN A $localipv4 | ||
@ 604800 IN MX 10 @ | @ 604800 IN MX 10 @ | ||
</syntaxhighlight> | |||
/usr/local/etc/bind/templates/zone.tmpl | /usr/local/etc/bind/templates/zone.tmpl | ||
<syntaxhighlight lang="text" enclose="div"> | |||
; | ; | ||
; BIND data file for Split DNS | ; BIND data file for Split DNS | ||
Line 299: | Line 302: | ||
@ 604800 IN NS localhost. | @ 604800 IN NS localhost. | ||
@ 604800 IN PTR $fqdn. | @ 604800 IN PTR $fqdn. | ||
</syntaxhighlight> | |||
/usr/local/etc/bind/templates/conf.tmpl | /usr/local/etc/bind/templates/conf.tmpl | ||
<syntaxhighlight lang="text" enclose="div"> | |||
zone "$fqdn" { | zone "$fqdn" { | ||
type master; | type master; | ||
Line 311: | Line 315: | ||
file "/etc/bind/db.myarpa"; | file "/etc/bind/db.myarpa"; | ||
}; | }; | ||
</syntaxhighlight> | |||
/etc/bind/named.conf.local に以下を追加する | /etc/bind/named.conf.local に以下を追加する | ||
<syntaxhighlight lang="text" enclose="div"> | |||
include "/etc/bind/myzone.conf"; | include "/etc/bind/myzone.conf"; | ||
</syntaxhighlight> | |||
/etc/bind/named.conf.options の forwarders を EC2 の内部 DNS サーバに設定 | /etc/bind/named.conf.options の forwarders を EC2 の内部 DNS サーバに設定 | ||
<syntaxhighlight lang="text" enclose="div"> | |||
forwarders { | forwarders { | ||
172.16.0.23; | 172.16.0.23; | ||
}; | }; | ||
</syntaxhighlight> | |||
/etc/bind/named.conf.options の listen address 制限しておく | /etc/bind/named.conf.options の listen address 制限しておく | ||
<syntaxhighlight lang="text" enclose="div"> | |||
// listen-on-v6 { any; }; | // listen-on-v6 { any; }; | ||
listen-on { 127.0.0.1; }; | listen-on { 127.0.0.1; }; | ||
listen-on-v6 { ::1; }; | listen-on-v6 { ::1; }; | ||
</syntaxhighlight> | |||
起動スクリプトとしてリンク | 起動スクリプトとしてリンク | ||
<syntaxhighlight> | <syntaxhighlight lang="bash" enclose="div"> | ||
sudo ln -s /usr/local/etc/init/ec2-set-hosts /etc/rc2.d/S12ec2-set-hosts | sudo ln -s /usr/local/etc/init/ec2-set-hosts /etc/rc2.d/S12ec2-set-hosts | ||
sudo ln -s /usr/local/etc/init/ec2-set-dns-zone /etc/rc2.d/S13ec2-set-dns-zone | sudo ln -s /usr/local/etc/init/ec2-set-dns-zone /etc/rc2.d/S13ec2-set-dns-zone |