On a quest to pfSense under OVH

Well, many a few times I happened to set up a pfSense instance. It’s just that, when these have to be set-up under OVH, whether at their public Cloud in Horizon, or using a Proxmox/ESXi hypervisor, things tend to be tricky for routing them into the Internet. This is how it happened today, and how it ended up getting the SOLVED tag.

The thing is, OVH has a pretty particular setup for their ‘additional’ IP addresses, that include setting up the box with a particular route and default gateway set-up for it to route its NAT’ed clients, even connecting and making them available on the internet, so after a few bing’ing/googl’ing and chatgpt’ing this was the end-all be-all:

Place a script file in /usr/local/etc/rc.d/ and name it whatever you want. I went for initio.sh:

# vi /usr/local/etc/rc.d/initio.sh

#!/bin/sh
# # initio.sh: Set the defaults my instance needs to connect # #
/usr/sbin/kbdcontrol -l /usr/share/syscons/keymaps/latinamerican.iso.acc.kbd
/sbin/route add -net xxx.xxx.xxx.xxx/32 -iface vtnetX
/sbin/route add default xxx.xxx.xxx.xxx

Fill the contents with the above, keeping a few things in mind:

  • Commands are given the full path since this is run from start, and the system doesn’t have a %PATH% environment set.
  • kbdcontrol is an aid for my particular keyboard layout. Choose your preferred one or remove the line entirely if you use a US-standard layout.
  • iface vtnetX can be emX, ethX, dcX, etc. Quickly find what your adapter’s name is with ifconfig.
  • the IP address xxx.xxx.xxx.xxx is the default gateway from your network. On baremetal hypervisors it’s usually the server’s IP address with the last octet changed to 254, but in the OVH cloud this will depend on the network, so you have to find out via Project -> Network --> Networks in your Horizon control panel.

Last, but not least, remember to chmod a+x your script, so it gets executed the next start cycle. You can also run it right away by typing sh /usr/local/etc/rc.d/initio.sh

Profit!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.