<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">surely I prefer the option 1,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">I thought the wiki is out date already, because I found the etc/config/network in packages/base-files</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">thanks</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:#000000">I am trying it</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 28 February 2018 at 23:47, Magnus Kroken <span dir="ltr"><<a href="mailto:mkroken@gmail.com" target="_blank">mkroken@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Bill<span class=""><br>
<br>
On 28.02.2018 15:18, Bill Yuan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
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?<br>
</blockquote>
<br></span>
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).<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
--8<--<br>
#!/bin/sh<br>
<br>
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" ]<br>
then<br>
uci -q set network.lan.ipaddr='10.123.234<wbr>.1'<br>
fi<br>
<br>
/etc/init.d/network restart<br>
-->8--<br>
<br>
Put this in files/etc/uci-defaults/zz_chan<wbr>geip4.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.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Regards,<br>
bycn82<br>
</blockquote>
<br>
Regards<span class="HOEnZb"><font color="#888888"><br>
/Magnus<br>
</font></span></blockquote></div><br></div>