[OVH] Network configuration for VMs
Bài đăng này đã không được cập nhật trong 3 năm
Recently, I supported a friend to setup network for his VMs based on a dedicated server which was bought from OVH. At first, I never thought that I had to spent more than 3 days to complete it because I'm not a nerd guy in computer network and system. Howevers, I was struggled with virtual machines and its network in several weeks due to poor documentation and terrible supporting from OVH. So, I decide to write this post to share my own experiences for everyone who're going to use cloud services of OVH.
1. Scenario
Firstly, let check the ingredients that OVH gave me after shopping:
- A dedicated server with associated IP address:
12.34.56.78
- List of public IP addresses(Failover IPs) for VMs:
123.45.67.64/27
. It means that we have 30 available IP address start from123.45.67.65
to123.45.67.94
Different to VPS, dedicated servers can provide more powers and resources, from CPU, memory to networks. However, they also accompany with complicated configuration and management. Bascially, normal Oparating System such as Window server and Linux couldn't maximize their performnace and we don't have any better choices outside Hypervisor tools (Xen, VMWare Esxi...) In this article, I mentioned only about VMWare Esxi and I hope that I can update for all other tools.
Now, in brief, we wanna to provide full connection for all VMs running over VMWare Esxi. For more detail, I will show it in next part
2. Configuration
In this part, I'll show the steps to config network for VMs hosts. Should be noticed that you need to follow step by step if you're not have much experiences with network and system. If your VMs still haven't connection, let take a look on troubleshooting in the end.
2.1 The base
VMWare Esxi To install VMWare Esxi on dedicated server, just login to control pane provided by OVH through this link and just in few clicks, VMWare Esxi will be ready.
After that, let open your browser then go to your dedicated server IP address to download vSphere Client and from now, we will interact with server throught it. Notice that, vSphere now works only with Windows system so if you are using Linux or OSX, let turn to Window by virutal machine. When accessing your server on vSphere, it'll show like this
You can easily see that IP address(12.34.56.78
) given by OVH representing for Management network and we won't tough on it. Our scope is just aroung Failover IP list (123.45.67.64/27
) with each one of them is public IP address for Virutal Machine
Determine Default Gateway
All of geek guys known that we need four parts to complete network configuration on host: (i)Network address, (ii) Subnet mask, (iii) Default gateway, (iv) Domain Name server (DNS). And default gateway address must be in same network with host address and subnet mask have to show suitable wildcard. However, OVH has broken it
- Name servers: required
213.186.33.99
- Network address: the Failover IP addr (e.g:
123.45.67.65
) - Subnet mask:
255.255.255.255
- Default gateway: GW of deficated server You can get it when SSH to dedicated server with simple Esxi shell command
$ esxcfg-route -l
VMkernel Routes:
Network Netmask Gateway Interface
12.34.56.0 255.255.255.0 Local Subnet vmk0
default 0.0.0.0 12.34.56.254 vmk0
The default gateway is composed of the main IP of dedicated server ending in .254
2.2 Register MAC
After locating Failover IP and its default GW, we need to register it on control panel OVH to receive virutal MAC address.
- Go to IP section on https://ca.ovh.com/
- Choose available Failover IP on list (with FO mark)
- Click on setting icon of the right side
- Choose Add a virtual MAC
- Waiting for receiving MAC addreess
- Assign to NIC card of Virtual machine
There are two options to set a MAC address for virtual machine:
- Assign for virtual machine setting on vSphere: Edit virtual machine settings > Network Adapter > MAC Address
- Assing on Operating System: let go through this article http://www.howtogeek.com/192173/how-and-why-to-change-your-mac-address-on-windows-linux-and-mac/
I strongly recommend to set MAC address on virtual machine settings because the gap between OS can create more difficulties for you. If your virutal MAC dosen't match, its connection will be refused.
2.3 Virtual machines
2.3.1 Linux VMs (Ubuntu)
For Ubuntu servers, all network configuration stays in file /etc/network/interfaces
. In this case, I choose Failover IP is 123.45.67.65
and the default GW that we got from above part. So the configuration for Ubuntu server
auto eth0
iface eth0 inet static
address 123.45.67.65
netmask 255.255.255.255
broadcast 123.45.67.65
post-up route add 12.34.56.254 dev eth0
post-up route add default gw 12.34.56.254
post-down route del default gw 12.34.56.254
post-down route del 12.34.56.254 dev eth0
For DNS, let add address to /etc/resolv.conf
213.186.33.99
8.8.8.8
2.3.2 Window Server 2012
For window server, it's much more simple with visualization GUI. For someone who never use window before (I think no one ), let follow this https://onetechday.wordpress.com/2012/09/08/windows-server-2012-changing-network-settings/. When changing setting of network with IP address, subnet mask and default gateway, just ignore any warnings.
2.4 Troubleshooting
If you strictly did the configuration from above steps, I thinks it will be no problems. Howevers, Murphy said "Anything that can possibly go wrong, does" so, it's better if you know how to overcome problems when pinging unsuccessfully.
- First, reboot the VM to ensure that all of the networking changes you made are fully applied.
- Trouble shooting on Linux machine because linux command can provide many useful information
- Check MAC address with virtual MAC address on OVH use
ifconfig eth0
- Check link layer by
ethtool
command, if link is down. Let check your NIC card and change to supported type - Fail to ping default GW: check all network configuration by
route -n
and double check configuration network - Can not ping to VM from remote: check open port/Firewall on VMs
3. Bottom line
Sometimes, get a break from programming with Infra excercise make me fell like climbing over an mountain. I hope that my post will be helpful for someone start to use service of OVH. Please contact me if something going wrong
All rights reserved