<div dir="ltr">Hello Magnus Kroken and Adrianschmutzler,<div><br></div><div>Thank you! I made it work!</div><div><br></div><div>Magnus Kroken's second method works!</div><div><br></div><div>Thank you!</div><div><br></div><div>But I have another question :</div><div><br></div><div>  config zone<br>          option name       wan<br>          list   network          'wan'<br>          list   network          'wan6'<br>+        list   network          'wwan'<br>          option input            REJECT<br>          option output           ACCEPT<br>          option forward          REJECT<br></div><div><br></div><div>Above is part of /etc/config/firewall.</div><div>And as you see, I'd like to add new interface wwan into zone wan.</div><div>How can I write uci command script for this?</div><div><br></div><div>Thank you very much!</div><div>Jeonghum </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2020년 5월 19일 (화) 오후 6:38, Magnus Kroken <<a href="mailto:mkroken@gmail.com">mkroken@gmail.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi<br>
<br>
On 19.05.2020 08:30, Jeonghum Joh wrote:<br>
 > config interface 'wwan'<br>
>          option ifname 'usb0'<br>
>          option proto 'dhcp'<br>
> <br>
> So I added something like below to <br>
> package/base-files/files/etc/board.d/99-default_network :<br>
> <br>
>    ucidef_set_interface_lan 'eth0'<br>
>    [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'<br>
> +[ -d /sys/class/net/usb0 ] && ucidef_set_interface_wan 'usb0'<br>
> <br>
> But this didn't resolve my problem.<br>
> <br>
> I think I can just make some commands into startup script.<br>
> Isn't there more grace approach for me to automatically add usb0 <br>
> interface into /etc/config/network?<br>
<br>
As already suggested, use the files/ directory to include files.<br>
<br>
$ cd openwrt # change to the root of your OpenWrt build environment<br>
$ mkdir -p files/etc/uci-defaults<br>
$ mkdir -p files/etc/config<br>
<br>
Now you have two options.<br>
<br>
1. Put your complete working /etc/config/network file in the files/ <br>
tree, so it resides at files/etc/config/network.<br>
<br>
2. Write a script with the UCI commands needed to change your config, <br>
and put it in files/etc/uci-defaults. I name mine e.g. <br>
zzz_33_device_config, so that they are executed as late as possible.<br>
<br>
The commands you would need for option 2 is probably:<br>
<br>
uci -q set network.wwan=interface<br>
uci -q set network.wwan.proto='dhcp'<br>
uci -q set network.wwan.ifname='usb0'<br>
exit 0<br>
<br>
This is very simple, you may want to script checks to ensure the script <br>
is running on correct device (e.g. by checking for a MAC address), and <br>
if the usb0 device exists.<br>
<br>
Regards<br>
Magnus Kroken<br>
<br>
> Thank you in advance.<br>
> Jeonghum<br>
<br>
</blockquote></div>