Re: [OpenWrt-Devel] How to pre-define the LAN IP

2018-02-28 Thread Bill Yuan
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  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


[OpenWrt-Devel] How to pre-define the LAN IP

2018-02-28 Thread Bill Yuan
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?

Thanks in advance.

Regards,
bycn82
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] redirect in uhttp

2013-09-09 Thread Bill Yuan
hi
I am using uhttpd, and I want to configure a page to handle all the
request. so it requires a redirection in for all the traffic. and I am
looking for the answer about how to achieve this .

in apache ,there is an rewrite module, and once config like below

RewriteEngine onRewriteRule   ^/(.+)  /index.php?url=$1  [R,L]

all the request to this server. e.g. to /abc.php will be redirect to
/index.php?url=abc.php
in this case, we can hand the index.php to handle all the request no matter
what URI you want.

Can we achieve this in uhttpd?

Best Regards,
Bill Yuan
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel