Thank you Imre for bringing this up again. I have also notified the author of 
that RFC (Peter Sherman, @psherman on the forums) that this discussion is going 
on so he can offer opinions. You can read the RFC at: 
https://forum.openwrt.org/t/rfc-automatic-lan-subnet-reassignment-upon-conflict-with-wan/120938

I strongly support this automatic LAN subnet assignment, primarily as an aid 
for newcomers. I wrote an early version of "Getting started with OpenWrt", and 
a horrendous amount of text goes toward setting up the proper LAN subnet. 

With these TWO changes - Automatic LAN assignment PLUS mDNS name - the 
instructions become:

1. Install OpenWrt on the router using the manufacturers instructions, and the 
image you retrieve from the Firmware Selector
2. Connect the WAN port to your ISP's gear
3. Connect your laptop to one of the LAN ports with Ethernet
4. Point your browser to "openwrt.lan"

The advantages (for newcomers, and for documentation writers) seem clear to me. 
I ask the collective wisdom of this group: what are the disadvantages? Many 
thanks.

Rich

> On Feb 27, 2023, at 8:08 AM, Imre Kaloz <[email protected]> wrote:
> 
> Hi Rich,
> 
> Basic (v4 only) version of these (as well automatic wan proto detection) was 
> implemented and rejected some years ago :)
> 
> Both are quite easy to do, that version used the following hotplug script:
> 
> ===
> #!/bin/sh
> 
> if [ "$INTERFACE" = "wan" ] && [ "$ACTION" = "ifup" ]
> then
>        # Get subnets for lan and wan
>        lan_subnet=$(uci get network.lan.ipaddr | cut -d '.' -f3)
>        wan_subnet=$(ifconfig wan | grep -w "inet" | awk '{print $2}' | cut -d 
> ':' -f2 | cut -d '.' -f3)
> 
>        # If subnet is the same, randomize lan IP
>        if [[ $lan_subnet == $wan_subnet ]]; then
>                rn=$(awk 'function rn(n) { return int(rand()*n); } BEGIN {{ 
> srand(); }{ printf("%d.%d", rn(254), rn    (254    ))}}')
>                uci set network.lan.ipaddr=10.$rn.1
>                uci commit network
> 
>                # Restart network to refresh changes
>                /etc/init.d/network restart
>        fi
> fi
> ===
> 
> Setup of redirection ran as an init script:
> 
> ===
> #!/bin/sh
> 
> START=55
> boot() {
> 
> lanip=$(uci get network.lan.ipaddr)
> 
> grep -q "myrouter.local/$lanip" /etc/config/dhcp
> if [ $? -eq 1 ] ; then
> # add a redirect myrouter.local to our IP
>        uci add_list dhcp.@dnsmasq[0].address="/myrouter.local/$lanip"
>        uci commit dhcp
> fi
> }
> ===
> 
> 
> Best,
> Imre
> 
> ________________________________________
> From: openwrt-adm <[email protected]> on behalf of Rich 
> Brown <[email protected]>
> Sent: Monday, February 21, 2022 22:38
> To: OpenWrt Project Administration; [email protected]
> Cc: Richard E. Brown
> Subject: Automatic LAN Subnet Reassignment
> 
> There is a new RFC on the OpenWrt forum proposing "Automatic LAN Subnet 
> Reassignment" 
> https://forum.openwrt.org/t/rfc-automatic-lan-subnet-reassignment-upon-conflict-with-wan/120938
>  The RFC responds to the advice given at last week's OpenWrt-Adm meeting 
> (https://etherpad.wikimedia.org/p/ZlZiTcud3wufcSX9-1jD)
> 
> The intent of the proposal is for the default configuration to assign a LAN 
> subnet that avoids a conflict with the WAN subnet, and provide a mDNS name 
> such at OpenWrt.lan for connections.
> 
> I have two requests:
> 
> 1) Please make comments on the technical merits of the proposal on the 
> OpenWrt forum at the link above.
> 
> 2) If the proposal seems to make sense, please consider the process by which 
> we would incorporate this into the main release (likely, not for 22.0x, but 
> perhaps the next release?)
> 
> Thank you.
> 
> Rich
> 
> 
> 
> _______________________________________________
> openwrt-adm mailing list
> [email protected]
> https://lists.openwrt.org/mailman/listinfo/openwrt-adm


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to