How to advertise different gateway ip via DHCP in OpenWRT?

How to advertise a different router/gateway ip via DHCP in OpenWRT?

In general, you need to configure the DHCP option with code 3 (router). (A list of all options can be found in http://www.networksorcery.com/enp/protocol/bootp/options.htm )

For example, to advise the gateway IP 192.168.1.2, you will send this option:

"3,192.168.1.2"

Now, for OpenWRT, you have 2 methods to configure it:

  1. In command line

    uci add_list dhcp.lan.dhcp_option=”3,192.168.1.2″
    uci commit dhcp

  2. In Web LuCI

In “network” -> “Interfaces” -> “LAN”, add this to the “DHCP-Options” field in the “DHCP Server” section:

3,192.168.1.2

The click “Save & Apply”.

Answered by Eric Z Ma.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

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