5. Networking Services (II) Flashcards
VPC Peering
For 2 separate VPC to communicate between one another, they must do it over the inet. To do it privately - VPC Peering service.
- helps reduce latency
- improves network security
- reduces network cost
VPC Peering: independency
Each VPC has its own firewall rules etc.
Peering must be done from both sides, not just from the side of one VPC.
VPC Peering: Rules
- CIDR range cannot overlap, so IP addresses of the two networks cannot overlap
- Transitive peering is not supported: if A is connected to B, and C is connected to B, A cannot communicate with C unless they both agree.
- Internal DNS between A and C is also unavailable.
VPC Peering: Setup demo
Same as the large demo before but do it for two separate projects and have only one subnet per project.
- Once created, go to VPC network –> network Peering
- Create a new connection there using the project name of the 2nd VPC and the VPC network name
Shared VPC: concepts
Within a Shared VPC network there can be several projects in different zones and they are grouped under a Host Project.
Each Host Project can have several Service Projects, each Service Projects can however have only one Host Project connection.
Projects that are not part of any of the above are called standalone projects.
Shared Networks are created to share the same resources available in the organisation between the projects in the shared network.
Note: external IP addresses within a host project are only available for use to the projects in this Host Project
Note: Service Projects communicate between one another using an Internal static IP.
Permissions within a Shared VPC
Shared VPC Admin – like an owner, has access to the whole shared VPC
Service Project Admin:
- Project-level permissions – allowed to work with all the subnets within a specific project in the shared VPC
- Subnet-level permissions – only allowed to work with a specific subnet(region) of a network
VPC Flow Logs (definition)
To monitor incoming and outgoing traffic from VM instances to the VPCs.
VPC Flow Logs: exporting
Logs can be exported to Cloud Logging for 30 days.
If they need to be stored for longer, they can be sent to a Cloud Storage bucket.
VPC Flow Logs: number of packets
1 of every 10 packets are captured (roughly), this cannot be modified.
To compensate for the loss of logs, it interpolates the data using the captured packets info.
VPC Flow Logs: use cases
- Network Monitoring
- Analyse network usage: countries, expenses
- Network Forensics: when incidents occur
- Real-time security analysis: using Pub/Sub and integrate with SIEM (Splunk, Rapid7, LogRhythm)
VPC Flow Logs: record format (the way in which the logs are saved)
- Core Fields: Base (connection, start/end time, bytes sent, packets sent..) + IP details (src IP, src port, dest IP…, protocol)
- Additional Fields: Metadata (src instance, src vpc, dest instance…) + Instance Details, Geo Details, GKE details etc.
VPC Flow Logs: exporting (costs)
Filtering by Core/Additional Fields, eg. by specific Metadata, allows to export only those specific logs and hence save money.
DNS Fundamentals: info storage
To store info about how the human-readable version is translated into an IP, a Zone File is created/used. The file is hosted/stored by the Nameserver.
DNS Record Types
Name Server Records (NS): which DNS server contains the current records for domain
A and AAAA records: address records for IPv4 (A) and IPv6 (AAAA); associated with the domain names, so A will point to google.com not the IP version
CNAME records: connect shop.bowtie.co and ftp.bowtie.co to botie.co
TXT records
MX records: which email the mail should go to
PTR records: pointer records. Points to the IP version and only then retrieves the domain name. When we search for an IP not a specific domain name.
SOA records: start of authority - stores info about the zone, zone cannot work without this info.
Network Address Translation (NAT)
Translate private IP addresses to public IPs.
Static NAT: maps 1 private IP to 1 public IP
Dynamic NAT: maps 1 private to a pool of public IP addresses
Port Address Translation (PAT): multiple private IPs to 1 public IP