{"id":167349,"date":"2013-01-28T12:41:05","date_gmt":"2013-01-28T08:41:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=167349"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=167349","title":{"rendered":"<span class=\"post_title\">dynDNS \u0434\u043b\u044f Amazon EC2 \u0438\u043b\u0438 \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 IP \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c IP<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 Ubuntu 12.04 \u043d\u0430 Amazon EC2 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u043c\u0443 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u043e\u043d\u0435, \u043d\u043e \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e Amazon \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0448\u0438\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c bash (\u0434\u043b\u044f *nix) \u0438 bat (\u0434\u043b\u044f Windows) \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 bash \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <a href=\"http:\/\/www.ducea.com\/2009\/06\/01\/howto-update-dns-hostnames-automatically-for-your-amazon-ec2-instances\/\">Marius Ducea Jun 1st, 2009 \u0433\u043e\u0434\u0430<\/a>. \u041e\u043d \u0431\u044b\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u0432 \u043f\u043b\u0430\u043d\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 API \u043e\u0442 Amazon, \u043d\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0432\u043e\u0451\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c.<br \/>  \u0412\u0441\u0451 \u0436\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 BIND \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e, \u0445\u043e\u0442\u044f \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434:<br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/101380\/\">habrahabr.ru\/post\/101380\/<\/a><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/45921\/\">habrahabr.ru\/post\/45921\/<\/a><br \/>  \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u0445.<\/p>\n<p>  \u042f \u043b\u0438\u0448\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0437\u0430\u0441\u0443\u043d\u0443\u043b \u0435\u0433\u043e \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 bat-\u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f Windows, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432 cURL \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u043e\u0442 BIND.<\/p>\n<p>  \u0414\u043e\u043b\u0433\u043e \u043c\u0443\u0447\u0438\u043b\u0441\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043e\u043d\u0443 (master \u0438 slave \u0431\u044b\u043b\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u043d\u0430 Ubuntu 10.04 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c BIND), \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0430 \u043d\u0451\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435 \/etc\/bind\/named.conf \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043b\u043e\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u043f\u0430\u043f\u043a\u0443 \u0432 \/var\/log\/named\/  <\/p>\n<pre><code class=\"bash\">logging {     channel bind_log {     file &quot;\/var\/log\/named\/named.log&quot;;     print-time yes;     print-category yes;     print-severity yes;     };     channel update_debug {     file &quot;\/var\/log\/named\/update-debug.log&quot;;     severity debug 3;     print-time yes;     print-category yes;     print-severity yes;     };     channel security_info {     file &quot;\/var\/log\/named\/security-info.log&quot;;     severity info;     print-time yes;     print-category yes;     print-severity yes;     };     category default { bind_log;};     category xfer-in { bind_log;};     category xfer-out { bind_log;};     category update { update_debug;};     category security { security_info;}; }; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435  <\/p>\n<pre><code class=\"bash\">\/etc\/init.d\/bind9 restart <\/code><\/pre>\n<p>  \u043b\u043e\u0433\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043e\u043d\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d, \u043d\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0438, \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b 512 \u0431\u0438\u0442:  <\/p>\n<pre><code class=\"bash\">dnssec-keygen -a HMAC-MD5 -b 512 -r \/dev\/urandom -n USER example.com <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 2 \u0444\u0430\u0439\u043b\u0430:  <\/p>\n<pre><code class=\"bash\">Kexample.com.+157+10000.key Kexample.com.+157+10000.private <\/code><\/pre>\n<p>  \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 private \u2014 \u043a\u043b\u044e\u0447\u0443:  <\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  #\u041f\u0443\u0442\u044c \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 DNS_KEY=&quot;\/etc\/bind\/key\/Kexample.com.+157+10000.private&quot; #\u0418\u043c\u044f \u0434\u043e\u043c\u0435\u043d\u0430 DOMAIN=example.com  #\u0418\u043c\u044f \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d\u0430 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 HOSTNAME=site1 #\u0420\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0438\u0436\u043d\u0438\u0435 2 \u0441\u0442\u0440\u043e\u043a\u0438, \u0435\u0441\u043b\u0438 \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043c\u044f (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 DNS) #USER_DATA=`\/usr\/bin\/curl -s http:\/\/169.254.169.254\/latest\/meta-data\/local-hostname` #HOSTNAME=`echo $USER_DATA` #\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043c\u044f \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 hostname $HOSTNAME.$DOMAIN echo \u041f\u043e\u0434\u0434\u043e\u043c\u0435\u043d \u0438 \u0434\u043e\u043c\u0435\u043d: $HOSTNAME.$DOMAIN  PUBIP=`\/usr\/bin\/curl -s http:\/\/169.254.169.254\/latest\/meta-data\/public-ipv4` echo \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441: $PUBIP cat&lt;&lt;EOF | \/usr\/bin\/nsupdate -k $DNS_KEY -v server ns1.$DOMAIN zone $DOMAIN update delete $HOSTNAME.$DOMAIN A update add $HOSTNAME.$DOMAIN 60 A $PUBIP send EOF  LOCIP=`\/usr\/bin\/curl -s http:\/\/169.254.169.254\/latest\/meta-data\/local-ipv4` echo \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441: $LOCIP cat&lt;&lt;EOF | \/usr\/bin\/nsupdate -k $DNS_KEY -v server ns1.$DOMAIN zone $DOMAIN update delete local.$HOSTNAME.$DOMAIN A update add local.$HOSTNAME.$DOMAIN 60 A $LOCIP send EOF <\/code><\/pre>\n<p>  , \u0430 \u0432 DNS \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0437\u043e\u043d (\u0443 \u043c\u0435\u043d\u044f \u044d\u0442\u043e named.conf.local):  <\/p>\n<pre><code class=\"bash\">key example.com. {         algorithm HMAC-MD5;         secret &quot;ynl7o+JFPekH4iUaptw7z12xLhkUBJTmqbmTYa1xe+Gpt26HVaff+qQW hlmWcvAUeYdg19B+M4YeFrfhAvlcLQ==&quot;; }; zone &quot;example.com&quot; {         type master;         file &quot;\/etc\/bind\/master\/example.com&quot;;         allow-update { key example.com.; };         allow-query { any; };  }; <\/code><\/pre>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430:  <\/p>\n<pre><code class=\"bash\">example.com. IN KEY 0 3 157 ynl7o+JFPekH4iUaptw7z12xLhkUBJTmqbmTYa1xe+Gpt26HVaff+qQW hlmWcvAUeYdg19B+M4YeFrfhAvlcLQ== <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 \u0441 master\/slave\u2013\u0437\u0430\u043f\u0438\u0441\u044c\u0441\u044c\u044e DNS \u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433\u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043e\u043d\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 Amazon.<\/p>\n<p>  \u0411\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043e\u0442\u043b\u0443\u043f:<br \/>  named.log  <\/p>\n<pre><code class=\"bash\">26-Jan-2013 22:53:27.780 update-security: info: client 192.168.254.1#58180: signer &quot;example.com&quot; approved 26-Jan-2013 22:53:27.782 general: error: \/etc\/bind\/master\/example.com.jnl: create: permission denied 26-Jan-2013 22:53:27.881 update-security: info: client 192.168.254.1#52062: signer &quot;example.com&quot; approved 26-Jan-2013 22:53:27.883 general: error: \/etc\/bind\/master\/example.com.jnl: create: permission denied <\/code><\/pre>\n<p>  update-debug.log  <\/p>\n<pre><code class=\"bash\">26-Jan-2013 22:53:27.780 update: info: client 192.168.254.1#58180: updating zone 'example.com\/IN': deleting rrset at 'flussonic.example.com' A 26-Jan-2013 22:53:27.781 update: info: client 192.168.254.1#58180: updating zone 'example.com\/IN': adding an RR at 'flussonic.example.com' A 26-Jan-2013 22:53:27.781 update: debug 3: client 192.168.254.1#58180: updating zone 'example.com\/IN': checking for NSEC3PARAM changes 26-Jan-2013 22:53:27.782 update: info: client 192.168.254.1#58180: updating zone 'example.com\/IN': error: journal open failed: unexpected error 26-Jan-2013 22:53:27.882 update: info: client 192.168.254.1#52062: updating zone 'example.com\/IN': deleting rrset at 'local.flussonic.example.com' A 26-Jan-2013 22:53:27.882 update: info: client 192.168.254.1#52062: updating zone 'example.com\/IN': adding an RR at 'local.flussonic.example.com' A 26-Jan-2013 22:53:27.882 update: debug 3: client 192.168.254.1#52062: updating zone 'example.com\/IN': checking for NSEC3PARAM changes 26-Jan-2013 22:53:27.883 update: info: client 192.168.254.1#52062: updating zone 'example.com\/IN': error: journal open failed: unexpected error <\/code><\/pre>\n<p>  \u0432 \u043b\u043e\u0433\u0430\u0445 \u0431\u044b\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0447\u0442\u043e \u043d\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u0445\u043e\u0442\u044f \u043d\u0430 \u0444\u0430\u0439\u043b\u0430\u0445 \u0438 \u043f\u0430\u043f\u043a\u0430\u0445 \u0441\u0442\u043e\u044f\u043b\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0433\u0440\u0443\u043f\u043f\u044b bind.<br \/>  \u041f\u043e\u0438\u0441\u043a\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0433\u043b\u0430\u0441\u0438\u043b\u0438 \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 \/etc\/apparmor.d\/usr.sbin.named<br \/>  c  <\/p>\n<pre><code class=\"bash\">\/etc\/bind\/** r, <\/code><\/pre>\n<p>  \u043d\u0430  <\/p>\n<pre><code class=\"bash\">\/etc\/bind\/** rw, <\/code><\/pre>\n<p>  , \u043d\u043e \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0442\u044c \u0437\u043e\u043d, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043d\u043e \u044f \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0441\u044c \u043d\u0430 \u0430\u0432\u043e\u0441\u044c.<br \/>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0441\u0430\u043c BIND  <\/p>\n<pre><code class=\"bash\">\/etc\/init.d\/apparmor restart \/etc\/init.d\/bind9 restart <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 DNS \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u0438\u0441\u0447\u0435\u0437\u043b\u0430 \u0438 \u0437\u043e\u043d\u0430 \u0431\u043b\u0430\u0433\u043e\u043f\u043e\u043b\u0443\u0447\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0430\u0441\u044c, \u043d\u043e \u0432\u0441\u0435 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0443\u0442\u0435\u0440\u044f\u043d\u044b, \u0442.\u043a. bind \u00ab\u043d\u0430\u0432\u0451\u043b \u043f\u043e\u0440\u044f\u0434\u043e\u043a\u00bb \u0432 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0438 \u043f\u043e\u0443\u0434\u0430\u043b\u044f\u043b \u043b\u0438\u0448\u043d\u0435\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <b>\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u0432\u0441\u0435\u0445 \u0437\u043e\u043d<\/b>.<\/p>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u043c, \u0442.\u043a. \u043f\u043e\u0441\u043b\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0438 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 ssh \u043d\u0430 \u0443\u0436\u0430\u0441\u043d\u043e\u0435 \u0438\u043c\u044f ec2-55-240-2-74.compute-1.amazonaws.com (\u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f) \u0438 \u0440\u0443\u043a\u0430\u043c\u0438 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0447\u0442\u043e \u0431\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u043e\u043d\u0443.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b \u0432 \/etc\/init.d\/  <\/p>\n<pre><code class=\"bash\">chmod +x ec2-hostname.sh cp ec2-hostname.sh \/etc\/init.d\/ update-rc.d ec2-hostname.sh defaults <\/code><\/pre>\n<p>  \u0414\u043b\u044f Windows \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435:  <\/p>\n<pre><code class=\"bash\">@echo off Setlocal enabledelayedexpansion rem \u041f\u0443\u0442\u044c \u043a \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443 set DNS_KEY=&quot;Kexample.com.+157+10000.private&quot; rem \u0418\u043c\u044f \u0434\u043e\u043c\u0435\u043d\u0430 set DOMAIN=example.com rem \u0418\u043c\u044f \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d\u0430 set HOSTNAME=site1 echo \u041f\u043e\u0434\u0434\u043e\u043c\u0435\u043d \u0438 \u0434\u043e\u043c\u0435\u043d: %HOSTNAME%.%DOMAIN%  for \/F &quot;Delims=&quot; %%P In ('curl -s http:\/\/169.254.169.254\/latest\/meta-data\/public-ipv4') Do Set PUBIP=%%~P echo \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441: %PUBIP% ( @echo server ns1.%DOMAIN% @echo zone %DOMAIN% @echo update delete %HOSTNAME%.%DOMAIN% A @echo update add %HOSTNAME%.%DOMAIN% 60 A %PUBIP% @echo send ) | nsupdate -k %DNS_KEY% -v   for \/F &quot;Delims=&quot; %%L In ('curl -s http:\/\/169.254.169.254\/latest\/meta-data\/local-ipv4') Do Set LOCIP=%%~L echo \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441: %LOCIP% ( @echo server ns1.%DOMAIN% @echo zone %DOMAIN% @echo update delete local.%HOSTNAME%.%DOMAIN% A @echo update add local.%HOSTNAME%.%DOMAIN% 60 A %LOCIP% @echo send ) | nsupdate -k %DNS_KEY% -v   :eof <\/code><\/pre>\n<p>  \u0418 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0448\u0435\u0434\u0443\u043b\u0435\u0440 \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<br \/>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e cURL \u0431\u0440\u0430\u043b \u0437\u0434\u0435\u0441\u044c: <a href=\"http:\/\/www.paehl.com\/open_source\/\">www.paehl.com\/open_source\/<\/a><br \/>  BIND: <a href=\"https:\/\/www.isc.org\/software\/bind\">www.isc.org\/software\/bind<\/a> <br \/>  \u041e\u0442 BIND \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b:  <\/p>\n<pre><code class=\"bash\">libisc.dll liblwres.dll libisccfg.dll libbind9.dll libeay32.dll libdns.dll libxml2.dll nsupdate.exe <\/code><\/pre>\n<p>  \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u044f\u0434\u043e\u043c \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0438\u043b\u0438 \u0436\u0435 \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u0432 %WINDIR%\\system32<\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u0438\u0437 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e:<br \/>  \u0425\u043e\u0442\u044c \u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u0434\u0430\u043d\u043d\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0442\u044c DNS \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441\u0442\u0430\u043b\u0430 \u0435\u0449\u0451 \u043c\u0435\u043d\u044c\u0448\u0435, \u0442.\u043a. \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0438 \u0440\u0438\u0441\u043a \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0437\u043e\u043d\u0443.<br \/>  <b>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0437\u0434\u0435\u0441\u044c, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0447\u0451\u0442\u043a\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0447\u0442\u043e \u0436\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u043f\u0438\u044e \u0432\u0441\u0435\u0445 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u044b\u0445 \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0441\u0431\u043e\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/b><br \/>  \u0417\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u044f \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e, \u0442.\u043a. \u0441\u0430\u043c \u043d\u0435 \u0443\u0432\u0435\u0440\u0435\u043d \u0432 \u0435\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  P.S.<br \/>  \u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u0442\u0430\u043a\u043e\u0439 \u0441\u0443\u043c\u0431\u0443\u0440\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b:<\/b><\/p>\n<div class=\"spoiler_text\"><a href=\"http:\/\/www.ducea.com\/2009\/06\/01\/howto-update-dns-hostnames-automatically-for-your-amazon-ec2-instances\/\">www.ducea.com\/2009\/06\/01\/howto-update-dns-hostnames-automatically-for-your-amazon-ec2-instances\/<\/a><br \/>  <a href=\"http:\/\/www.k-max.name\/linux\/howto-dns-server-bind\/\">www.k-max.name\/linux\/howto-dns-server-bind\/<\/a><br \/>  <a href=\"http:\/\/www.k-max.name\/linux\/osnovnye-komandy-linux-ili-shpargalka-nachinayushhego-linuksojda\/#dns\">www.k-max.name\/linux\/osnovnye-komandy-linux-ili-shpargalka-nachinayushhego-linuksojda\/#dns<\/a><br \/>  <a href=\"http:\/\/www.networkcenter.info\">www.networkcenter.info<\/a><br \/>  <a href=\"http:\/\/cruw.blogspot.ru\/2012\/03\/dig-dns.html\">cruw.blogspot.ru\/2012\/03\/dig-dns.html<\/a><br \/>  <a href=\"http:\/\/forum.ubuntu.ru\/index.php?topic=29295.0\">forum.ubuntu.ru\/index.php?topic=29295.0<\/a><br \/>  <a href=\"http:\/\/forum.ubuntu.ru\/index.php?topic=28580.0\">forum.ubuntu.ru\/index.php?topic=28580.0<\/a><br \/>  <a href=\"http:\/\/help.ubuntu.ru\/wiki\/%D1%81%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D0%B5_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0_%D0%B0%D0%B2%D1%82%D0%BE%D0%B7%D0%B0%D0%BF%D1%83%D1%81%D0%BA%D0%B0\">help.ubuntu.ru\/wiki\/%D1%81%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D0%B5_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0_%D0%B0%D0%B2%D1%82%D0%BE%D0%B7%D0%B0%D0%BF%D1%83%D1%81%D0%BA%D0%B0<\/a><br \/>  <a href=\"http:\/\/www.paehl.com\/open_source\/\">www.paehl.com\/open_source\/<\/a><br \/>  <a href=\"https:\/\/www.isc.org\/software\/bind\">www.isc.org\/software\/bind<\/a><br \/>  <a href=\"http:\/\/wiki.inisec.com\/index.php\/Nsupdate_for_windows\">wiki.inisec.com\/index.php\/Nsupdate_for_windows<\/a><br \/>  <a href=\"http:\/\/google.com\">google.com<\/a><br \/>  \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435  <\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/167349\/\"> http:\/\/habrahabr.ru\/post\/167349\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0432\u0441\u0442\u0430\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 Ubuntu 12.04 \u043d\u0430 Amazon EC2 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u043c\u0443 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0434\u043e\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u043e\u043d\u0435, \u043d\u043e \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e Amazon \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0448\u0438\u043d\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c bash (\u0434\u043b\u044f *nix) \u0438 bat (\u0434\u043b\u044f Windows) \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-167349","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/167349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=167349"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/167349\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}