Network-related activities are as important as overall management and storage activities – not only in real life when working with Google Cloud but also for the exam.
The following tasks represent Compute Engine networking activities. The upcoming chapter is dedicated to covering VPC, VPN, and Load Balancer networking resources.
Configuring an instance with a static internal IP address
Reserving a static internal IP address before creating a VM is possible. Alternatively, we can create an instance with an ephemeral internal IP address and convert it in to a static internal IP address.
Console
To reserve a static internal IP address in the Cloud console, follow these steps:
- Go to the VPC networks.
- Choose the desired VPC network where you want to reserve a static internal IP address.
- Click STATIC INTERNAL IP ADDRESSES and then RESERVE STATIC ADDRESS.
- We need to enter the details for the following fields in the form:
• Name
• Description
• Subnet: The subnet where we want to reserve the static IP address
• Static IP address: Select to assign it automatically or manually
• Purpose: Shared or non-shared
Figure 4.57 – Reserving a static internal IP address
You have the option to choose a static IP address automatically, or you can enter it manually, and if you select the Shared option for the purpose, it can be shared by 50 frontends:
Figure 4.58 – An example of reserved static IP addresses assigned automatically and manually
In Google Cloud, part of the network IP ranges is reserved. These reservations are essential for management.
The following is the list of used IPs from the network range:
- Network: The first address in the primary IP range for the subnet – for example, 10.11.12.0 in 10.11.12.0/24
- Default gateway: The second IP address from the IP range – for example, 10.11.12.1 in 10.11.12.0/24
- Second-to-last-address: the IP address reserved by Google Cloud for potential future use – for example, 10.11.12.254 in 10.11.12.0/24
- Broadcast: The last address from the IP range – for example, 10.11.12.255 in 10.11.12.0/24
To learn more about IP ranges in Google Cloud, visit the following link: https://cloud.google.com/vpc/docs/subnets#ip-ranges.
Reserving the static IP address is just the first part of configuring the instance with this IP. We need to go to the end of instance settings and change the IP address from Ephemeral to a previously created one:
Figure 4.59 – Adding a static IP address to the running instance
Once this task is done, your instance will have the static internal IP you previously configured.