NavigationContentFooter
Jump toSuggest an edit

How to configure the network of a virtual machine

Reviewed on 15 January 2024Published on 29 July 2021
Requirements
  • 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.

Tip

You can configure a unique gateway for your virtual machines, allowing them to move between hypervisors without changing their network configuration.

  • IP address of the unique gateway: 62.210.0.1

Find below examples of network interfaces configuration 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.

  1. Log into your virtual machine and open the network configuration file /etc/netplan/01-netcfg.yaml in a text editor of your choice, for example nano:
    sudo nano /etc/netplan/01-netcfg.yaml
  2. Create a network configuration as follows. Remember to replace fail.over.ip.address with your failover IP address:
    network:
    version: 2
    renderer: networkd
    ethernets:
    eth0:
    dhcp4: no
    dhcp6: no
    addresses: [fail.over.ip.address/32]
    gateway4: 62.210.0.1
    nameservers:
    addresses: [62.210.16.6, 62.210.16.7]
    routes:
    - to: 62.210.0.1/32
    via: fail.over.ip.address
    scope: link
  3. Save the file and exit the text editor.
  4. Apply the new configuration:
    sudo netplan apply

Debian

  1. 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
  2. Configure the network interface as follows. Remember to replace fail.over.ip.address with your failover IP address:

    auto eth0
    iface eth0 inet static
    address fail.over.ip.address
    netmask 255.255.255.255
    pointopoint 62.210.0.1
    gateway 62.210.0.1
  3. Save the file and exit the text editor.

  4. Set the DNS server information by editing the file /etc/resolv.conf:

    nano /etc/resolv.conf
  5. Set the DNS resolver by adding the following lines to the file. Then save it and exit the text editor:

    nameserver 62.210.16.6
    nameserver 62.210.16.7
    Note

    The DNS resolvers above are operated by Scaleway. You can also set your preferred alternative DNS resolvers in the file.

  6. Activate the network on your virtual machine by running the following code:

    ifup eth0

CentOS

  1. 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
  2. Configure the network interface as follows. Remember to replace fail.over.ip.address with your failover IP address and virtual:mac:address with the virtual MAC of the VM:

    DEVICE=eth0
    BOOTPROTO=none
    ONBOOT=yes
    USERCTL=no
    IPV6INIT=no
    PEERDNS=yes
    TYPE=Ethernet
    NETMASK=255.255.255.255
    IPADDR=fail.over.ip.address
    GATEWAY=62.210.0.1
    DNS1=62.210.16.6
    DNS2=62.210.16.7
    ARP=yes
    HWADDR=virtual:mac:address
  3. Save the file and close the text editor.

  4. Edit the file /etc/sysconfig/network-scripts/route-eth0 as follows, then save and exit the text editor:

    62.210.0.1 dev eth0
    default via 62.210.0.1 dev eth0
  5. Run the following command to bring the network interface up:

    ifup eth0

Windows Server

  1. Connect to the desktop of your VM in the virtual console, then open the network settings of your server.
  2. 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
See also
How to create a multi-IP virtual MAC group
Cloud Products & Resources
  • Scaleway Console
  • Compute
  • Storage
  • Network
  • IoT
  • AI
Dedicated Products & Resources
  • Dedibox Console
  • Dedibox Servers
  • Network
  • Web Hosting
Scaleway
  • Scaleway.com
  • Blog
  • Careers
  • Scaleway Learning
Follow us
FacebookTwitterSlackInstagramLinkedin
ContractsLegal NoticePrivacy PolicyCookie PolicyDocumentation license
© 1999-2024 – Scaleway SAS