{"id":813,"date":"2013-04-30T16:41:44","date_gmt":"2013-04-30T20:41:44","guid":{"rendered":"http:\/\/www.xavignu.com\/?p=813"},"modified":"2013-04-30T16:42:31","modified_gmt":"2013-04-30T20:42:31","slug":"dns-records-creator","status":"publish","type":"post","link":"https:\/\/www.xavignu.com\/?p=813","title":{"rendered":"DNS records creator"},"content":{"rendered":"<p>Back around here. Quick post of a small script to create A and PTR <a href=\"http:\/\/en.wikipedia.org\/wiki\/List_of_DNS_record_types\" target=\"blank_\"> dns records<\/a>.<\/p>\n<p>Input file. First column is the IP and second column is the fqdn. We call this file hosts.txt<\/p>\n<p><b>10.124.12.34    athletic.abc.com<br \/>\n192.158.21.32   deportivo.abc.com<br \/>\n92.32.43.12     drac1.abc.com<\/b><\/p>\n<p>Script below:<\/p>\n<p>[bash]<br \/>\n#!\/bin\/bash<\/p>\n<p>while read line; do<br \/>\n        IP=`echo $line | awk &#8216;{print $1}&#8217;`<br \/>\n        HOST=`echo $line | awk &#8216;{print $2}&#8217;`<br \/>\n        PTR=`echo &quot;${IP}&quot; | awk -F\\. &#8216;{print $4&quot;.&quot;$3&quot;.&quot;$2&quot;.&quot;$1&quot;.in-addr.arpa.&quot;}&#8217;`<br \/>\n        echo &quot;${HOST}. IN A ${IP}&quot;<br \/>\n        echo &quot;${PTR} IN PTR ${HOST}.&quot;<br \/>\ndone &lt; hosts.txt<br \/>\n[\/bash]<\/p>\n<p>Execution:<\/p>\n<p><b>me@server:\/tmp$ bash dnsconverter.sh<br \/>\nathletic.abc.com. IN A 10.124.12.34<br \/>\n34.12.124.10.in-addr.arpa. IN PTR athletic.abc.com.<br \/>\ndeportivo.abc.com. IN A 192.158.21.32<br \/>\n32.21.158.192.in-addr.arpa. IN PTR deportivo.abc.com.<br \/>\ndrac1.abc.com. IN A 92.32.43.12<br \/>\n12.43.32.92.in-addr.arpa. IN PTR drac1.abc.com.<br \/>\nme@server:\/tmp$ <\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back around here. Quick post of a small script to create A and PTR dns records. Input file. First column is the IP and second column is the fqdn. We call this file hosts.txt 10.124.12.34 athletic.abc.com 192.158.21.32 deportivo.abc.com 92.32.43.12 drac1.abc.com Script below: [bash] #!\/bin\/bash while read line; do IP=`echo $line | awk &#8216;{print $1}&#8217;` HOST=`echo [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[56,22,6,23,70],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/pTQgt-d7","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/813"}],"collection":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=813"}],"version-history":[{"count":6,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/813\/revisions"}],"predecessor-version":[{"id":820,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=\/wp\/v2\/posts\/813\/revisions\/820"}],"wp:attachment":[{"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xavignu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}