Manage private networks
Private networks are simpler than VLAN networks, and are the recommended way to privately connect VMs.
It is possible to create private networks between VMware servers. This allows them to communicate directly with each other without sending traffic over the public internet, thereby enhancing the security of the information exchanged between the servers.
Private networks are also divided into segments. When you create a private network, you must also create one or more segments within that network. Each segment is a unified entity that encompasses resources belonging to the same platform and data center.
Private networks are the recommended way to connect VMs. If you also need to connect physical hardware to your VMs, consider using VLAN networks instead.
Create private networks using the control panel
You find private networks under Networking in the left-hand menu. Click Private networks, and then click Create to create a new private network.

In the next step, name the network, for instance, test-net.

Once the private network is created, the segments within the network are displayed. No segments exist initially in a new private network—you need to create them yourself. A segment is a subdivision of the private network that allows you to partition it into smaller sections. Here, click + Create segment.

In the next dialog box, configure the settings for the segment. In this example, we name the segment lab and change the platform to VMware. In the dropdown menu for the data center, select the data center where your VMware servers are located; in this case, Falkenberg.
Under IP addresses, specify the network segment—the network and subnet mask—that you wish to use. In this example, we choose 192.168.0.0/24. This setup provides 251 usable IPv4 addresses for servers (256 addresses minus the addresses .0, .1, .2, .3, and .255). The first three addresses, .1, .2, and .3, are reserved for routing traffic between segments in the private network.

The network is complete, and you can see it in the overview of Private networks.

Connect VMs to a private network
To connect your virtual machines to the private network, you first need to create a new network adapter on each VM that will communicate with the others. The newly created network adapter on each VM is then connected to the private network, and we assign it an IP address within the same network as the one specified in the segment.
To create a new network adapter on a VM, first select the VM under Compute → Virtual machines. Here, click on the server where we want to create the network adapter.
Next, select the Network adapters tab and click + Create Network Adapter. The network adapter already visible in the list is used for internet connectivity.

In the dialog box that opens, select the type of adapter (VMXNET 3 is good for most situations), the connection type (Private network), and which network segment it should be connected to. Also, select the speed of the network adapter. Finally, click Create.

Once the adapter is created, it appears in the overview of all adapters for the VM. The standard adapter for internet connectivity and the new adapter for the private network are now shown.

Assign an IP address to the adapter in the VM's operating system
Before using the private network, you must assign an IP address within the segment you specified when creating the network to the new network adapter on each VM's operating system. The method for doing this varies between different systems.
After adding the adapter to the VM, you need to determine the adapter's name in Ubuntu. The easiest way to do this is by checking dmesg. Enter the following command:
The line you are looking for should resemble something like this:
This means the new adapter has been assigned the name ens224 in the system.
If, for some reason, the adapter cannot be found in the output from dmesg, it is also possible to list all adapters using the command ip addr. The adapter without an IP address is most likely the new one.
Once you know the adapter's name, add it to the file /etc/netplan/50-cloud-init.yaml. We must add the configuration for the new adapter ens224, and keep the configuration for ens192 as is.
Here, we assign ens224 the IP address 192.168.0.6 with the subnet mask /24 (255.255.255.0). Since this is a private network, assigning a gateway or DNS to the adapter is unnecessary.
The file should look like this (note that ens224 must be indented with the same amount of spaces as ens192):
Save the file and test the configuration with sudo netplan try. If you see the countdown timer, the file is likely correct; in this case, press the Enter key to confirm.
Next, we make sure the adapter has been assigned an IP address:
Finally, to prevent the settings from being overwritten by cloud-init, you must also execute the following command:
After adding the adapter to the VM, you need to determine the adapter's name in Debian. The easiest way to do this is by checking dmesg. Enter the following command:
The line to look for should resemble something like this:
This means that the new adapter has been assigned the name ens224 in the system.
If, for some reason, the adapter cannot be found in the output from dmesg, it is also possible to list all adapters using the command ip addr. The adapter without an IP address is most likely the new one.
Once you know the adapter's name, add it to the file /etc/network/interfaces.d/50-cloud-init and assign it an IP address. We leave the existing lines in the file as they are. Here, we assign it the IP address 192.168.0.7 with the subnet mask /24 (255.255.255.0).
The entire file will then look something like this, depending on its prior content:
Next, you need to restart the network for the changes to take effect. This can be done with the following command:
We make sure everything worked out:
Finally, you need to disable automatic network configuration through cloud-init to prevent it from overwriting your settings. This is accomplished with the following command:
Begin by identifying the name of the new adapter using either dmesg or ip addr.
The line you are looking for should resemble something like this:
The name of the new adapter is eth1.
If, for some reason, the adapter cannot be found in the output from dmesg, it is also possible to list all adapters using the command ip addr. The adapter without an IP address is most likely the new one.
Once you know the adapter's name, assign it an IP address. The easiest way to do this is with the nmcli command. Start by confirming that the adapter appears in the list using nmcli connection.
The adapter ens224 is likely highlighted in yellow because it lacks an address. Now, assign the adapter an IP address. In this example, we choose 192.168.0.8 with the subnet mask /24 (255.255.255.0). Use the full name from the list, Wired connection 1, which corresponds to ens224.
Next, you also need to set the adapter to manual (static) mode:
Now, let's activate the adapter using the new settings:
Finally, make sure the adapter has the correct IP address:
Start by right-clicking on the network icon in the taskbar. Then, select Open Network & Internet settings.

In the dialog window that opens, select Change adapter options.

A list of all the server's network adapters is now displayed. The one with the highest number is most likely the new adapter; in this case, it is Ethernet 1. Right-click on it and select Properties.

In the next dialog box, select Internet Protocol Version 4 (TCP/IPv4) and click on Properties.

Next, assign an IP address to the adapter. Here, we select the IP address 192.168.0.9 with the subnet mask 255.255.255.0 (/24). When you're finished, click OK to save the settings.

Start by right-clicking on the network icon in the taskbar. Then, select Open Network & Internet settings.

In the window that opens, select Advanced network settings.

A list of all the server's network adapters is now displayed. The one with the highest number is most likely the new adapter; in this case, it is Ethernet1. Click on it to expand the settings for the adapter, and select Edit.

In the next dialog box, select Internet Protocol Version 4 (TCP/IPv4) and click on Properties.

Next, assign an IP address to the adapter. Here, we select the IP address 192.168.0.9 with the subnet mask 255.255.255.0 (/24). When you're finished, click OK to save the settings.

Finally, after all the servers have been assigned an IP address, you can ping them:
Delete a private network
To delete a private network, you must first delete all the network adapters that are connected to it. Then, you must delete the segments within the network. Finally, you can delete the network.
Start by deleting the network adapter from each VM that is connected to the private network. Click on the virtual machine in the overview, select the Network adapters tab, click the three dots next to the adapter connected to the private network's segment, and click Delete.

A dialog window will open where you need to confirm the deletion by typing the name of the adapter and clicking Delete.
Next, delete the segment within the network. Click Private networks in the left-hand menu to open an overview of all your private networks. Click on the network for which you want to delete the segment.
Delete the segment by clicking the three dots next to the segment name and selecting Delete.

In the next dialog box, confirm the deletion of the segment by typing the segment's name in the text field and clicking Delete.
Finally, delete the entire private network by clicking the three dots at the top of the network overview and selecting Delete.

In the next dialog box, confirm the deletion by typing the network's name in the text field and selecting Delete.
Create a private network using the API
To create a private network using the API, follow the same pattern as when creating a private network using the control panel.
Create a new private network using the privatenetwork/create endpoint.
Create a new segment within the private network, using the privatenetwork/createsegment endpoint.
List the segments within the private network using privatenetwork/listsegments endpoint to get the ID of the segment.
Create a new network adapter for the VM, using the networkadapter/create endpoint. For the network ID, use the segment ID from point 3 above.
Manage private networks using the API
To edit a private network, use the privatenetwork/edit endpoint.
To edit a segment within a private network, use the privatenetwork/editsegment endpoint.
To list your private networks and segments, use the privatenetwork/list and privatenetwork/listsegment, respectively.
To delete a segment within a private network, use the privatenetwork/deletesegment endpoint.
To delete a private network, use the privatenetwork/delete endpoint.
To retrieve an estimated cost of a private network, use the privatenetwork/estimatedcost endpoint.
Last updated
Was this helpful?