{"id":4594,"date":"2019-01-26T23:41:10","date_gmt":"2019-01-27T01:41:10","guid":{"rendered":"https:\/\/blog.clusterweb.com.br\/?p=4594"},"modified":"2019-01-26T23:41:29","modified_gmt":"2019-01-27T01:41:29","slug":"alterar-ip-principal-em-um-servidor-centos-com-painel-whm-cpanel","status":"publish","type":"post","link":"https:\/\/blog.clusterweb.com.br\/?p=4594","title":{"rendered":"Alterar IP principal em um servidor CentOS com painel whm\/cPanel"},"content":{"rendered":"<p>Em algum momento voc\u00ea poder\u00e1 precisar alterar o IP principal de um servidor utilizando sistema Operacional CentOS e painel cPanel. Apesar de parecer um processo complexo, um usu\u00e1rio com conhecimento b\u00e1sico em comandos\u00a0<strong>shell<\/strong>\u00a0 e com acesso\u00a0<strong>root\u00a0<\/strong>poder\u00e1 realizar sem maiores problemas em poucos passos.<\/p>\n<p><!--more--><\/p>\n<p><strong>Passos no WHM:<\/strong><\/p>\n<ul>\n<li>Entre no WHM e acesse a op\u00e7\u00e3o\u00a0<strong>Basic cPanel &amp; WHM Setup<\/strong>\u00a0no menu lateral.<\/li>\n<li>Altere o IP principal (compartilhado), na op\u00e7\u00e3o \u201c<em>The IP address (only one address) that will be used for setting up shared IP virtual hosts<\/em>\u201c<\/li>\n<li><strong>Nota<\/strong>: Esta op\u00e7\u00e3o poder\u00e1 n\u00e3o ser necess\u00e1ria pois o cPanel pode trabalhar com um IP compartilhado diferente do principal do servidor.<\/li>\n<\/ul>\n<p>Agora acesse o servidor como root, por SSH, e execute os comandos abaixo:<\/p>\n<ul>\n<li><strong># nano<\/strong>\u00a0<strong>\/etc\/sysconfig\/network-scripts\/ifcfg-eth0<\/strong>\n<ul>\n<li>Altere as linhas\u00a0<strong>IPADDR<\/strong>\u00a0e\u00a0<strong>GATEWAY<\/strong>\u00a0para que correspondam ao novo IP e Gateway<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li><strong># nano \/etc\/sysconfig\/network<\/strong>\n<ul>\n<li>Altere a linha\u00a0<strong>GATEWAY<\/strong>\u00a0onde n\u00e3o existe nos ficheiros ifcfg-*.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li><strong># nano \/etc\/ips<\/strong>\n<ul>\n<li>Remova o novo IP se existir<\/li>\n<li>Adicione o IP antigo neste arquivo usando o mesmo par\u00e2metro dos demais\u00a0<strong>::<br \/>\n<\/strong><\/li>\n<\/ul>\n<\/li>\n<li><strong># nano<\/strong>\u00a0<strong>\/var\/cpanel\/mainip<\/strong>\n<ul>\n<li>Substitua o IP antigo pelo novo<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li><strong># nano<\/strong>\u00a0<strong>\/etc\/hosts<\/strong>\n<ul>\n<li>Substitua o antigo IP pelo novo, se necess\u00e1rio. O nome dos nameservers tamb\u00e9m necessitam de ser atualizados<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Re-inicie o servi\u00e7o \u201cnetwork\u201d para que o servidor assuma o novo IP\n<ul>\n<li><strong># service network restart<\/strong><\/li>\n<li><strong>Nota:<\/strong>\u00a0\u00c9 poss\u00edvel que ap\u00f3s executar esse comando seja perdido a conex\u00e3o com o SSH. Basta entrar novamente usando o novo ip.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Execute o script ipaliases para carregar os IPs adicionais\n<ul>\n<li><strong># service ipaliases restart<br \/>\n<\/strong><\/li>\n<\/ul>\n<\/li>\n<li>Execute\u00a0<strong>#<\/strong>\u00a0<strong>ifconfig<\/strong>\u00a0e verifique que todas as configura\u00e7\u00f5es est\u00e3o corretas<\/li>\n<\/ul>\n<ul>\n<li>Ap\u00f3s concluir o processo v\u00e1 no painel de gerenciamento de sua licen\u00e7a cPanel e altere o IP da mesma.<\/li>\n<\/ul>\n<ul>\n<li>Acesse o WHM\/ cPanel e caso seja informado um alerta de licen\u00e7a inexistente basta rodar esse comando\u00a0<strong># \/usr\/local\/cpanel\/cpkeyclt<\/strong><\/li>\n<\/ul>\n<p><strong>Aten\u00e7\u00e3o:\u00a0<\/strong>Lembre-se que caso esteja utilizando outros aplicativos licenciados neste servidor como Softaculous, Construtor de Sites etc; ser\u00e1 necess\u00e1rio realizar a atualiza\u00e7\u00e3o das licen\u00e7as com a troca do IP antigo pelo novo.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Em algum momento voc\u00ea poder\u00e1 precisar alterar o IP principal de um servidor utilizando sistema Operacional CentOS e painel cPanel. Apesar de parecer um processo complexo, um usu\u00e1rio com conhecimento b\u00e1sico em comandos\u00a0shell\u00a0 e com acesso\u00a0root\u00a0poder\u00e1 realizar sem maiores problemas em poucos passos.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[455,1082,730,1,830,42,51,495,68,271],"tags":[1096,199,349,945,369,20,1254,1253,72,370,944],"class_list":["post-4594","post","type-post","status-publish","format-standard","hentry","category-apache2","category-centos-7-rhel-7","category-clusterweb","category-viazap","category-debian","category-leitura-recomendada","category-linux-linuxrs","category-profissional-de-ti","category-redes-2","category-seguranca-2","tag-alterar","tag-centos","tag-com","tag-cpanel","tag-em","tag-ip","tag-painel","tag-principal","tag-servidor","tag-um","tag-whm"],"_links":{"self":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4594"}],"version-history":[{"count":2,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4594\/revisions"}],"predecessor-version":[{"id":4596,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4594\/revisions\/4596"}],"wp:attachment":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}