As you know, in Pfsense, clients are assigned an IP to each of them when they connect to the firewall network. This client can be a laptop or a web server or database server or others. Some clients, such as web servers, because are constantly connected to the Internet or internal network, so it is better to assign a static IP to them.
Before learning how to do this, to see which clients are connected to the pfsense network and what is the IP assigned to them by DHCP Server, you should do the following:
Pfsense Top Menu > Status > DHCP Leases
As you can see in the above image, the “Lease Type” column has two active and static values. For clients that we have considered static IP, the static value is entered, and for clients that DHCP Server randomly assigns IP, the active value is entered. The following image shows you this description in more detail:
Our goal in this article is to teach you how to assign static IP to the client, to do this we must first determine the static IP range otherwise, the DHCP server of the pfsense firewall will not allow static IP allocation. You can see the error you will receive in the image below:
Well now let’s go to the static IP range settings; Go to the following path:
Top Menu: Services > DHCP Server >> LAN (Tab)
At the end of the General Options section, specify an IP range so that part of that range is free so that pfsense can use the unused range to allocate static IPs.
For example, in my scenario, I wanted to assign static IP to 4 of my clients, so I considered 192.168.1.101 to 192.168.1.105 for this purpose and introduced the rest to the firewall as free suffering. You can increase or decrease your range as you wish. See the image below:
Now “Save” Our setting at bottom of the page. and Return to the DHCP lease section. (Top Menu > Status > DHCP Leases)
As it is clear in my scenario, which you can see in the picture, in my DHCP Lease section, in the Lease Type column, two values of active and static are registered for my client’s IPs. What do these two values mean?
If a static value is entered in front of the IP client, it means that the client (which can be a laptop or a web server) is assigned a static IP.
And if you see the phrase active, it means that from the pool of DHCP server IPs, which we have defined in the upper part, it has been assigned to this client.
So what is the difference between the two? When a DHCP server assigns IP from the pool to the client, it is possible (which often happens) that if this client disconnects from the firewall and reconnects, another new IP will be assigned to it. However, if we assign a static IP to it, it will always be connected to the same IP with the firewall.