VPC de Google Cloud: Tráfico Saliente Denegado

Guía práctica para configurar firewall egress deny en Google Cloud y bloquear tráfico saliente hacia destinos específicos, con pasos y pruebas.

14 sept 2025 • 3 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Introducción: En Google Cloud, por defecto las instancias de máquina virtual pueden enviar tráfico saliente egress hacia internet a menos que se restrinja explícitamente. Un firewall de tipo egress deny permite bloquear tráfico saliente hacia destinos específicos por razones de seguridad, cumplimiento o control de costes.

Paso 01 Objetivo: Crear una regla de firewall egress deny que niegue el tráfico saliente desde una o varias VM hacia un destino concreto como un sitio web o un rango de IPs. Caso de uso típico: evitar que servidores accedan a repositorios externos, redes sociales o dominios específicos.

Paso 02 Crear instancia VM: Para probar el comportamiento crearemos una VM de ejemplo llamada myvm5-egress en la red mysubnet1. Ejemplos de comandos gcloud: gcloud config set project gcpdemos, gcloud compute instances create myvm5-egress --zone=us-central1-a --machine-type=e2-micro --network-interface=subnet=mysubnet1, gcloud compute instances list, gcloud compute ssh --zone=us-central1-a myvm5-egress --project=gcpdemos. Dentro de la VM instalar utilidades de prueba como dnsutils y telnet con apt install -y dnsutils telnet.

Pruebas antes de la regla: Resolver dominio con nslookup stacksimplify.com para obtener IPs, luego verificar conectividad con telnet stacksimplify.com 80, telnet stacksimplify.com 443 y ping stacksimplify.com. Observación antes de aplicar la regla: conexiones TCP a puertos 80 y 443 exitosas y respuestas ICMP exitosas.

Paso 03 Crear regla de denegación egress: Ahora bloquearemos el tráfico saliente desde las VM en la VPC hacia stacksimplify.com. Parámetros de ejemplo: nombre fw-egress-deny-80-443-icmp, descripción Denegar salida hacia stacksimplify.com en puertos 80, 443 e ICMP, red vpc2-custom, prioridad 1000, dirección egress, acción deny, targets todas las instancias de la red, destino basado en el prefijo obtenido por nslookup por ejemplo 99.84.160.0/24, protocolos TCP puertos 80 y 443 y ICMP. Tras crear la regla, las comunicaciones salientes hacia ese destino deben bloquearse.

Paso 04 Pruebas después de la regla: Ejecutar nuevamente telnet stacksimplify.com 80, telnet stacksimplify.com 443 y ping stacksimplify.com. Observación después de la regla: telnet a puertos 80 y 443 falla y las respuestas ICMP también fallan. El tráfico saliente hacia el destino especificado está ahora bloqueado como se esperaba.

Paso 05 Limpieza: Eliminar la regla de firewall con gcloud compute firewall-rules delete fw-egress-deny-80-443-icmp y eliminar la VM con gcloud compute instances delete myvm5-egress --zone=us-central1-a.

Análogo en el mundo real: Pense en una política de egress deny como el firewall corporativo que impide que empleados visiten sitios restringidos. Sin reglas los usuarios pueden navegar libremente; con egress deny se limita el acceso a sitios o servicios no autorizados para cumplir políticas de seguridad o evitar fugas de datos.

Resumen: Google Cloud permite por defecto tráfico saliente. Las reglas egress deny son una herramienta esencial para bloquear tráfico no deseado hacia destinos concretos, aportando control, seguridad y cumplimiento en entornos cloud.

Sobre Q2BSTUDIO: En Q2BSTUDIO somos una empresa de desarrollo de software y aplicaciones a medida especializada en soluciones de ciberseguridad, inteligencia artificial y servicios cloud. Ofrecemos servicios integrales que van desde software a medida y aplicaciones a medida hasta consultoría en servicios cloud aws y azure y proyectos de inteligencia de negocio con Power BI. Si necesita reforzar la seguridad de sus infraestructuras o diseñar políticas de red y cumplimiento podemos ayudarle con auditorías y pentesting; conozca nuestros servicios de ciberseguridad. Para proyectos cloud y migraciones consulte nuestras opciones de Servicios cloud Azure y AWS. También desarrollamos soluciones de inteligencia artificial, ia para empresas y agentes IA, ofrecemos servicios inteligencia de negocio y soluciones con power bi para mejorar la toma de decisiones y la automatización de procesos. Palabras clave relevantes: aplicaciones a medida, software a medida, inteligencia artificial, ciberseguridad, servicios cloud aws y azure, servicios inteligencia de negocio, ia para empresas, agentes IA, power bi.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat