Using PFsense on my ESXi server

From EN Ikoula wiki
Revision as of 14:23, 11 October 2022 by Ccunha64415 (talk | contribs) (→‎=)
⧼vector-jumptonavigation⧽ ⧼vector-jumptosearch⧽

en:Using PFsense on my ESXi server fr:Utiliser PFsense sur mon serveur ESXi

INTRODUCTION

In this article we will explain how to set up a PfSense Virtual Machine on an ESXI hypervisor with a server rented from IKOULA with an additional IP.

This will allow you to have multiple virtual machines accessible from the internet using your PfSense firewall NAT rules.


Required :

- A server from the family AGILE

- An additional IP address, can be ordered at your Client Area

- ESXI 6.7 installed on your server

We will assume that ESXI is already installed on your server and functional.


Settings used to create this article:

- Agile S server, Intel® Xeon® E3 1220v5(4c/4t) processor, 8GB ram and 1TB HDD. With of course an additional ip.

- Operating system : ESXI 6.7

- Network Settings:

Main ip: 213.246.45.105/24

Additional ip: 213.246.45.104/24

Gateway ip: 213.246.45.1


Deploying the router vm under PfSense

Creating the virtual lan network

First, we will create our virtual switch by going to the "Networking" section and clicking on "Add a standard virtual switch":

Fichier:Pfs1.PNG

In the the next open window, we advise you to select the parameters as show in the picture:

Fichier:Pfs2.PNG

We've decided to name our Switch "LAN". Once the switch is created, we will assign a port group. We need to go to the "port groups" tab and click on Add a port group as shown here :

Fichier:Pfs3.PNG

Once you click on "add a port group", this window will appear: Fichier:Pfs4.PNG


So we named our port group "LAN-Ports-Group" and selected our LAN vswitch.

Creating the PfSense VM in on our ESXI

We create the virtual machine, with this parameters:

On créé la machine virtuelle, voici les paramètres que l’on a choisi :


Fichier:Pfs5.PNG

Here are the characteristics we have chosen for our PfSense :

Fichier:Pfs6.PNG

At this level, we need to add a network card, which will be used to connect our virtual machines through our virtual LAN. To do this we must click on add a network adapter:

Fichier:Pfs7.PNG

When adding this network adapter, please make sure to assign it the LAN network:

Fichier:Pfs8.PNG

Finally, you will have to select the ISO image of PfSense in the virtual drive. You can then start the installation of PfSense. By default the keyboard is qwerty but you can change this by clicking on the flag as explained here :


Fichier:Pfs9.PNG

installation est paramétrage pfSense

Ensuite pour l’installation choisissiez les options par défaut, Pour le formatage, nous avons choisi cela :

Fichier:Pfs10.PNG

Une fois que vous aurez terminé l’installation de PfSense et que vous aurez redémarré votre vm, vous aurez accès à l’interface de Votre PfSense qui devrait se présenter comme ceci :

Fichier:Pfs11.PNG

Dans la capture suivante, vous pouvez remarquer que nous avons ceci :

-La patte wan -> Em0 -> 213.246.45.104(qui est l’ip supplémentaire). Dans votre cas, il faudra donc bien attribuer l’ip supplémentaire à l’interface Wan en utilisant l’option 2.

-La patte LAN quant à elle correspond à l’interface Em1 que nous avions ajoutée lors de la création de la VM PfSense. Voici à ce que cela correspond au niveau de la vm sur ESXI :


Fichier:Pfs12.PNG

Configuration internet pour le LAN

Maintenant pour que les machines virtuelles puissent avoir accès à internet il va falloir lancer des commandes depuis le shell de votre PfSense.


Fichier:Pfs13.PNG

Pour accéder au shell, sélectionnez le en entrant l’option 8.

Une fois dans le shell, la première commande sera de supprimer la route existante par defaut en saisissant ceci :

route del default


Fichier:Pfs14.PNG

Maintenant il faudra créer une route sur l’interface Wan ici em0, l’ip ici correspond à la passerelle de notre ESXI et qui est la même que celle de l’ip supplémentaire (propre au réseau IKOULA) à savoir 213.246.45.1 :


route add 213.246.45.1 /32 -link -iface em0


Pour finir on devra créer la route par défaut pour pfSense via cette commande :


route add default 213.246.45.1


Une fois cela fait, toutes vos VM reliée au réseau LAN auront accès à internet.

Cependant, celles-ci ne seront pas accessibles depuis l'extérieur depuis des connexions RDP ou SSH par exemple.

Pour que vos VM soient accessibles , il faudra créer des règles de pare-feu au niveau de votre PfSense.

Nous verrons cela dans un autre article.