Using Customized Internal IP on Google Cloud

Quick Tip

When setting up a database replication, for example on Oracle DataGuard or MariaDB Replication you may want to establish a particular internal IP for this connection to isolate the replication data transfer from the other network traffic.

We are going to create some reserved static addresses so we can assign them to our database virtual machines, in this example for using in our Oracle installation.

Create Subnet

First create a subnet patosubnet inside the default network:

On Google Cloud Platform -> Networking -> VPC Network -> default -> Subnets

  • Click Add subnet
    • Name: patosubnet
    • Region: us-central1
    • IP address range: 10.20.0.0/20

and click ADD

Create Reserved Static Address

Now create a the static addresses you will need for your virtual machines:

On Google Cloud Platform -> Networking -> VPC Network -> default -> Static internal IP addresses

  • Click Reserve static address
    • Name: prmynet
    • Subnet: patosubnet
    • Static IP address: Let me choose
    • Custom IP address: 10.20.0.10

and click RESERVE

  • Click Reserve static address
    • Name: stbynet
    • Subnet: patosubnet
    • Static IP address: Let me choose
    • Custom IP address: 10.20.0.20

and click RESERVE

Open Database Port

Allow traffic on Oracle Listener port 1521 in the Google Cloud Firewall for our subnet:

On Google Cloud Platform -> Networking -> VPC Network -> Firewall -> Create Firewall Rule

  • Name: patonet-oracle
  • Network: default
  • Priority: 1000
  • Direction of traffic: Ingress
  • Action on match: Allow
  • Targets: All instances in the network
  • Source Filter: IP Ranges
  • Source IP Ranges: 10.20.0.0/20
  • Protocols and ports: Specified protocols and ports
    • tcp: 1521

Now you have your Reserved Static Addresses that you can assign as Internal IP to your Virtual Instances when you create them.