{"id":1017,"date":"2010-10-13T20:10:41","date_gmt":"2010-10-13T17:10:41","guid":{"rendered":"http:\/\/www.void.gr\/kargig\/blog\/?p=1017"},"modified":"2010-10-13T23:51:26","modified_gmt":"2010-10-13T20:51:26","slug":"aaaa-records-with-plesk","status":"publish","type":"post","link":"https:\/\/www.void.gr\/kargig\/blog\/2010\/10\/13\/aaaa-records-with-plesk\/","title":{"rendered":"AAAA records with Plesk"},"content":{"rendered":"<p><a href=\"http:\/\/www.parallels.com\/eu\/products\/plesk\/\">Plesk<\/a> is surely not ready for <a href=\"http:\/\/en.wikipedia.org\/wiki\/IPv6\">IPv6<\/a>. Despite that fact, many people &#8211; me included, have the DNS records of their favorite domains managed by Plesk and still want to be able to add some IPv6 records to those.<\/p>\n<p>Some time ago <a href=\"https:\/\/twitter.com\/#!\/kargig\/status\/21475448105\">I had posted on my twitter account<\/a> a link to <a href=\"http:\/\/blog.experimentalworks.net\/2009\/01\/ipv6-aaaa-records-with-plesk-the-hackish-way\/\">another blog that had a &#8220;hackish way&#8221; to add AAAA records to Plesk<\/a>. I have written a slightly more elegant shell script (to be run by root only) than the one provided by experimentalworks.<\/p>\n<p>First of all you _need_ to alter dns_recs table of the psa database to allow AAAA records:<br \/>\n<pre><code2># mysql -u admin -p psa \nmysql&gt; alter table dns_recs modify column type enum(&#039;NS&#039;,&#039;A&#039;,&#039;AAAA&#039;,&#039;CNAME&#039;,&#039;MX&#039;,&#039;PTR&#039;,&#039;TXT&#039;,&#039;SRV&#039;,&#039;master&#039;,&#039;none&#039;) NOT NULL default &#039;A&#039;; <\/code2><\/pre><\/p>\n<p>Then download my <a href=\"http:\/\/void.gr\/kargig\/scripts\/plesk-AAAA.sh\">plesk-AAAA.sh<\/a> script and use it like the following example.<\/p>\n<p>To add www.foobar.gr to point to 2001:db8:1001::1<\/p>\n<blockquote><p>Usage: .\/plesk-AAAA.sh <domain> <hostname> <v6 IP> [zone serial]<br \/>\n#.\/plesk-AAAA.sh foobar.gr www 2001:db8:1001::1<br \/>\n#.\/plesk-AAAA.sh foobar.gr ipv6 2001:db8:1001::1 12<\/v6><\/hostname><\/domain><\/p><\/blockquote>\n<p>Known bug\/feature:<br \/>\nIf you add a record without adding a serial, for the soa record, at the end, it will add the serial of the domain in the form:<\/p>\n<blockquote><p>YYYYMMDD10<\/p><\/blockquote>\n<p>So if you add two ipv6 hosts in the same day for the same domain you _have_ to manually add a serial >10 for the second host (and so forth).<\/p>\n<p>For the ones who don&#8217;t like downloading but would like to see the script source, here it is:<br \/>\n<pre><code2>&nbsp;&nbsp;1 #!\/bin\/sh\n&nbsp;&nbsp;2 \n&nbsp;&nbsp;3 usage () {\n&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;Usage: $0 &lt;domain&gt; &lt;hostname&gt; &lt;v6 IP&gt; [zone serial]&quot;\n&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;Usage: $0 foobar.gr www 2001:db8:1001::1&quot;\n&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit 1\n&nbsp;&nbsp;7 }\n&nbsp;&nbsp;8 \n&nbsp;&nbsp;9 if [ $# -lt 3 ]; then\n 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage\n 11 fi\n 12 DOMAIN=$1\n 13 HOSTNAME=$2\n 14 v6IP=$3\n 15 INPUT_SERIAL=${4:-10}\n 16 FULLHOST=&quot;$2.$1.&quot;\n 17 \n 18 ADMIN_PASS=`cat \/etc\/psa\/.psa.shadow`\n 19 MYSQL_BIN_D=`grep MYSQL_BIN_D \/etc\/psa\/psa.conf | awk &#039;{print $2}&#039;`\n 20 PRODUCT_ROOT_D=`grep PRODUCT_ROOT_D \/etc\/psa\/psa.conf | awk &#039;{print $2}&#039;`\n 21 SERIAL=`date +%Y%m%d${INPUT_SERIAL}`\n 22 mysql=&quot;${MYSQL_BIN_D}\/mysql -N -uadmin -p${ADMIN_PASS} psa&quot;\n 23 \n 24 query1=&quot;SELECT dns_zone_id FROM dns_recs where host like \\&quot;$DOMAIN%\\&quot; LIMIT 0,1&quot;\n 25 ZONE_ID=`echo &quot;$query1&quot; | $mysql`\n 26 echo &quot;ZONE_ID=$ZONE_ID&quot;\n 27 query2=&quot;INSERT INTO dns_recs (displayHost, host, displayVal, val, type, dns_zone_id) VALUES (&#039;$FULLHOST&#039;, &#039;$FULLHOST&#039;, &#039;$v6IP&#039;, &#039;$v6IP&#039;, &#039;AAAA&#039;,$ZONE_ID)&quot;\n 28 echo &quot;$query2&quot; | $mysql\n 29 \n 30 query3=&quot;UPDATE dns_zone SET serial=\\&quot;$SERIAL\\&quot; WHERE id=$ZONE_ID LIMIT 1;&quot;\n 31 echo &quot;$query3&quot; | $mysql\n 32 \n 33 echo &quot;REBUILDING zone file for $DOMAIN&quot;\n 34 $PRODUCT_ROOT_D\/admin\/sbin\/dnsmng update $DOMAIN<\/code2><\/pre><\/p>\n<p>The script has been tested with <a href=\"http:\/\/www.gnu.org\/software\/bash\/\">bash<\/a> and <a href=\"http:\/\/www.zsh.org\/\">zsh<\/a>. I have no idea whether it works under any other shells.<br \/>\nThe script probably won&#8217;t delete your databases, but&#8230;use it at your own risk \ud83d\ude42 I hope someone finds it useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Plesk is surely not ready for IPv6. Despite that fact, many people &#8211; me included, have the DNS records of their favorite domains managed by Plesk and still want to be able to add some IPv6 records to those. Some time ago I had posted on my twitter account a link to another blog that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ep_exclude_from_search":false,"footnotes":""},"categories":[5,3,8],"tags":[302,303,25,199,301,595,599,209,49,304,60],"class_list":["post-1017","post","type-post","status-publish","format-standard","hentry","category-internet","category-linux","category-networking","tag-aaaa","tag-aaaa-record","tag-bash","tag-dns","tag-ipv6","tag-linux","tag-networking","tag-plesk","tag-script","tag-shell","tag-zsh"],"aioseo_notices":[],"views":9404,"_links":{"self":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/1017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/comments?post=1017"}],"version-history":[{"count":9,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/1017\/revisions"}],"predecessor-version":[{"id":1026,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/posts\/1017\/revisions\/1026"}],"wp:attachment":[{"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/media?parent=1017"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/categories?post=1017"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.void.gr\/kargig\/blog\/wp-json\/wp\/v2\/tags?post=1017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}