Arcade Simulator: Site Reliability Engineer | GSP016

Solution for Arcade Simulator: Site Reliability Engineer | GSP016. 1 lab: GSP016. Fast copy-paste commands for Google Cloud.

GSP016 — Networking 101

Estimated time: 15 minutes

# 🚀 Networking 101 | GSP016 > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created for educational purposes, hands-on practice, and Google Cloud certification preparation. This guide is designed to help learners understand foundational Google Cloud networking concepts and complete practical exercises. Always attempt the lab yourself first and follow Google Cloud Skills Boost / Qwiklabs Terms of Service. This walkthrough is not affiliated with or endorsed by Google, Goo

clear
CYAN='\033[1;36m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
RESET='\033[0m'
BOLD='\033[1m'

echo -e "${CYAN}${BOLD}"
echo "   ____       _    _ _             __   ___             "
echo "  / __ \     | |  (_) |           / _| / _ \            "
echo " | |  | |_ __| |__  _| |_  ___   | |_ | | | |_ __ ___  "
echo " | |  | | '__| '_ \| | __| / _ \ |  _|| | | | '_ \ / __| "
echo " | |__| | |  | |_) | | |_ | (_) || |  | |_| | |_) \__ \ "
echo "  \____/|_|  |_.__/|_|\__| \___/ |_|   \___/| .__/|___/ "
echo "                                            | |         "
echo "                                            |_|         "
echo -e "${RESET}"

echo -e "${BLUE}▶ Creating custom VPC network 'taw-custom-network'...${RESET}"
gcloud compute networks create taw-custom-network --subnet-mode custom

echo -e "${YELLOW}▶ Detecting allowed regions to bypass Organization Policy constraints...${RESET}"
RANGES=("10.0.0.0/16" "10.1.0.0/16" "10.2.0.0/16")
RANGE_INDEX=0
REGIONS=$(gcloud compute regions list --format="value(name)")

for REGION in $REGIONS; do
    CURRENT_RANGE=${RANGES[$RANGE_INDEX]}
    echo -e "${CYAN}  Probing region: ${REGION} for range ${CURRENT_RANGE}...${RESET}"
    
    # Attempt to create the subnet (errors are suppressed to keep terminal clean)
    if gcloud compute networks subnets create subnet-$REGION \
        --network taw-custom-network \
        --region $REGION \
        --range $CURRENT_RANGE > /dev/null 2>&1; then
        
        echo -e "${GREEN}  ✓ Success! subnet-${REGION} created.${RESET}"
        ((RANGE_INDEX++))
        
        # Stop once all 3 subnets are successfully created
        if [[ $RANGE_INDEX -eq 3 ]]; then
            break
        fi
    fi
done

if [[ $RANGE_INDEX -eq 3 ]]; then
    echo -e "${GREEN}✓ All 3 subnets successfully provisioned! Proceeding to firewalls...${RESET}"
else
    echo -e "${YELLOW}⚠ Could not find enough allowed regions. The lab environment may be severely restricted.${RESET}"
fi

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-http...${RESET}"
gcloud compute firewall-rules create nw101-allow-http \
    --allow tcp:80 \
    --network taw-custom-network \
    --source-ranges 0.0.0.0/0 \
    --target-tags http

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-icmp...${RESET}"
gcloud compute firewall-rules create nw101-allow-icmp \
    --allow icmp \
    --network taw-custom-network \
    --source-ranges 0.0.0.0/0 \
    --target-tags rules

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-internal...${RESET}"
gcloud compute firewall-rules create nw101-allow-internal \
    --allow tcp:0-65535,udp:0-65535,icmp \
    --network taw-custom-network \
    --source-ranges "10.0.0.0/16","10.2.0.0/16","10.1.0.0/16"

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-ssh...${RESET}"
gcloud compute firewall-rules create nw101-allow-ssh \
    --allow tcp:22 \
    --network taw-custom-network \
    --target-tags "ssh"

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-rdp...${RESET}"
gcloud compute firewall-rules create nw101-allow-rdp \
    --allow tcp:3389 \
    --network taw-custom-network

echo -e "${GREEN}✓ All network resources and firewall rules applied successfully! Lab is complete.${RESET}"
CYAN='\033[1;36m'
GREEN='\033[1;32m'
BLUE='\033[1;34m'
RESET='\033[0m'

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-http...${RESET}"
gcloud compute firewall-rules create nw101-allow-http \
    --allow tcp:80 \
    --network taw-custom-network \
    --source-ranges 0.0.0.0/0 \
    --target-tags http

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-icmp...${RESET}"
gcloud compute firewall-rules create nw101-allow-icmp \
    --allow icmp \
    --network taw-custom-network \
    --source-ranges 0.0.0.0/0 \
    --target-tags rules

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-internal...${RESET}"
gcloud compute firewall-rules create nw101-allow-internal \
    --allow tcp:0-65535,udp:0-65535,icmp \
    --network taw-custom-network \
    --source-ranges "10.0.0.0/16","10.2.0.0/16","10.1.0.0/16"

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-ssh...${RESET}"
gcloud compute firewall-rules create nw101-allow-ssh \
    --allow tcp:22 \
    --network taw-custom-network \
    --target-tags "ssh"

echo -e "${BLUE}▶ Creating Firewall Rule: nw101-allow-rdp...${RESET}"
gcloud compute firewall-rules create nw101-allow-rdp \
    --allow tcp:3389 \
    --network taw-custom-network

echo -e "${GREEN}✓ All firewall rules applied successfully! You may now verify your progress on the lab page.${RESET}"