I assume you have installed ESXI on a dedicated server hosted by OVH.
Now, in order to install your VM and have it routed to/from internet, you need few things:
- Create a failover IP from your OVH manager
What is a failover IP you may ask.
Well I'm guessing it's an IP that is meant to be plumbed at will on a host. It is different from a so called static IP which is the IP delivered at installation of a real machine so that you can access it from internet.
Very much like in a HA (High Availability) environment, you plumb the interface with virtual IPs which you can unplumb later and move to a failover node of your cluster to accomplish high availability of the services bound to this IP. Maybe that's why they call it failover IP...
Note that you would not accomplish the same flexibility with a dns record because the dns replication could take ages.
So, anyway, you must create a failover IP in the manager (you may need to buy a new IP) and attach it to your ESXI server.
- Create a virtual MAC address for your VM
Then, you need to create a virtual MAC also in the manager, this will inform the routers at OVH that this VM is known and thus can be routed.
When you create this MAC don't forget to specify the VMWare type.
I wont cover how to download an ISO image from ubuntu and have it accessible on the ESXI host but you have 2 ways of doing so:
- Upload it throught the VMWare vSphere Client to a folder on the ESXI server
- Ssh to the ESXI server and from there download the ISO with a curl or wget command
Actually the 2nd method is much much faster.
Setting up the VM
Now create a new VM as you like. Some people prefer the "custom" configuration, however that's not mandatory.
After your VM is created, you need to edit its configuration in order to apply 2 changes:
- Select the
Network adapterhardware and set a manual MAC address with the virtual MAC given to you by OVH in your manager
- In the
CD/DVD drivehardware, select "Datastore ISO file" and browse your storage to point it to the ubuntu image you downloaded. Also don't forget to select 'Connected at startup'
When these two settings are correctly set you may start the VM.
Do proceed to the installation by providing the information asked by the installer process.
When the installer prompts you for the network settings, choose manual settings and do this:
- provide the failover IP address as IP address of the server
- provide 255.255.255.255 as netmask unless you bought an IP range from OVH which can also be done. However, the 255.255.255.255 netmask makes sense if you just bought One failover IP address from OVH. Because you cannot expect to be able to reach any other node in the class as part of your LAN.
- provide no gateway address (remove everything). If the installer groans about it, then feed him the same failover IP address (as if you were your own gateway)
- provide the dns server(s) provided by OVH
If all went okay you should be able to login to the console.
Now, the problem should be that you have no networking access :)
You can easily verify it by pinging a well known host on the internet, which should reply either "unknown host" or "network is unreachable". What a warm welcome...
Now if you look at the installed routing table, their should be no route at all.
orion@vm:~$ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface
This is normal ;)
In order to be able to access to/from internet we need to set the routes. On ubuntu this can be done in /etc/network/interfaces
Edit the file so that the eth0 definition part looks like:
iface eth0 inet static address failover-IP netmask 255.255.255.255 network failover-IP broadcast failover-IP post-up route add gateway-IP dev eth0 post-up route add default gw gateway-IP dns-nameservers 188.8.131.52 184.108.40.206
There are other settings which I did not copy in the above example, like the dns-search settings part and the local interface (lo) settings but this extract is all you need to get going.
Notice in the extract that you have to replace these:
failover-IP: with your own failover IP for this vm
gateway-IP: with your own gateway IP for this vm
!! It is very important that you get rid of any 'gateway failover-IP' line in the eth0 section for it will make the interface setup fail because it does not have the routes setup as it is a post-up task. !!
failover-IP, we talked about it, you should know which one to use.
Here is how you find it:
- take the ESXI static IP address
- replace its last Octet sequence with 254
- my ESXI static IP is 220.127.116.11
- I replace 78 with 254 => my gateway IP is 18.104.22.168
Now you have everything you need to have the vm networking properly setup.
You may reboot the vm or issue the following command:
$ sudo restart network-interface INTERFACE=eth0
And if you used the correct IPs and made no typo you should see the routing table like this:
orion@vm:~$ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 XX.XXX.XXX.254 0.0.0.0 UG 0 0 0 eth0 XX.XXX.XXX.254 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
Hope this helped.