Prerequisites
- An OnetSolutions account with a project
- At least one instance, or the intention to create some
Creating a VPC
1
Open VPC
In the console, go to Compute and open the VPC tab.
2
Start creating
Click Create VPC.
3
Name the network
Fill in Network Name — something describing its role, such as
prod-backend.4
Choose the CIDR block
Enter a private IP range in CIDR Block, for example
10.0.0.0/16. This defines the addresses instances on this network receive.5
Create
Confirm. The network appears in the list with its status.
Choosing a CIDR Block
Use a range reserved for private networks. Three blocks are set aside for this:
A
/16 gives you 65,536 addresses, which is generous for most projects and leaves room to grow. There is no benefit in being tight here.
Pick a range that does not collide with anything else you connect to — your office network, a VPN, or Docker’s default bridge. Overlapping ranges cause routing problems that are tedious to diagnose after the fact, and the CIDR cannot be changed later.
Attaching an Instance
1
Open the instance
In Compute, open the instance you want to attach.
2
Go to its VPC tab
Select the VPC section for that instance.
3
Associate
Pick the network from Available VPCs and click Associate.
A VPC belongs to a location, and only instances in that same location can join it. If the list is empty, the instance is in a location where you have no VPC yet.
Using the Private Network
Once two instances share a VPC, they reach each other over their private addresses. Find the private address on the instance:0.0.0.0: is exposed on the public interface.
VPC and Firewall
The two solve different problems and work together. The VPC provides a private path between instances; the firewall controls what may travel over it and what may reach the instance publicly. A private network is not by itself a permission system — every instance attached to the same VPC can reach every other one. If that is too broad, firewall rules are what narrow it.Troubleshooting
No VPC appears in the instance's list
No VPC appears in the instance's list
The instance is in a different location from your VPC. A VPC only accepts instances in the location it was created in — create one in the instance’s location.
Two instances are attached but cannot reach each other
Two instances are attached but cannot reach each other
Check the service is bound to the private address rather than to localhost, then check the firewall allows the traffic between them.
ss -tlnp on the target answers the first question.The private address is missing on the instance
The private address is missing on the instance
A newly attached instance may need its network reconfigured or a reboot before the interface appears. Confirm with
ip -4 addr show.Routing behaves strangely after attaching
Routing behaves strangely after attaching
Usually an overlap between the VPC range and another network the instance uses, most often Docker’s default bridge on
172.17.0.0/16. Compare with ip route.
