Installing pfsense on OVH ESXi Hyper-V
If you need to install pfsense on OVH ESXi Hyper-V, you may be having some difficulty. Have you ever wanted to create a pfSense VM on your OVH host but had troubles getting the internet connection fixed? OVH uses failover IP’s that have to be manually activated in order for a successful internet connection to be established. The easiest way to do this is through the pfSense shell and the pfSense plugin named Shellcmd. Installing pfsense on OVH ESXi Hyper-V can be difficult but after this guide has been followed and executed, you will have your pfSense static routes for an OVH install created!
The Steps:
- Firstly go into your OVH manager and create a new virtual MAC address for the failover IP that you would like to use. If you are using a hypervisor you will need to assign the VM to have this virtual mac that you have just created.
- After this save your newly created your VM. We will need to create a second network switch to the hyper visor. For Hyper-V go into the virtual switch manager and add a secondary switch.
- Install pfSense (FreeBSD 64bits), and add the two NIC’s. Preferably NIC 1 to be the WAN switch and the second NIC to be the LAN switch.
- Verify that you have correctly set the MAC address to the WAN adapter, (and not the lan adapter).
- Assign both of the NIC’s in pfSense. Wan “should” be em0 and LAN should be em1. (This however may be different for you, example: nm0, nm1, however the 0 should be WAN and the LAN should be 1).
- Once pfSense has booted, Login to the webui and assign the WAN IP. (For my install I was having troubles doing this through the wizard so I just set them manually after exiting the wizard).
- In your KVM/Console, select option 8) Shell and execute the following commands.
-
route add -net x.x.x.254/32 -iface em0
(x.x.x is the IP address of your main server)
-
route add default x.x.x.254
(x.x.x is the IP address of your main server)
- Ping the Google DNS (8.8.8.8)
ping 8.8.8.8
-
- Now in another VM, add the LAN switch to that VM and go to your pfSense webadmin UI and we now have to change the outbound NAT.
- Default Login for pfsense is admin:pfsense
- Default webui is http://192.168.1.1Leave everything unchanged other than the Source Address: 192.168.1.0 and add the description. (Note: If you dont want to use the 192.168.1.x and setup 10.0.1.x at setup you can set this to 10.0.1.0)
- In Services > DHCP Server we now need to set the Gateway to 192.168.1.1. (or if you set your pfsense to 10.0.1.1, we need to set it to that)
- By executing these commands we now *should* have a link on our VM’s that are using the pfSense. Only problem here is as soon as the VM reboots, our route add commands “dissapear” (clear themselves). We need to do some further setting up to get them to sticky.
Making the rules permanent
In the pfSense package manager, we need to add the package “Shellcmd” which executes commands given to it at startup. This will make sure that our “route add” commands are added at boot so the VM’s always have an internet connection.
- System > Packages – ShellCMD
- Install
- Services > ShellCMD
- Add the command that you created above and copy and paste them into the text box.
- Reboot.
After a reboot you should be good to go, if not. Verify the “route add” commands that you typed into the ShellCMD are exact same as you executed at first install (above).
Its also a good idea to install the package “Open-VM-Tools” if you are running this on a VMware based box.
As always, if you run into troubles, leave a comment and I’ll be glad to help out.
Be sure to check out my previous article
Thank you dear for this wonderful explanation
There is a question I just want to ask you
After your permission of course
When you create a virtual switch to the external network
Do you select this option?
hyper-v allow management operating system to share this network
or not
Up to you, if you want the host on it’s own separate network you should check it, otherwise the host should share the internal switch going through the pfsense.