---
title: "How to connect a VM to the internet using VMware ESXi"
description: "NOTE: If you are using a Scale or HG server, please refer to the following guide instead: How to Configure the Network on VMware ESXi with SCALE and HG Servers."
url: https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/connect-vm-internet-using-vmware-esxi
lang: en
---
> For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt.

# How to connect a VM to the internet using VMware ESXi

**Warning:**

**NOTE:** If you are using a Scale or HG server, please refer to the following guide instead: [How to Configure the Network on VMware ESXi with SCALE and HG Servers](https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/configuring-network-vmware-esxi-scale-hg-servers.md).

 

## Requirements

- A [dedicated server](https://us.ovhcloud.com/bare-metal/) with [ESXi installed](https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/esxi-partitioning.md) (hardware requirements are in the [Broadcom documentation](https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/esx-upgrade/upgrading-esxi-hosts-upgrade/esxi-requirements-upgrade/esxi-hardware-requirements-upgrade.html))
- A VM in your ESXi environment ([How to Create a VM in VMware ESXi](https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/create-vm-vmware-esxi.md))
- An [Additional IP](https://us.ovhcloud.com/network/additional-ip/) through OVHcloud

***

### OVHcloud Control Panel Access

- **Direct link:** [Public IP addresses](https://manager.us.ovhcloud.com/#/network/ip)
- **Navigation path:** `Bare Metal Cloud` > `Network` > `IP`

***

 

## Instructions

### Adding a virtual MAC to an Additional IP

Find the Additional IP you wish to configure for your VM, click the _more options_ `...` button next to it, and choose the `Add a virtual MAC` option from the drop-down menu.

In the pop-up menu, change the **Type** to `vmware` and enter the name of your virtual machine.

**Warning:**

**NOTE:** Please allow up to three minutes for the vMAC to populate in the OVHcloud Control Panel.

 

### Adding the virtual MAC to the VM in ESXi

In the ESXi Host Client, locate your VM in the `Virtual Machines` menu, select it, and `⏻ Power off`.

Right-click the VM and select the `Edit settings` option from the drop-down menu.

In the VM's settings, expand the `Network Adapter 1` drop-down.

Change the **MAC Address** to `Manual` and enter the vMAC created in the [previous step](#adding-a-virtual-mac-to-an-additional-ip).

**Tip:**

You can now `▶ Power on` your VM!

 

### Configuring network settings

The steps to configure the network on your virtual machine depend on the operating system you are using; select yours below.

#### Debian 11

**Note:** If you don't know the name of your interface, you can find it using the following command:
```
$ ip add
```

First, open your interface configuration file in a text editor of your choice, using the following command:
```
$ sudo vi /etc/network/interfaces
```
Edit the interfaces file to make it appear as follows:
```

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).
 
source /etc/network/interfaces.d/*
 
# The loopback network interface

auto lo
iface lo inet loopback
 
# The primary network interface

auto ens192
iface ens192 inet static
address 192.0.2.1
netmask 255.255.255.255
gateway 203.0.113.254
dns-nameservers 208.67.222.222 208.67.220.220
```
In this file, replace the following pieces of information as instructed:
- **address:** Replace `192.0.2.1` with the Additional IP from the [first step](#adding-a-virtual-mac-to-an-additional-ip) of this guide.

- **gateway:** Replace `203.0.113.254` with your Dedicated Server's gateway.

  **Note:**

  You need the first three octets of your Dedicated Server's IP address with a final octet of "254". For example, if your Dedicated Server's IP was 1.2.3.4, you would use 1.2.3.254 as your gateway.

- **dns-nameservers:&#x20;**&#x54;he DNS name servers listed are from OpenDNS; feel free to use other name servers if you choose.

Now you will need to bring your NIC online. To do so, enter the following command:
```
$ sudo ip link set ens192 up
```
Finally, restart your networking service using the following command:
```
$ sudo systemctl restart networking
```

#### Ubuntu 22.04+ / Debian 12+

Ubuntu (22.04 and later) and Debian (12 and later) both use [Netplan](https://netplan.io) for network configuration.
To configure the network interface, open the network configuration file `/etc/netplan/` in a text editor of your choice. The exact file name may vary depending on your image — in this example, it's called `50-cloud-init.yaml`.
```
$ sudo vi /etc/netplan/50-cloud-init.yaml
```
Edit the file to make it appear as follows:
```

# This file describes the network interfaces available on your system

# For more information, see netplan(5).
 
network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      dhcp4: no
      dhcp6: no
      addresses: [192.0.2.1/32]
      gateway4: 203.0.113.254
      nameservers:
        addresses: [208.67.222.222,208.67.220.220]
      routes:
      - to: 203.0.113.254/32
        via: 0.0.0.0
        scope: link
```
In this file, replace the following pieces of information as instructed:
- **ethernets:** Replace `ens160` with the name of your interface. If you don't know the name of your interface, you can find it using the following command:

  ```
  $ ip add
  ```

- **addresses:** Replace `192.0.2.1/32` with the Additional IP (in CIDR notation) from the [first step](#adding-a-virtual-mac-to-an-additional-ip) of this guide.

- **gateway4:** Replace `203.0.113.254` with your Dedicated Server's gateway.

  **Note:**

  You need the first three octets of your Dedicated Server's IP address with a final octet of "254". For instance, if your Dedicated Server IP was 1.2.3.4, you would use 1.2.3.254 as your gateway.

- **nameservers:** The DNS name server addresses listed are from OpenDNS; feel free to use other name servers if you choose.

**Warning:** **NOTE:** The additional IP is configured with a host-only (`/32`) netmask, and the gateway sits outside that subnet — this is expected for OVHcloud Additional IPs. The `routes:` section above tells Netplan to treat the gateway as directly reachable. Omitting it — relying on `gateway4` alone — can leave the interface unable to reach the gateway.

Now apply the Netplan settings with the following command:
```
$ sudo netplan apply
```

#### AlmaLinux & Rocky Linux (8/9)

First, navigate to the `network-scripts` directory using the following command:
```
$ cd /etc/sysconfig/network-scripts
```
Use the `ls` command to view the directory contents.
```
$ ls -al
```
Locate your interface file (e.g., `ifcfg-ensXXX`) and then open it in a text editor of your choice using the following command:

**Warning:** **NOTE:** In our example the interface file is `ifcfg-ens192`.

```
$ sudo vi ifcfg-ens192
```
Edit the interfaces file to make it appear as follows:
```
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens192
UUID=*DO NOT edit this field!*
DEVICE=ens192
ONBOOT=yes
IPADDR=192.0.2.1
NETMASK=255.255.255.255
DNS1=208.67.222.222
DNS2=208.67.220.220
```
In this file, check or replace the following pieces of information as instructed:
- **ONBOOT=** Verify that is says `yes`.

- **BOOTPROTO=** Verify that is says `none`.

- **IPADDR=** Replace `192.0.2.1` with the Additional IP from the [first step](#adding-a-virtual-mac-to-an-additional-ip) of this guide.

- **GATEWAY=** Replace `203.0.113.254` with your Dedicated Server's gateway.

  **Note:**

  You need the first three octets of your Dedicated Server's IP address with a final octet of "254". For instance, if your Dedicated Server IP was 1.2.3.4, you would use 1.2.3.254 as your gateway.

- **DNS1=** and **DNS2=** The DNS name servers listed are from OpenDNS; Feel free to use whichever name servers you prefer.

Next, since the Additional IP uses a host-only (`/32`) netmask and the gateway sits outside that subnet, create a companion route file, `route-ens192`, in the `/etc/sysconfig/network-scripts/` directory to make the gateway reachable:
```
$ sudo vi /etc/sysconfig/network-scripts/route-ens192
```
```
203.0.113.254 dev ens192
default via 203.0.113.254 dev ens192
```
Replace `203.0.113.254` with your Dedicated Server's gateway.

**Note:** You need the first three octets of your Dedicated Server's IP address with a final octet of "254". For instance, if your Dedicated Server IP was 1.2.3.4, you would use 1.2.3.254 as your gateway.

Next, enable the NIC by restarting the network service:
```
$ sudo systemctl restart NetworkManager
```

#### Windows Server

In this step, we will be configuring our interface settings. To do this, navigate to the **Server Manager**. From the left-hand column, click the `Local Server` option.

By default, the **Ethernet0** field will read: `IPv4 address assigned by DHCP, IPv6 enabled`. This is exactly what we want to change, so click on this text.

Next, `right-click` on **Ethernet0** and select the `Properties` option from the drop-down menu. From the ensuing menu, `double-click` the **Internet Protocol Version 4 (TCP/IPv4)** option.

This will allow you to configure your interface to use the IP address, gateway, and DNS name servers of your choice. Configure it as follows:

Enter the following information in the dialog box, as shown in the picture:
1. **IP address:** Replace `203.0.113.32` with the Additional IP from the first step of this guide.
2. **Subnet mask:** Replace `255.255.255.248` with the correct netmask depending on the size of the block of IPs you have purchased. For example, if you are using a /28 block, put "240" in the last octet.
3. **Default gateway:** Replace `147.135.0.254` with the first three octets of your Dedicated Server's IP address with a final octet of "254".
4. **DNS server addresses:** The DNS nameservers listed are from OpenDNS; feel free to use other name servers here, if you choose.

Click `OK` after making these changes.

To test that the VM is fully connected to the Internet, ping example.com. If you get a response, you are good to go. If you do not, restart your VM and attempt the ping again.

 

## Go further

Browse all the [Dedicated Servers guides](https://docs.us.ovhcloud.com/en/bare-metal-cloud/dedicated-servers/landing-page-dedicated-servers.md).

Browse the rest of the [OVHcloud US documentation](https://docs.us.ovhcloud.com/en/index.md) for guides on our other products and services.

Learn more about [Dedicated Servers](https://us.ovhcloud.com/bare-metal/) on the OVHcloud US website.
