-
Firewall
-
Overview
- Firewall rules allow or deny traffic to and from VMs based on configuration
- Firewall rules are always enforced
- Firewall rules are stateful
- Defined at the network level, but enforced at the instance level
- Enforced between instances and other networks, as well as between instances on the same network
- Every network has an implied allow egress rule and an implied deny ingress rule
- GRE traffic is always blocked
- Protocols other than TCP, UDP, ICMP and IPIP is blocked
- Egress traffic on TCP port 25 (SMTP) is blocked
- DHCP, DNS, Instance metadata (169.254.169.254) and NTP is always allowed
-
Components
- Lowest priority number is the highest priority
- Direction of travel is ingress or egress
- Action on match is Allow or Deny
- Target can be all instances, tagged instances, or service accounts
- Source or Destination can be specified for applied rules
- Protocol and port can be specified for TCP, UDP, ICMP, SSH
- Enforcement status can be Enabled or Disabled
-
Network Tags
- Text attributes for Compute Engine instances
- Allows users to apply firewall rules and routes to specific instances or set of instances
- Only apply to the VPC network where the instance's primary interface is located
- Can be used in different networks for different purposes
- Don't have to be unique
-
Shared VPC
-
Overview
- Shares a VPC across multiple projects within an organization
- Host project serves the shared VPC
- Service project has permission to use Shared VPC
- Shared VPC can be controlled by different departments
- Ownership of resources in shared VPCs maintained by Service projects
- Standalone projets do not use the shared VPC
- Separate projects for access control and billing
- Only within a single GCP organization
- Service projects linked to single host project
- Projects cannot be in host and service project
- Existing projects can use shared VPC but existing instances cannot
- Reserved (static IP) can be associated with and billed to Service project
-
Roles
- Creating a Shared VPC requires Organization or Folder roles
- Create organization policy to prevent host project deletion
-
Shared VPC Admin
- Assigned at organization or folder layer
- Enables Shared VPC for host project
- Attaches service projects
- Assigns access to subnets shared by Shared VPC (Network User)
-
Service Project Admin
- Owner/Editor/Compute Instance Admin/Network User of Service Project
- Assignment of Network User role in Host Project
- Allows Service Project users to access Host Project networks/subnets
- Assign for each shared subnet
- Ability to discover and use Shared VPC assets
-
Hybrid
- VPN gateway connection to single shared VPC
- Access restricted by different projects
- Interconnect/VPN connects to Host Project
-
NICs
- Multiple VPCs in Host Project (some shared)
- Multiple NIC appliance in Host Project
-
Service project instance custom routes
- Tagged instances
- vm-appliance as next hop
- 0.0.0.0/0 as destination
-
Resources
- Compute Engine instances
- Compute Engine instance Templates
- Compute Engine instance Groups
- Kubernetes Engine Clusters
- Internal IP Addresses
- Internal DNS
- Cloud DNS Private Zones
- Load Balancer
-
VPN
-
Overview
- Low cost private, encrypted tunnel to GCP VPC over public Internet connection
- Available from any location with Internet connection
- Ideal for low volume data connections
- Supports Site to Site VPN connection over IPSec
- Cloud VPN gateways are regional resource
- Can serve other regions in VPC
- Up to 3 Gbps per tunnel
- Best performance over Cloud Peering connection
- Can use multiple (up to 8) tunnels for increased performance
- 3 Gbps x8 = 24 Gbps per gateway combined
- Static and dynamic routes using Cloud Router
- Supports IKEv1 and IKEv2 using shared secret
- Site to site connectivity only
-
Routing
-
Dynamic
- Routes are created and updated automatically
- Requires Cloud Router service and peer connection that supports BGP
- Cloud Router exchanges BGP routes with peer router/gateway
- Subnets/routes are automatically discovered and updated when changed
-
Static
- Local and peered routes are manually created and updated
- Higher admin overhead
- Used when BGP is not available
-
Route based
- Specify remote (peer) IP ranges to connect to
- Preferred over policy routes
-
Policy based
- Specify both local ranges and remote range
- Used for peer routers that require it
-
BGP
-
Anatomy
- Private Autonomous System Number (ASN) for both Cloud Router and Peer Gateway
- Linked-local IP address for Cloud Router and Peer Gateway, e.g. 169.254.1.1 and 169.254.1.2
-
Routing
- Regional mode (default) advertises learned routes for its own region
- Global mode advertises learned routes for all regions in the VPC
- Applied across entire VPC
- Regional dynamic routing is useful for regional services, such as Internal Load Balancer
- By default, Cloud Router advertises all known routes/subnets to peer network
- Can limit advertised routes by selecting subnets to be advertised
- Must manually update newly needed routes / subnets
- Does not affect learning new peer network routes
-
Firewall
- BGP operates over TCP port 179
- Most peer gateways enable it automatically
- No need to configure on GCP
-
High Availability
-
Overview
- Enables redundancy, failover and enhanced throughput
- Allows for the interruption of individual gateways and/or tunnels
-
HA mode
-
Overview
- Enables easy management of redundant gateways
- Requires Cloud Router
-
Types
- Single gateway/two tunnels
- Two gateways/one tunnel each
- Two gateways/two tunnel each
-
Peer Gateway Requirements
- Multiple IP peer IP Addresses
- Peer supports multi-path routing
-
Failover
- Assign one router/tunnel higher priority
- If it fails, VPN service failover to secondary route
-
Load Balance
- Assign each route/tunnel same priority
- Load is balanced across tunnels increasing throughput
-
Classic mode
- Refers to regular VPN
-
Deployments
-
Single gateway, two tunnels
- Require two different peer network IPs
-
Two gateways, one tunnel each
- Two gateways in the same region
- Each tunnel connects to the same Peer IP
- Peer gateway must support multi-path routing
-
Two gateways, two tunnels each
- Each Cloud VPN gateway connects to each peer gateway
- Highest redundancy and throughput
-
Instance Groups
-
Overview
- Group of instances managed as a group
- Managed and unmanaged varieties
- Works with load balancers
- Automatically scale
- Unmanaged ideal for group with different machine types
-
Configuration
- Create global instance template
- Can reference zonal resource
- Define autoscaling group configuration
- Machine type, zone, image, scripts
- Create regional managed instance group from template
-
Update Rollout
- Deploy inside existing managed instance group
- Rollout happens automatically
- Control the pace of update rollout
- Perform partial rollout for canary testing
- Updates the entire group, not just one instance
-
Customization
- Startup script is easy and quick to configure
- Requires time to start-up and ready
- Images require more investment to setup
- VM is ready for use right away
-
Load Balancing
- Distributes traffic across instances in the group
- Load balancer must be assigned to a backend target pool or instance group
- HTTP load balancer must use instance group
- Load balancer contains one of backend service
- Backend service links to one or more backends
- Backend service knows which backend to use
- Backend links to one or more instance groups
- Traffic is allowed subject to firewall rules
- Firewall rules applied to instances, not load balancers
-
Autohealing
- Health checks with auto-healing groups
- Deletes and replaces failed instances with an indentical instance
- Managed instance groups only