Networking Flashcards
What is a VPC Network?
- Virtual Private Cloud (VPC) network
- Manage networking for your GCP Compute resources
- All Compute Engine, Kubernetes Engine containers and AppEngine Flex apps, exist within a VPC Network.
- A Default mode network is created, can be updated or replaced with custom mode to meet your needs (custom IP Addresses and sub-nets)
- Securely connect your VPC network of IPsec for VPN access.
- Support for firewall restriction and routing between networks and instances - Works across regions, highly scalable
- Shared VPC allows sharing a network across projects to operate services with their own quota and billing
What do VPC firewall rules allow you to do, how do they work?
- Firewall rules protect your VM instances from unapproved connections, both inbound and outbound.
- You can create firewall rules to allow or deny connections based on a combination of IP addresses, ports and protocols.
- Functions between other networks AND between instances on the same network (distributed firewall)
What is a route, how or why would I need one?
- A route is a mapping of an IP range to a destination
- Routes tell the VPC network where to send packets destined for a particular IP address
- Routes are created automatically when the network is created: a default route for Internet traffic, and a route for each subnet when the subnet is created.
- Routes still need Firewall rules to allow packets
- Routes may apply to instances by using a matching Tag attribute
How do your route packets to the Internet?
Cloud Router - Must be sent by an instance that has an external IP address
NAT Gateway - A Cloud NAT gateway can provide NAT services for packets sent from a Compute Engine VM’s network interface as long as that network interface doesn’t have an external IP address assigned to it. For GKE clusters, Cloud NAT can provide service even if the cluster nodes have external IP addresses in certain circumstances. For details, see GKE interaction.
The Cloud NAT gateway can be configured to provide NAT for the VM network interface’s primary internal IP address, alias IP ranges, or both. You make this configuration by choosing the subnet IP address ranges to which the gateway should apply.
What is VPC Network Peering?
- Allows private connectivity across two VPC networks, in different projects or organizations.
What is CIDR notation?
- CIDR = Classless Inter Domain Routing, using 1-bit increments
- CIDR notation is a compact representation of an IP Address and its associated routing prefix (subnet mask splits into host part and network part)
- A Class C address 192.168.1.100/24 gives access to 256 IP addresses:
- 254 hosts IPs in the range 192.168.1.1 to 192.168.1.254
- 1 Network address 192.168.1.0 (reserved)
- 1 Broadcast address 192.168.1.255 (reserved)
- the /24 represents subnet 255.255.255.0
What are the different ‘Classes’ of networks?
Why is using Classful address scheme considered wasteful?
- Class A: 1.0.0.0 - 126.0.0.0 = /8
- Class B: 128.0.0.0 - 191.255.0.0 = /16
- Class C: 192.0.0.0 - 223.255.255.0 = /24
- Giving Class C to an org that need 5 hosts is wasteful
- Use CIDR instead, which uses 1-bit increments instead of 8-bit for classful.
How do firewall rules work with regards to subnets?
- Aautomode VPC creates inter-subnet firewall rules to allow instances on the same subnet to communicate
- To allow communication between different subnets, you must define a custom firewall rule to allow that access
What is Google Cloud VPN?
- Securely connects your on-premise network to your GCP VPC network/gateway through an IPSec VPN connection (VPN Tunnel)
- Requires an IPsec VPN gateway on the client side
- Supports static and dynamic routes (via Cloud Router), for managing traffic between GCP VPC and existing infrastructure
What is required to use a VPN?
- Must have a peer gateway by the client
- The peer VPN gateway must have a static external IP address
- The CIDR range of the VPC network must not conflict with the CIDR ranges of the peer VPN gateway
- You must supply a shared secret for the VPN
- Setup firewall rules and any custom routing needed
What is Cloud Router? When should it be used?
Google Cloud Router
On Google Cloud, dynamic routing can be established using Cloud Router. It exchanges network topology information through Border Gateway Protocol (BGP). Cloud Router advertises subnets from its VPC network to another router or gateway via BGP. This is great for setting up VPN between the cloud and on-prem, as topology changes automatically propagate with no manual intervention and higher redundancy for your systems.
-Subnet level support
VPC - What are Forwarding Rules?
- routes govern traffic LEAVING an instance
- forwarding rules can direct traffic that ARRIVEWS from OUTSIDE the network AS WELL as traffic (that ARRIVES) from INSIDE the network
- rules based on IP, protocol or port
What are some use cases for VPC ‘forwarding rules’?
- Virtual hosting: multiple rules to point to a single instance, allowing multiple external IPs with just one VM; especially useful for SSL hosting
- Forwarding rules over a VPN
- Load balancing: forward traffic to a load-balancer
What is needed to create and use a VPC ‘forwarding rule’?
- Creation of a ‘targeted instance’ resource on the VM - BEFORE the fowarding rule
* gcloud compute target-instances create - Creation of the forwarding rule
* gcloud compute forwarding-rules create
What is Cloud Load Balancing?
When and why would we want to use it?
- Distribute traffic to load-balanced compute resources in single or multiple regions
- Close to users with high-availability
- Scale resources up or down with intelligent Autoscaling
- Integrated with Cloud CDN for optimal app and content delivery
- Scales as your user and traffic grows
- Supports internal load-balancing (via Andromeda)
What are the types of load-balancing?
- Global external load balancing
- HTTP(S) load balancing
- SSL Proxy load balancing - non-https(s) traffic
- TCP Proxy load balancing - non-htttp(s) traffic
- Regional external load balancing
- Network load balancing- distributes traffic among a pool of instances within a region
- Regional internal load balancing
- Internal load balancing- distributes traffic from GCP VM instances to a group of instances in the same region
What is and how do you setup Internal Load Balancing?
- Internal Load Balancing enables you to run and scale your services behind a private load balancing IP address which is accessible only to instances internal to your Virtual Private Cloud (VPC).
- Think external LB service to Web tier, which has internal configuration to LB to App tier (like AJP), but instead using Google ‘Internal’ Load Balancer solution
What is Cloud CDN and what is it good for, why/when should I use it?
- Cloud CDN works with the HTTP(S) Load Balancing service
- Content may come from VM instance groups or Cloud Storage buckets
*
Switch takes traffic from Subnets to different devices, Internet GW and VPN GW.
Subnets isolate traffic in different zones.
Subnets can spand zones.
Subnets can isolate to a zone.
How does traffic get from one region to another in the same VPC?
In the same VPC, traffic is able to span all region using internal IP addresses. The traffic can move across all subnets.
What are the two different ways you can manage traffic in a region for two different apps?
Put traffic in different subnets but have one VPC
Put traffic in different VPCs for better isolation.
What do internal and external IP addresses provide?
Internal - communicate within a VPC traffic Globally.
External - communicate with external networks and to other VPCs.
What networks have routes?
All networks have routes.
The default network has a default route to the internet and individual routes to each subnet.
What are route tables
Tables are used to tell which routes and rules apply to each VM instance.
Routes could apply to multiple instances or single instances depending on the tags used in the route statement.
If an instance tag is used, the route applies to that instance, and if an instance tag is not used, then the route applies to all instances in that network.
Individual read-only route tables are created for each VM instance based off of the parent route table.