How to configure DHCP on router to manually define the routing table distributed to users?

Posted on

Problem :

I have a router in my home, to which there are several devices connected to it (over Wi-Fi and Ethernet) and get the network information through DHCP. I want to configure the protocol, so I can provide an entry in the routing table distributed to every connected device. I look for a general way, because I understand every router is different, but also my model is CBN CH6643E from Vodafone/ONO (Spain).

My question is: how do I do that? are these household routers intended/allowed to do this?. Note that I don’t pretend to manually edit the routing table of the devices but alter the table they receive in their DHCP configuration.

Also: I have a Linux distribution and soon I will have a microcomputer (raspberry-like) capable of running Linux too, in case there’s a solution that requires it.

EDIT: The most viable solution is to use a DHCP server in a computer, that will be in the middle of the router and connected devices. How would that affect the defaut gateways of the connected devices and the default gateway of the DHCP server? The entry that I want to add to the devices’ routing tables is a new default gateway that will redirect their packages to my router, as it’s not possible to do that directly in the router.

Someting like this:

to the internet <====|router|====|DHCP server|====devices

Solution :

This can be done if your router supports configuring DHCP option 121 – The Classless Static Route Option.

Judging by the user guide, your router does not support this, so you’re probably looking at getting an enterprise-level router, or flashing your current router with custom firmware that supports setting this DHCP option (such as DD-WRT).

Alternatively, you could look into installing a DHCP server on your Linux distribution and setting it up to distribute this option to clients along with their IP configuration. Remember to disable the DHCP server on the router so that only the DHCP server running on the Linux distribution will receive/reply to DHCP requests. Assign the machine a static IP configuration (IP address, subnet mask, and default gateway), and make sure the chosen IP address is outside of the DHCP scope and you should be good to go.

Leave a Reply

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