{"id":37917,"date":"2025-08-04T12:02:00","date_gmt":"2025-08-04T15:02:00","guid":{"rendered":"https:\/\/www.locaweb.com.br\/ajuda\/?post_type=ht_kb&#038;p=37917"},"modified":"2025-08-05T15:06:28","modified_gmt":"2025-08-05T18:06:28","slug":"encaminhamento-de-porta-port-forwarding-e-nat-estatico-no-locaweb-cloud","status":"publish","type":"ht_kb","link":"https:\/\/www.locaweb.com.br\/ajuda\/wiki\/encaminhamento-de-porta-port-forwarding-e-nat-estatico-no-locaweb-cloud\/","title":{"rendered":"Encaminhamento de porta (Port Forwarding) e NAT est\u00e1tico no Locaweb Cloud"},"content":{"rendered":"<h1><span style=\"font-weight: 400;\">1. O que \u00e9 <\/span><b>Encaminhamento de Porta?<\/b><\/h1>\n<p><span style=\"font-weight: 400;\">O Encaminhamento de Porta \u00e9 uma funcionalidade que atua redirecionando <\/span><b>portas espec\u00edficas de um IP p\u00fablico para uma VM<\/b><span style=\"font-weight: 400;\">. Na pr\u00e1tica, isso significa que voc\u00ea pode, por exemplo, definir que a porta 22 do IP p\u00fablico seja direcionada \u00e0 porta 22 da sua m\u00e1quina virtual, permitindo acesso SSH.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Desde que sejam utilizadas portas p\u00fablicas distintas, o usu\u00e1rio tem a chance de criar regras diversas para a mesma VM ou para m\u00e1quinas virtuais diferentes. \u00c9 uma forma controlada e segura de liberar o acesso a servi\u00e7os espec\u00edficos. <\/span><a href=\"https:\/\/www.locaweb.com.br\/ajuda\/wiki\/como-configurar-o-encaminhamento-de-porta-port-forwarding\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Entenda agora<\/span><\/a><span style=\"font-weight: 400;\"> como fazer essas configura\u00e7\u00f5es.\u00a0<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">2. O que \u00e9 <\/span><b>NAT est\u00e1tico?<\/b><\/h1>\n<p><span style=\"font-weight: 400;\">NAT Est\u00e1tico \u00e9 uma funcionalidade que associa <\/span><b>um IP p\u00fablico diretamente a uma VM<\/b><span style=\"font-weight: 400;\">. O resultado \u00e9 que a m\u00e1quina virtual passa a responder diretamente por aquele IP,\u00a0 como se estivesse na internet p\u00fablica. Ent\u00e3o, <\/span><b>todo o tr\u00e1fego<\/b><span style=\"font-weight: 400;\"> recebido neste protocolo de internet <\/span><b>\u00e9 encaminhado<\/b> <b>para a m\u00e1quina virtual<\/b><span style=\"font-weight: 400;\">, n\u00e3o sendo necess\u00e1rio definir regras individuais para cada porta. <\/span><span style=\"font-weight: 400;\"><a href=\"https:\/\/www.locaweb.com.br\/ajuda\/wiki\/como-configurar-um-nat-estatico-locaweb-cloud\/\" target=\"_blank\" rel=\"noopener\">Veja como configurar o NAT Est\u00e1tico<\/a>.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">3. Quando usar um ou outro?<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">A fun\u00e7\u00e3o <\/span><b>Encaminhamento de porta<\/b><span style=\"font-weight: 400;\"> \u00e9 indicada se voc\u00ea quiser que estejam <\/span><b>acess\u00edveis remotamente apenas alguns servi\u00e7os espec\u00edficos<\/b><span style=\"font-weight: 400;\"> da VM, como SSH, HTTP ou determinada aplica\u00e7\u00e3o rodando em porta definida. Isso porque a op\u00e7\u00e3o oferece mais controle e seguran\u00e7a, especialmente quando <\/span><b>v\u00e1rias VMs compartilham um \u00fanico IP p\u00fablico<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A fun\u00e7\u00e3o <\/span><b>NAT Est\u00e1tico<\/b><span style=\"font-weight: 400;\"> \u00e9 a melhor op\u00e7\u00e3o para os usu\u00e1rios que desejam tornar todos<\/span><b> os servi\u00e7os de uma VM acess\u00edveis de forma remota<\/b><span style=\"font-weight: 400;\"> \u2014 como servidores web completos e aplica\u00e7\u00f5es em m\u00faltiplas portas \u2014 ou para facilitar o acesso externo, j\u00e1 que n\u00e3o se faz necess\u00e1ria a configura\u00e7\u00e3o de m\u00faltiplas regras.<\/span><\/p>\n    \t\t<div class=\"hts-messages hts-messages--alert  hts-messages--withtitle hts-messages--withicon \"   >\r\n    \t\t\t<span class=\"hts-messages__title\">Lembrete de Firewall<\/span>    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\t<b>Libere o acesso no IP P\u00fablico!<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Ap\u00f3s criar sua regra de Encaminhamento de Portas ou NAT Est\u00e1tico, o pr\u00f3ximo passo essencial \u00e9 autorizar a entrada do tr\u00e1fego no firewall. Em nossa plataforma, a <\/span><a href=\"https:\/\/www.locaweb.com.br\/ajuda\/wiki\/como-configurar-regras-de-firewall\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">configura\u00e7\u00e3o de regras de Firewall <\/span><\/a><span style=\"font-weight: 400;\">\u00e9 feita <\/span><b>diretamente no seu IP P\u00fablico<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Acesse os detalhes do seu IP P\u00fablico e clique na aba <\/span><b>Firewall<\/b><span style=\"font-weight: 400;\">. L\u00e1, voc\u00ea deve adicionar uma nova <\/span><b>regra de entrada (inbound)<\/b><span style=\"font-weight: 400;\"> para a porta (ou portas) e o protocolo que deseja liberar. Sem esta permiss\u00e3o, o firewall no n\u00edvel do IP bloquear\u00e1 a conex\u00e3o antes mesmo que ela chegue \u00e0 sua VM.<\/span>    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<h1><span style=\"font-weight: 400;\">4. Vantagens de cada abordagem<\/span><\/h1>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">O principal benef\u00edcio da fun\u00e7\u00e3o <\/span><b>Encaminhamento de porta<\/b><span style=\"font-weight: 400;\"> \u00e9 a maior <\/span><b>granularidade e economia de IPs<\/b><span style=\"font-weight: 400;\">, tendo em vista o uso de um \u00fanico protocolo de internet para diferentes m\u00e1quinas virtuais em diferentes portas.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A fun\u00e7\u00e3o NAT est\u00e1tico tem a vantagem de ser <\/span><b>mais direta e simples de configurar<\/b><span style=\"font-weight: 400;\">, permitindo exposi\u00e7\u00e3o total da VM sem gerenciamento manual de portas.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No <\/span><span style=\"font-weight: 400;\">Locaweb Cloud,<\/span><span style=\"font-weight: 400;\"> para ambas as fun\u00e7\u00f5es, \u00e9 poss\u00edvel definir <\/span><b>regras de firewall (regras de sa\u00edda)<\/b><span style=\"font-weight: 400;\"> que funcionam como <\/span><b>bloqueios<\/b><span style=\"font-weight: 400;\">, permitindo <\/span><b>restringir portas que voc\u00ea n\u00e3o deseja expor.<\/b><\/li>\n<\/ul>\n<h1><span style=\"font-weight: 400;\">5. Limita\u00e7\u00f5es e cuidados<\/span><\/h1>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">O processo de\u00a0 <\/span><b>Encaminhamento de porta<\/b><span style=\"font-weight: 400;\"> exige a <\/span><b>cria\u00e7\u00e3o de regras espec\u00edficas para cada servi\u00e7o desejado<\/b><span style=\"font-weight: 400;\">, porque todas as portas que n\u00e3o forem redirecionadas permanecem fechadas. Outro fator de aten\u00e7\u00e3o \u00e9 que <\/span><b>cada porta p\u00fablica s\u00f3 pode ser encaminhada para uma \u00fanica VM por vez<\/b><span style=\"font-weight: 400;\">. <\/span>&nbsp;<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">A din\u00e2mica de <\/span><b>NAT est\u00e1tico reserva totalmente o IP p\u00fablico para uma \u00fanica m\u00e1quina virtual<\/b><span style=\"font-weight: 400;\">. \u00c9 importante n\u00e3o perder isso de vista. A quest\u00e3o de seguran\u00e7a tamb\u00e9m exige precau\u00e7\u00e3o, pois, por padr\u00e3o, <\/span><b>todas as portas estar\u00e3o acess\u00edveis remotamente. <\/b><span style=\"font-weight: 400;\">Da\u00ed a import\u00e2ncia de uma defini\u00e7\u00e3o criteriosa das <\/span><b>regras de firewall (regras de sa\u00edda),<\/b><span style=\"font-weight: 400;\"> para direcionar adequadamente o tr\u00e1fego da informa\u00e7\u00e3o. <\/span>&nbsp;<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Um IP com <\/span><b>NAT est\u00e1tico<\/b><span style=\"font-weight: 400;\"> \u00e9 utilizado exclusivamente por \u00fanica VM, pois encaminha <\/span><b>todas as suas portas<\/b><span style=\"font-weight: 400;\"> para ela. Por este motivo, esse IP n\u00e3o pode ser o <\/span><b>NAT de origem (source NAT)<\/b><span style=\"font-weight: 400;\"> da rede, nem ter regras de <\/span><b>redirecionamento de portas<\/b><span style=\"font-weight: 400;\"> ou <\/span><b>balanceamento de cargas<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">    \t\t<div class=\"hts-messages hts-messages--alert  hts-messages--withtitle hts-messages--withicon \"   >\r\n    \t\t\t<span class=\"hts-messages__title\">Dica!<\/span>    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\t\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Se voc\u00ea precisa de <\/span><b>controle fino e mais seguran\u00e7a<\/b><span style=\"font-weight: 400;\">, utilize\u00a0 <\/span><b>Encaminhamento de porta<\/b><span style=\"font-weight: 400;\"> .<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Se quiser <\/span><b>expor a VM totalmente com facilidade<\/b><span style=\"font-weight: 400;\">, opte por NAT est\u00e1tico.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Em ambos os casos, <\/span><b>lembre-se de revisar as regras de firewall,<\/b><span style=\"font-weight: 400;\"> para garantir que apenas os servi\u00e7os necess\u00e1rios estejam acess\u00edveis.<\/span><\/li>\n<\/ul>\n<p>    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. O que \u00e9 Encaminhamento de Porta? O Encaminhamento de Porta \u00e9 uma funcionalidade que atua redirecionando portas espec\u00edficas de um IP p\u00fablico para uma VM. Na pr\u00e1tica, isso significa que voc\u00ea pode, por exemplo, definir que a porta 22 do IP p\u00fablico seja direcionada \u00e0 porta 22 da sua&#8230;<\/p>\n","protected":false},"author":29,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[666],"ht-kb-tag":[],"class_list":["post-37917","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-locaweb-cloud"],"_links":{"self":[{"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/ht-kb\/37917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/comments?post=37917"}],"version-history":[{"count":3,"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/ht-kb\/37917\/revisions"}],"predecessor-version":[{"id":38140,"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/ht-kb\/37917\/revisions\/38140"}],"wp:attachment":[{"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/media?parent=37917"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/ht-kb-category?post=37917"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.locaweb.com.br\/ajuda\/wp-json\/wp\/v2\/ht-kb-tag?post=37917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}