This repository documents a hands-on Google Cloud lab where I created and tested VPC firewall rules to control access to a web server VM and then analyzed the traffic using Logs Explorer.
- View existing VPC firewall rules in a Google Cloud project.
- Create an allow firewall rule for HTTP and SSH traffic to a web server.
- Verify that the web page is accessible from the internet.
- Create a deny rule to block HTTP traffic.
- Use Logs Explorer to view and filter both allowed and denied traffic.
- Platform: Google Cloud (Qwiklabs project)
- Services used:
- Network Security → Firewall policies
- VPC firewall rules
- Compute Engine → VM instances
- Cloud Logging → Logs Explorer (VPC Flow Logs & Firewall Logs)
- Open the Google Cloud Console.
- Go to Network Security → Firewall policies.
- Under VPC firewall rules, review the default rules such as:
default-allow-icmpdefault-allow-internaldefault-allow-rdpdefault-allow-ssh
📸 screenshots/01-firewall-policies-default-rules.png
- In Firewall policies, click Create firewall rule.
- Configure the rule:
- Name:
allow-http-ssh - Logs: On
- Network:
vpc-net - Priority:
1000 - Direction of traffic: Ingress
- Action on match: Allow
- Targets: Specified target tags (for the web server)
- Source filter: IP ranges
0.0.0.0/0 - Protocols and ports:
tcp:22,80
- Name:
- Click Create to save the rule.
📸 screenshots/02-create-firewall-rule-allow-http-ssh.png
📸 screenshots/03-firewall-rule-list-with-allow-http-ssh.png
- Go to Compute Engine → VM instances.
- Locate the
web-serverinstance and copy its external IP address. - From a browser, open:
http://<external-ip>
- Confirm that the Cymbal Group test website loads successfully.
📸 screenshots/04-vm-instance-web-server.png
📸 screenshots/05-webpage-opened-successfully.png
This confirms that the allow-http-ssh rule is working.
- Open Logging → Logs Explorer.
- Filter logs for VPC/subnetwork traffic:
- Resource type:
gce_subnetwork - (Optional) Log name:
vpc_flows
- Resource type:
- Run the query and review entries where
disposition = "ALLOWED".
📸 screenshots/06-logs-explorer-allowed-traffic.png
📸 screenshots/07-logs-explorer-subnetwork-traffic.png
📸 screenshots/08-logs-explorer-vpc-flows.png
- Go back to Network Security → Firewall policies and click Create firewall rule again.
- Configure the rule:
- Name:
deny-http - Logs: On
- Network:
vpc-net - Priority:
1000(or higher priority than the allow rule, depending on lab instructions) - Direction of traffic: Ingress
- Action on match: Deny
- Targets: Same web server tag
- Source filter: IP ranges
0.0.0.0/0 - Protocols and ports:
tcp:80
- Name:
- Click Create to save the deny rule.
📸 screenshots/09-create-firewall-rule-deny-http.png
- Try to open the web server again in the browser using the same external IP.
- The HTTP request should now fail (blocked by firewall).
- In Logs Explorer, filter:
- Resource type:
gce_subnetwork - Log name:
compute.googleapis.com/firewall - Optionally filter on the web server IP.
- Resource type:
- Look for entries with
disposition = "DENIED"for port 80.
📸 screenshots/10-logs-explorer-denied-traffic.png
- How VPC firewall rules control ingress traffic to instances.
- The difference between allow and deny rules and the role of priority.
- How to target specific instances using network tags.
- How to use Logs Explorer,