Ipfire green dhcp add static ip

Hi, how to put a static IP on a green dhcp network. I have a server that has the address 192.168.0.222

Follow this section of the wiki for how to setup fixed IP addresses via the dhcp wui page

https://wiki.ipfire.org/configuration/network/dhcp#current-fixed-leases

1 Like

@tgriksas Fixed lease link above will work, but it’s not really the right thing to do in you are using a truly static IP.
Fixed lease means that every time the client (your server in this case) requests an IP address using DHCP, you are going to assign it the same address each time, rather than any available address from the pool.
If the client is not using DHCP to request an IP address ie it is configured with a static IP address, then the correct way would be to reserve that address from the DCHP pool and use the hosts file in IPFire.
The way to do this is with 2 steps.

  1. Make sure the IP address (192.168.0.222) is not within the Start and End address in the DHCP pool. This is done in the Network->DHCP Server config page of IPFire.
  2. Edit the hosts file and name your server and it’s address. This is done in the Network->Edit Hosts config page.

Both methods will work, but in the first method you are assigning a fixed lease IP to a server that never actually requests an IP, and this becomes confusing down the road if you ever want to change that IP.

2 Likes

You are right.
But defining the fixed lease ( with an IP outside the dynamic pool ), documents this fixed setting.
It isn’t necessary that the client requests an IP, if no defined IP ( element of dynamic pool or fixed lease for another MAC ) is used the communication should be possible without problems.
Defining the static IP in the hosts file only requires two lookups for free IPs ( fixed leases and hosts file ) in case of a further client definition.

1 Like

That’s a good way to think / document it.
The main problem is coming back in a few years time and you want to change the “fixed/static” IP to something else. You need some way to know, is it just an ipfire/dhcp lease change setting, or do I need to log into the server and physically modify the static IP. If you mix fixed and static by assigning them all in the same way you have no was to tell without logging into the machine. (Or sifting through
the DHCPD logs)

Without a minimal level of discipline you ever have problems after a few years. :wink:
You should know which device use a static IP. You must change their configuration if necessary.
On the other side you must know your static IPs, if you use fixed leases also. So the setting in the DHCP WebGUI is an useful documentation. Further the script also updates the hosts file, if you observe the hint in the wiki.

It’s worth noting that, though it theoretically shouldn’t be an issue, it is important to always ensure that your static reservations are outside the DHCP dynamic scope. This is because, if the machine with the reservation is unreachable for some reason, the server can issue the reserved address.

1 Like