Learn how to use network bridging to configure internet access for your virtual machines.
Bridged networking can be used to configure your virtual machines. Some tweaking is necessary to make the network configuration work on our network.
Requirements
- a dedicated server with a hypervisor installed (e.g., Citrix Xen Server, Proxmox, etc.)
- at least one Additional IP address attached to the server
- access to the OVHcloud Control Panel
NOTES:
- This feature might be unavailable or limited on servers of the Eco product line. Please visit our comparison page for more information.
- This guide does not apply to servers of the ranges Scale and High Grade.
- ADVANCE Gen 3 servers only support 32 vMACs per server.
- Please refer to the following guides instead:
Instructions
The basic steps are always the same, independent of the underlying system:
- creating a virtual MAC address for an Additional IP
- creating a VM on a host
- setting the MAC of the VM to that new virtual MAC address
- Configuring the IP address, netmask, gateway, and route to the gateway inside the VM
Code samples in the following instructions have to be replaced with your own values:
- SERVER_IP = The main IP address of your server
- ADDITIONAL_IP = The address of your Additional IP
- GATEWAY_IP = The address of your default gateway
Step 1: Assign a virtual MAC address
Please follow the instructions in our Assigning a Virtual MAC to an Additional IP guide.
After a few seconds, a virtual MAC will appear in the "Virtual MAC" column of your Additional IP row. This virtual MAC will be required when configuring your VM on the host.
Step 2: Determine the gateway address
To configure your virtual machines for internet access, you will need to know the gateway of your host machine (i.e., your dedicated server). You can retrieve the gateway via the OVHcloud Control Panel or the OVHcloud API.
Via the OVHcloud Control Panel
Log in to the OVHcloud Control Panel, go to the Bare Metal Cloud
section, and select your server in the Dedicated Servers section.
The IPv4 gateway assigned to your server will appear in the Network
section of the General Information
tab. Once you have copied it, continue with applying the configuration.
Via the OVHcloud API
On the OVHcloud API, execute the following API call, indicating the internal server name (example: ns1234567.ip-123-456-78.us
):
Step 3: Prepare the host
Proxmox
After creating the VM and while it is still powered off, right-click the VM and click Edit settings
.
- Select the VM.
- Open the
Hardware
section. - Select
Network Device
. - Click the
Edit
button.
Then, add the vMAC address created previously.
Now, you can start the VM and proceed with the configuration steps, depending on the operating system installed.
VMware ESXi
After creating the VM and while it is still powered off, right-click the VM and click Edit settings
.
Fold out Network Adapter 1
, change the value in the MAC Address
drop-down menu to Manual
, and enter the MAC address created previously.
Now, you can start the VM and proceed with the configuration steps, depending on the operating system installed.
Step 4: Configure the virtual machines
Debian
By default, the virtual machine's network configuration file is located in /etc/network/interfaces
.
Once you are connected to the shell of your virtual machine, run the following command to identify your interface name:
Next, make a copy of the configuration file, so that you can revert at any time:
In case of a mistake, you will be able to revert the changes, using the commands below:
Edit the file so that it reflects the configuration below, replace INTERFACE_NAME
, ADDITIONAL_IP
and GATEWAY_IP
with your own values.
Example
Save and close the file.
Next, edit or create the file /etc/resolv.conf
:
Add the following line:
Save and close the file.
Now you will need to bring your network interface online. To do so, enter the following command (replace ens192
with your own values):
Finally, restart your networking service using the following command:
To verify that the virtual machine is fully connected to the Internet, use the following command:
If you receive a response, this means that the Additional IP has been correctly configured. If not, reboot your virtual machine and retry the ping command.
Red Hat and Red Hat-based operating systems (CentOS, Rocky Linux 8/9, Alma Linux 8/9, etc.)
By default, the virtual machine's network configuration file is located in /etc/sysconfig/network-scripts/
.
Once logged into your virtual machine shell, run the following command to identify the name of your interface:
Then make a copy of the configuration file, so that you can go back at any time:
In the event of an error, you can go back to the beginning using the commands below:
You can then edit this file using the nmcli
handler, replacing ADDITIONAL_IP
and GATEWAY_IP
with your own values.
Add the IP address:
Add the Gateway:
Add a DNS server:
Change the configuration to manual:
Make the configuration persistent:
Reboot your network with the following command:
To verify that the virtual machine is fully connected to the Internet, use the following command:
If you receive a response, this means that the Additional IP has been correctly configured. If not, reboot your virtual machine and retry the ping command.
For more information on nmcli
, consult this page.
FreeBSD 12.0
By default, the virtual machine's network configuration file is located in /etc/rc.conf
.
Once you are connected to the shell of your virtual machine, run the following command to identify your interface name:
Next, make a copy of the configuration file, so that you can revert at any time:
In case of a mistake, you will be able to revert the changes, using the commands below:
Edit the file so that it reflects the configuration below, replace ADDITIONAL_IP
and GATEWAY_IP
with your own values. In this example, the interface name is em0
. Replace this value if it does not apply.
Save and close the file.
Next, edit or create the file /etc/resolv.conf
and add this line.
Save and close the file, then reboot your virtual machine.
To verify that the virtual machine is fully connected to the Internet, use the following command:
If you receive a response, this means that the Additional IP has been correctly configured. If not, reboot your virtual machine and retry the ping command.
Ubuntu
First, disable cloud-init:
Add this line to the 99-disable-network-config.cfg
file:
Then create the network configuration file in /etc/netplan/
with the following command:
Then apply these permissions on /etc/netplan
:
Run the following command to identify the name of your interface:
Next, make a copy of the configuration file, so that you can revert at any time. For demonstration purposes, our file is called 00-installer-config.yaml
:
In case of a mistake, you will be able to revert the changes, using the commands below:
Next, open the network configuration file:
Edit the file so that it reflects the configuration below, replace INTERFACE-NAME
, ADDITIONAL_IP
and GATEWAY_IP
with your own values.
For example
Save and close the file. You can test the configuration with the following command:
If it is correct, apply it using the following command:
To verify that the virtual machine is fully connected to the Internet, use the following command:
If you receive a response, this means that the Additional IP has been correctly configured. If not, reboot your virtual machine and retry the ping command.
Windows Server 2012 / Hyper-V
Before configuring your virtual machine, you need to create a virtual switch.
From the command line of your dedicated server, run the following command and note the name of the network adapter that contains the server's main IP address.
In the Hyper-V Manager, create a new virtual switch and set the connection type to External
.
Select the adapter with the server’s IP, then tick the option Allow management operating system to share this network adapter
.
Next, select the VM to which you want to add the Additional IP. Use the Hyper-V Manager to change the settings of the VM and shut it down.
Expand the network adapter in the left-hand menu and click on Advanced Features
. Change the MAC address to Static
, and enter the virtual MAC address for the Additional IP. Once you have entered these settings, press OK
to apply the changes.
Next, start the VM and log in as an administrator, then go to the Control Panel
's Network and Sharing Center
. Click on Ethernet
to open the settings and click on the Properties
button to view the Ethernet Properties
.
Select Internet Protocol Version 4 (TCP/IPv4)
, and then click on the Properties
button.
In the IPv4 Properties window, select Use the following IP address
. Enter the Additional IP into the IP address field, and enter 255.255.255.255 into the subnet mask.
Fill in your server’s gateway IP address in the appropriate field below and enter 213.186.33.99 into the Preferred DNS Server
field.
Finally, click OK
, and ignore the warning message about the gateway IP and the assigned IP not being in the same subnet.
After rebooting the server, the VM should be connected to the internet using the Additional IP.
Troubleshooting
If you are unable to establish a connection from your VM to the public network and you suspect a networking problem, please reboot the server in rescue mode and set up the bridging network interface directly on the host.
Enter the following command in the rescue mode terminal, in which you replace MAC_ADDRESS with the vMAC address that you have generated in the Control Panel and ADDITIONAL_IP with your Additional IP address:
Next, ping your Additional IP address from an external device.
-
If it responds, that probably means that there is a configuration error either on the VM or the host that prevents the Additional IP from working in normal mode.
-
If the IP address is still not working, please create a ticket in your OVHcloud Control Panel to relay your test results to our support teams.
Go further
For more information and tutorials, please see our other Dedicated Servers support guides or explore the guides for other OVHcloud products and services.