[OpenWrt-Devel] How am I supposed to change settings in /etc/config/network of default root file system of OpenWRT?

Jeonghum Joh oosaprogrammer at gmail.com
Tue May 19 02:39:41 EDT 2020


Hello list,

Let me clarify my test environment:
Hostname LEDE
Model MediaTek MT7622 AC4300rfb1 board
Firmware Version LEDE Reboot 17.01-SNAPSHOT unknown / LuCI (svn-r75)
Kernel Version 4.4.124

Thank you
Jeonghum

2020년 5월 19일 (화) 오후 3:30, Jeonghum Joh <oosaprogrammer at gmail.com>님이 작성:

> Hello  Moritz Warning and people,
>
> I found a script which looks like something that generate
> /etc/config/network. It is "99-default_network"
> under package/base-files/files/etc/board.d.
>
> Let me post the content of it here :
>
> #!/bin/sh
>> #
>> # Copyright (C) 2013-2015 OpenWrt.org
>> #
>> . /lib/functions/uci-defaults.sh
>> board_config_update
>> json_is_a network object && exit 0
>> ucidef_set_interface_lan 'eth0'
>> [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
>> board_config_flush
>> exit 0
>
>
>
> The content of /etc/config/network is shown below :
>
> config interface 'lan'
>         option type 'bridge'
>         option ifname 'eth0'
>         option proto 'static'
>         option ipaddr '192.168.1.1'
>         option netmask '255.255.255.0'
>         option ip6assign '60'
>
> config interface 'wan'
>         option ifname 'eth1'
>         option proto 'dhcp'
>
> config interface 'wan6'
>         option ifname 'eth1'
>         option proto 'dhcpv6'
>
> So I guessed  above of 99-default_network generates above of
> /etc/config/network
>
> I need to add something like below to /etc/config/network :
>
> config interface 'wwan'
>         option ifname 'usb0'
>         option proto 'dhcp'
>
> So I added something like below to
> package/base-files/files/etc/board.d/99-default_network :
>
>   ucidef_set_interface_lan 'eth0'
>   [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
> +[ -d /sys/class/net/usb0 ] && ucidef_set_interface_wan 'usb0'
>
> But this didn't resolve my problem.
>
> I think I can just make some commands into startup script.
> Isn't there more grace approach for me to automatically add usb0 interface
> into /etc/config/network?
>
> Thank you in advance.
> Jeonghum
>
>
>
> 2020년 5월 19일 (화) 오후 12:57, Jeonghum Joh <oosaprogrammer at gmail.com>님이 작성:
>
>> Hello Moritz Warning
>>
>> Thank you very much!
>> I can continue investigating by your hints.
>>
>> Thank you.
>> Jeonghum
>>
>> 2020년 5월 19일 (화) 오전 11:37, Moritz Warning <moritzwarning at web.de>님이 작성:
>>
>>> On 5/19/20 3:49 AM, Jeonghum Joh wrote:
>>> > I know how to do this for /etc/config/firewall.
>>> > It is package/network/config/firewall/files/firewall.config
>>> >
>>> > But I cannot find /etc/config/network for default root file system.
>>> >
>>> > Where can I find it?
>>> > How am I supposed to change settings in /etc/config/network of default
>>> root
>>> > file system of OpenWRT?
>>> >
>>> > Thank you in advance!
>>> >
>>> > Jeonghum
>>> >
>>> >
>>> > _______________________________________________
>>> > openwrt-devel mailing list
>>> > openwrt-devel at lists.openwrt.org
>>> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>> >
>>>
>>> In your OpenWrt build root, create a file "files/etc/config/firewall".
>>> When you build OpenWrt, the file will be included in the image (and not
>>> overwritten).
>>>
>>> Btw., /etc/config/network is generated by a script on first boot and
>>> that is then deleted.
>>> But it is still accessible in /rom/etc/uci_defaults/02_network (not
>>> quite sure on the script name).
>>>
>>> - mwarning
>>>
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel at lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200519/6fb162f7/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list