I am new into Ubuntu 18.04 and I am trying to make my VPS hosted on dedicated server (VMware) working, I tried the automatic network setup during install, but I got an subnet error, because IP and netmask are not in the same subnet.

Then I read a ton of tutorials how to set static IP in netplan, but I am still not able to make it work; now my broadcast IP and netmask are different then the VPS one should be.

My current ifconfig looks like this:

ens160 and lo interface output from ifconfig run as root

As I said, I tried several tutorials and it was a long pain, because in the VM without network hosted on dedicated server, you can't just copy&paste - you need to write everything by hand, now I tried something about 5 configs and I am lost and tired of typing bad configs. Can you help me out please?

Actual config (50-cloud-init.yaml) looks like this:

50-cloud-init.yaml in nano

Thank you so much for all your help and ideas :)

Further information

Thank you for helping me out, unfortunately, I am sure I have my config from ISP right, it's an bridge for OVH failover IP and as you can read here, their configuration seems to need these settings.

It's all described here and I think that I got it right, even Debian 8 has problems with installation because of the gateway out of subnet, but when you will put it directly in the config after installation, it will work. Here is the doc: https://docs.ovh.com/gb/en/dedicated/network-bridging/

So what I get from it:

1) My main server IP is, so according to the documentation, I should replace the last number with 254, so the gateway IP will be

For example, if your server’s main IP address is: 123.456.789.012. Your gateway address would therefore be: 123.456.789.254 (from OVH documentation linked above)

2) The failover IP I got is, so this will be the IP of my VM (I also generated the MAC address in the OVH admin panel and I inserted this MAC address into the VMware settings, so the network card has the right MAC. You can check that the MAC address on the screen here match the IP in ifconfig posted in my previous post)

screen of OVH admin panel

3) Here you can see config (/etc/network/interfaces) from my different VM on a diferent server running Debian 8. The base IP of the server is

auto eth0
iface eth0 inet static
        post-up route add dev eth0
        post-up route add default gw
        post-down route del dev eth0
        post-down route del default gw
auto eth1
iface eth1 inet dhcp

and here is the ifconfig output:

root@lfcz:~# ifconfig
eth0      Link encap:Ethernet  HWadr 00:50:56:05:94:73
          inet adr:  Všesměr: Maska:
          inet6-adr: fe80::250:56ff:fe05:9473/64 Rozsah:Linka
          RX packets:49421930 errors:0 dropped:10407 overruns:0 frame:0
          TX packets:37347078 errors:0 dropped:0 overruns:0 carrier:0
          kolizí:0 délka odchozí fronty:1000
          RX bytes:33409153963 (31.1 GiB)  TX bytes:15110079692 (14.0 GiB)

Maybe I am just not getting something, but I really don't know, what I should do with the Ubuntu configuration now. Please don't take this post as an offence or arguing against you, I am just trying to post every important information to make helping me easier as I am lost now. Thank you again for all the help!

  • 1
    Please do not post text as pictures. Copy from the terminal, and paste into the question. Please see askubuntu.com/editing-help#code on how to format command output.
    – vidarlo
    Aug 4, 2018 at 19:40
  • I will do it as soon as I will can, this terminal under VM is a VNC, so I don't have direct access to the text to copy&paste it. I am sorry for that, but I hope you understand that I don't want to copy it by hand. Sorry again. :/
    – DJ_Ironic
    Aug 5, 2018 at 10:35
  • I edited your answer into your question. New information should be added to the question, not as an answer :) I also removed my answer, as it was not applicable in your situation, as I misunderstood :)
    – vidarlo
    Aug 5, 2018 at 11:13
  • 1
    Thanks, now the answer will be posted, as OVH just created a tutorial for this...exatly 9 hours ago, so it was not available whe I posted this here. :D
    – DJ_Ironic
    Aug 5, 2018 at 11:42

1 Answer 1


OK, Everything is finished!

OVH just posted a tutorial how to do this, literally posted 9 hours ago, so it was not available when I created this post, you can find the official tutorial including configuration here.

Configuring Network Settings in an Ubuntu 18.04 VM

As of Ubuntu 17.x, Canonical has implemented the use of Netplan for easy-to-use network configuration.

To configure the network interface, open the 01-netcfg.yaml file using the following command:

sudo vim /etc/netplan/01-netcfg.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).

  version: 2
  renderer: networkd
                  dhcp4: no
                  dhcp6: no
                  addresses: [x.x.x.x/32]
                  gateway4: y.y.y.254
                          addresses: [,]
                  - to: y.y.y.254/32
                    scope: link

In this file, replace the following pieces of information as instructed:

  1. If you replace the VMXNET3 NIC with another one, your NIC may use a different naming convention. If it does, replace "ens160" in the file 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 addr list
  2. Next to "addresses", replace "x.x.x.x/32" with the Failover IP to which you have added the vMAC in the OVH US Manager plus the subnet you wish to use in CIDR notation.

  3. Next to "gateway4", replace the "y.y.y." with 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, you would use as your gateway.
  4. The DNS name server addresses listed are from OpenDNS. Feel free to use other name servers here, if you choose.
  5. In the "routes" section, the y's correspond with your gateway IP address. Fill in these octets accordingly.

Now apply the Netplan settings with the following command:

sudo netplan apply

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.

Thanks for all the help anyway!

  • 1
    You are a lifesaver, I've been banging my head against the wall for a while on this on. As soon as I tried this solution out, bingo. Thanks for sharing!!
    – Hoff
    Jan 3, 2019 at 9:15
  • @Hoff happy to see it helped :) I just notice that OVH remove the tutorial again, so at least this one is here :ú
    – DJ_Ironic
    Nov 23, 2019 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.