Live Chat Software by Kayako
Knowledgebase: Network Configuration
Configuring Networking for a VM Running Ubuntu 18.04
Posted by Thang Le Toan on 05 August 2018 08:29 AM

With OVH US Failover IPs, connecting your virtual machines to the Internet can be a breeze. Follow this tutorial to configure networking on your Ubuntu 18.04 VM.

Topics

  • Configuring Network Settings in an Ubuntu 18.04 VM

Prerequisites

­­­­­­­­­­­­

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).
network: version: 2   renderer: networkd   ethernets:           ens160:                   dhcp4: no                   dhcp6: no                   addresses: [x.x.x.x/32]                   gateway4: y.y.y.254                   nameservers:                           addresses: [208.67.222.222,208.67.220.220]                   routes:                   - to: y.y.y.254/32                     via: 0.0.0.0                     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 1.2.3.4, you would use 1.2.3.254 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.

Conclusion

Having read this article, you should be familiar with the steps that are required to configure the network settings on an Ubuntu 18.04 VM.

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Kayako