{"id":2348,"date":"2010-02-03T00:25:49","date_gmt":"2010-02-03T05:25:49","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=2348"},"modified":"2010-02-03T00:25:49","modified_gmt":"2010-02-03T05:25:49","slug":"modify-dns-zone-file-script","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/","title":{"rendered":"Modify multiple dns zone files"},"content":{"rendered":"<p>There are 2 basic ways to modify a dns zone file, from the command line or from WHM via<br \/>\nMain >> DNS Functions >> Edit DNS Zone. What happens if you have five hundred domains on a server and want to migrate them all to a new shared IP address? Do you spend the next 4 days going through all of the zone files modifying them by hand or via the command line? I don&#8217;t think so&#8230;<\/p>\n<p>We will be using cPanels swapip utility. The swapip utility allows you to update nameserver records by specifying 4 parameters in a command line interface. The swapip utility is located at <code><br \/>\n    \/usr\/local\/cpanel\/bin\/swapip<br \/>\n<\/code><br \/>\nTo use this utility for a single zone file, run the following command, specifying the appropriate parameters:<br \/>\n<code><br \/>\n    \/usr\/local\/cpanel\/bin\/swapip $sourceip $targetip $ftpip $domains<br \/>\n<\/code><br \/>\nNote: $sourceip, $targetip, $ftpip, and $domains are meant to symbolize the parameters you wish to enter.<\/p>\n<p>Parameters<\/p>\n<ol>\n<li>\n    * sourceip (string) \u2014 The old IP address.<br \/>\n           Example: 127.0.0.0<br \/>\n    * targetip (string) \u2014 The new IP address.<br \/>\n           Example: 208.77.188.166<br \/>\n    * ftpip (string) \u2014 The new FTP server\u2019s IP address.<br \/>\n           Example: 208.77.188.166<br \/>\n    * domains (string) \u2014 One or more domains associated with the IP address being changed.<br \/>\n           Example: example.com\n<\/li>\n<\/ol>\n<p><\/p>\n<p>Examples:<\/p>\n<p>Typing<br \/>\n<code><br \/>\n\/usr\/local\/cpanel\/bin\/swapip 127.0.0.0 208.77.188.166 208.77.188.166 example.com<br \/>\n<\/code><br \/>\nwould change the nameserver records for example.com on 127.0.0.0 to point HTTP and FTP requests to 208.77.188.166.<\/p>\n<p>A successful swapip attempt should return you to the command line without displaying any messages. The output should resemble the following:<br \/>\n<code><br \/>\nroot@example [~]# \/usr\/local\/cpanel\/bin\/swapip 127.0.0.0 208.77.188.166<br \/>\n208.77.188.166 example.com<br \/>\nroot@example [~]#<br \/>\n<\/code><br \/>\nAn unsuccessful swapip attempt should result in an error message, the output of which will resemble the following:<br \/>\n<code><br \/>\nroot@example [~]# \/usr\/local\/cpanel\/bin\/swapip 127.0.0.0 208.77.188.166 example.com<br \/>\nError: domains missing<br \/>\nUsage: \/usr\/local\/cpanel\/bin\/swapip sourceip destip ftpip domains...<br \/>\n<\/code><br \/>\nNote: At this time the error message may not give an accurate assessment of the error that has occurred. <\/p>\n<p>In order to change all dns zone file ip&#8217;s to another ip, we will use a simple one liner like so;<br \/>\n<code><br \/>\nfor each in `cat \/etc\/domainips | grep 72.16.217.108 | cut -d: -f2`; do \/usr\/local\/cpanel\/bin\/swapip 72.16.217.108 72.16.217.109 $each done;<br \/>\n<\/code><\/p>\n<p>If you see any variation in this, please let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are 2 basic ways to modify a dns zone file, from the command line or from WHM via Main >> DNS Functions >> Edit DNS Zone. What happens if you have five hundred domains on a server and want to migrate them all to a new shared IP address? Do you spend the next&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-2348","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Modify multiple dns zone files - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Modify multiple dns zone files - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"There are 2 basic ways to modify a dns zone file, from the command line or from WHM via Main &gt;&gt; DNS Functions &gt;&gt; Edit DNS Zone. What happens if you have five hundred domains on a server and want to migrate them all to a new shared IP address? Do you spend the next... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2010-02-03T05:25:49+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Modify multiple dns zone files\",\"datePublished\":\"2010-02-03T05:25:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/\"},\"wordCount\":292,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/\",\"name\":\"Modify multiple dns zone files - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2010-02-03T05:25:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/modify-dns-zone-file-script\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Modify multiple dns zone files\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Modify multiple dns zone files - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/","og_locale":"en_US","og_type":"article","og_title":"Modify multiple dns zone files - Linux Shtuff","og_description":"There are 2 basic ways to modify a dns zone file, from the command line or from WHM via Main >> DNS Functions >> Edit DNS Zone. What happens if you have five hundred domains on a server and want to migrate them all to a new shared IP address? Do you spend the next... Read More","og_url":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2010-02-03T05:25:49+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Modify multiple dns zone files","datePublished":"2010-02-03T05:25:49+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/"},"wordCount":292,"commentCount":0,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/","url":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/","name":"Modify multiple dns zone files - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2010-02-03T05:25:49+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/modify-dns-zone-file-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Modify multiple dns zone files"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/2348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=2348"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/2348\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=2348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=2348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=2348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}