How can I point DHCP clients to other gateway

Hi all,
I decided to add another router/fw to my network. It shares the same LAN/GREEN segment but has other WAN/RED interface.
How can I tell my ipFire DHCP clients to use other LAN/GREEN based IP as default gateway?

No one? Just a little advice :slight_smile:
Could be an DHCP option will work? Which one?

I don’t see a way with the WUI but I suppose you could hand edit /var/ipfire/dhcp/dhcpd.conf. Of course, your changes would probably get overwritten if/when you do any updates with the WUI Network->DHCP Server page. Not making any recommendation here – just a thought. Warning: I am far far from an expert

That’s what I’m thinking about …

1 Like

Hi,

wouldn’t be using that routers’ DHCP server the most straight-forward approach?

Thanks, and best regards,
Peter MĂźller

2 Likes

DHCP server config is complicated & has a lot of “rows” I do not want to rewrite it.

The gateway/router entry is fixed in the IPFire cgi code as the IPFire IP address for the specific network zone (Green or Blue).

This cannot be changed in the WUI.

As already indicated by @cbrown, if you hand edit the dhcpd.conf file it will be overwritten by any Core Update or if you press Save, create a new Fixed Lease or select Edit for anything on the dhcp WUI page.

Also if you make this change then all your clients will need to be forced to renew their leases, otherwise they will stay on the old information until at least half their existing lease time has expired. The simplest way to do that is to usually reboot the clients.

1 Like

Dear Paul,
in my scenario this is valid.

// accessing to IPfire using ssh protocol [port 222 or 22 and ip of your IPFire]
$ ssh -l root -p 222 ‘ip_ipfire’
// editing the DHCP server configuration. Nano must be installed or use any other text editor
$ nano /var/ipfire/dhcp/dhcpd.conf
// change to the ip of your real gateway
option routers x.x.x.x
// restart DHCP server
/etc/init.d/dhcp restart

But remember to perform these instructions each time DHCP GUI is used.

Ciao
Paolo

Can I use “option routers” option in the " Additional DHCP options" WUI section?
It seems to be what I was looking …

Dear Paul.
please try your suggestion and let know us.
What I wrote it is what I found on my notes, but the IPFire was in older version than now it is.
Ciao
Paolo

Hi @paku

Looking at the man page for dhcpd and its options it might be possible but the option is not called option routers. That does not exist as an option for the Additional DHCP options.

However there is router-solicitation-address and reading the man page this looks like it might do what you are looking for.

So the option name would be router-solicitation-request and the option value would be the IP Address of your other gateway router. You should also check the GREEN checkbox if you only want it to apply to your Green network.

I am not 100% sure that the above will do what you are looking for but it is the closest I could find.

You will still need to force all your clients to renew their lease from IPFire otherwise they will stay with the old settings till at least 50% of the existing lease time has expired.

1 Like

It seems we are closer.
Will test “router-solicitation-address” once I have operational possibility.
Thank you guys!

I have done some more reading on line and routers would also normally be an option but in IPFIre, as it is defined in the cgi script it is not made available in the Additional DHCP options list. Therefore router-solicitation-address and routers are not exactly the same thing.

The difference seems to be that in dhcpd generally you can specify multiple routers on the option routers line and the IP addresses are provided in order of preference. In IPFire there is only one router specified for each of the Green and Blue subnets.
The router-solicitation-address line seems to be where the dhcpcd server tells the client that this is the IP Address to use for the gateway.

Good luck.
Let us know how it goes when you are able to try it out.

this is highly recommended:
https://community.ipfire.org/t/add-possibility-to-edit-router-gateway-directly-in-the-web-page-cgi-bin-dhcp-cgi/8559