With OVHcloud Failover IPs, connecting your virtual machines to the Internet can be a breeze. Follow this tutorial to configure networking on your CentOS 7 VM.
- Dedicated Server running VMware ESXi 6.5
- How to Connect a VM to the Internet Using VMware ESXi 6.5
- Configuring Network Settings in a CentOS 7 VM
Configuring Network Settings in a CentOS 7 VM
In this step, we will be configuring our interface settings. To do this, first navigate to the
network-scripts directory using the following command:
$ cd /etc/sysconfig/network-scripts
ls command to view the content of the directory.
$ ls -al
Locate your interface file (e.g. ifcfg-ensXXX) and then open it using the following command:
Note: In our example the interface file is
$ sudo vi ifcfg-ens192
Edit the interfaces file to make it appear as follows:
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=dhcp 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=no IPADDR=x.x.x.x NETMASK=255.255.255.y GATEWAY=z.z.z.254 DNS1=126.96.36.199 DNS2=188.8.131.52
In this file, check/replace/add the following pieces of information as instructed:
- "BOOTPROTO" is set to "none"
- "ONBOOT" is set to "yes"
- "IPADDR", replace "x.x.x.x" with the Failover IP that you added a vMAC to in the OVHcloud Manager
- "NETMASK", replace the "y" in the final octet with the correct number depending on the size of the block of IPs you have purchased. For instance, if you are using a /28 block, put "240" in the last octet.
- "GATEWAY", replace the "z.z.z.254" with the first three octets of your Dedicated server's IP address with a final octet of "254". For instance, if your Dedicated server's IP was 184.108.40.206, you would use 220.127.116.11 as your gateway.
Note: The DNS nameservers listed are from OpenDNS. Feel free to use whichever name servers you prefer.
Next, enable the NIC by restarting the network service:
$ sudo systemctl restart network
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.
Having read this article, you should be familiar with the steps that are required to configure the network settings on a CentOS 7 VM.