How to configure the network of a virtual machine
- You have an account and are logged into the Dedibox console
- You have created a Dedibox dedicated server and installed a hypervisor on it
- You have ordered a failover IP
- You have generated a virtual MAC address
When you install your server with a virtualization solution like VMware vSphere Hypervisor (ESXi) or Proxmox you can create multiple virtual machines on the physical server.
This can be used to have separate environments to divide between your different services (for example keeping mail and web services on different VMs) or to launch several virtual machines to make better use of the performance of the server.
To communicate on the Internet each of your virtual machines needs an IP address. You can use failover IP’s to have additional IP addresses available for your server.
You can configure a unique gateway for your virtual machines. In doing so, your VMs can move between your hypervisors without changing the network configuration of the virtual machine.
- IP address of the unique gateway:
62.210.0.1
You can find below, examples for the configuration of the network interfaces on different distributions inside a virtual machine:
Ubuntu
Since the release of version 18.04 (Bionic Beaver) Ubuntu has switched to Netplan for the configuration of network interfaces. For older releases of the distribution, refer to the configuration for Debian.
- Log into your virtual machine and open the network configuration file
/etc/netplan/01-netcfg.yaml
in a text editor of your choice, for examplenano
:sudo nano /etc/netplan/01-netcfg.yaml - Create a network configuration as follows. Remember to replace
fail.over.ip.address
with your failover IP address:network:version: 2renderer: networkdethernets:eth0:dhcp4: nodhcp6: noaddresses: [fail.over.ip.address/32]gateway4: 62.210.0.1nameservers:addresses: [62.210.16.6, 62.210.16.7]routes:- to: 62.210.0.1/32via: fail.over.ip.addressscope: link - Save the file and exit the text editor.
- Apply the new configuration:
sudo netplan apply
Debian
-
Log into the virtual machine and edit the file
/etc/network/interfaces/
with a text editor of your choice, for example,nano
:nano /etc/network/interfaces -
Configure the network interface as follows. Remember to replace
fail.over.ip.address
with your failover IP address:auto eth0iface eth0 inet staticaddress fail.over.ip.addressnetmask 255.255.255.255pointopoint 62.210.0.1gateway 62.210.0.1 -
Save the file and exit the text editor.
-
Set the DNS server information by editing the file
/etc/resolv.conf
:nano /etc/resolv.conf -
Set the DNS resolver by adding the following lines to the file. Then save it and exit the text editor:
nameserver 62.210.16.6nameserver 62.210.16.7The DNS resolvers above are operated by Scaleway. You can also set your preferred alternative DNS resolvers in the file.
-
Activate the network on your virtual machine by running the following code:
ifup eth0
CentOS
-
Log into the virtual machine and edit the file
/etc/sysconfig/network-scripts/ifcfg-eth0
with a text editor of your choice, for example,nano
:nano /etc/sysconfig/network-scripts/ifcfg-eth0 -
Configure the network interface as follows. Remember to replace
fail.over.ip.address
with your failover IP address andvirtual:mac:address
with the virtual MAC of the VM:DEVICE=eth0BOOTPROTO=noneONBOOT=yesUSERCTL=noIPV6INIT=noPEERDNS=yesTYPE=EthernetNETMASK=255.255.255.255IPADDR=fail.over.ip.addressGATEWAY=62.210.0.1DNS1=62.210.16.6DNS2=62.210.16.7ARP=yesHWADDR=virtual:mac:address -
Save the file and close the text editor.
-
Edit the file
/etc/sysconfig/network-scripts/route-eth0
as follows, then save and exit the text editor:62.210.0.1 dev eth0default via 62.210.0.1 dev eth0 -
Run the following command to bring the network interface up:
ifup eth0
Windows Server
- Connect to the desktop of your VM in the virtual console, then open the network settings of your server.
- Enter the following information in the network adapter configuration:
- Address: failover IP
- Subnetmask:
255.255.255.255
- Gateway:
62.210.0.1
- DNS 1:
62.210.16.6
- DNS 2:
62.210.16.7