surely I prefer the option 1, I thought the wiki is out date already, because I found the etc/config/network in packages/base-files thanks I am trying it
On 28 February 2018 at 23:47, Magnus Kroken <mkro...@gmail.com> wrote: > Hi Bill > > On 28.02.2018 15:18, Bill Yuan wrote: > >> Hi, >> >> I noticed the default LAN IP is still 192.168.1.1 even after I configured >> the "preinit network interface" in "preinit configuration options". Can >> someone please share with me where is the proper way to pre-define the LAN >> IP? >> > > The build system does not include a way to do this. You can do this by > including additional files in your image. To do this, create a directory > "files" in the root of the build directory (same directory you run make > menuconfig from). > > You can either include a full network configuration file in the image, or > you can include a script that will execute after the device has booted, > which configures the IP address. > > For a full configuration, configure the network as you want it to be, then > copy /etc/config/network from your OpenWrt device to your files/ folder, so > it ends up as: files/etc/config/network. > > For a script, here is a snippet of how I do this on my devices. You can > omit the if check, I do this so I can use the same script on several > devices. > > --8<-- > #!/bin/sh > > if [ "$(ip link show eth0 | awk '/ether/ {print $2}')" == > "11:22:33:44:55:66" -a "$(uci -q get network.lan.ipaddr)" == "192.168.1.1" ] > then > uci -q set network.lan.ipaddr='10.123.234.1' > fi > > /etc/init.d/network restart > -->8-- > > Put this in files/etc/uci-defaults/zz_changeip4.sh. The zz prefix ensures > the file is executed last in the uci-defaults folder, if it executes too > early the base network config may not be in place yet. > > Regards, >> bycn82 >> > > Regards > /Magnus >
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel