Working with network interfaces - MarvellEmbeddedProcessors/openwrt-dd GitHub Wiki
In some cases it may be desireable to change network interfaces configuration for custom configuration purposes. To do so, you can use one of the following methods:
/etc/config/network is location of main network configuration file.
This is example of default configuration for the ESPRESSObin board:
config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config globals 'globals' option default_ps '0' option ula_prefix 'fd3f:04a6:12e7::/48' config interface 'wan' option ifname 'wan' option proto 'dhcp' config interface 'lan' option type 'bridge' option ifname 'lan0 lan1' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60'
Where there are 2 relevant global sections: lan and wan under which you can change interfaces, protocol, IP address/subnet mask and additional (advanced) options.
To manually change file, you can open them with vim, which is default editor predinstalled on OpenWrt, change desired setting, and save file.
After saving you will need to restart the networking service:
/etc/init.d/network restart
UCI is default configuration tool on the OpenWrt and can be used for configuring a large number of services, including the network.
To get the network configuration displayed as UCI options:
uci show network
Which will return similar list:
network.loopback=interface network.loopback.ifname='lo' network.loopback.proto='static' network.loopback.ipaddr='127.0.0.1' network.loopback.netmask='255.0.0.0' network.globals=globals network.globals.default_ps='0' network.globals.ula_prefix='fd3f:04a6:12e7::/48' network.wan=interface network.wan.ifname='wan' network.wan.proto='dhcp' network.lan=interface network.lan.type='bridge' network.lan.ifname='lan0 lan1' network.lan.proto='static' network.lan.ipaddr='192.168.1.1' network.lan.netmask='255.255.255.0' network.lan.ip6assign='60'
To change anything, simply take option and change the value behind the equal sign (=) using uci set command.
For example, to change the IP address on the lan interface:
uci set network.lan.ipaddr='10.0.0.1'
To save new value, you will have to commit changes for the configuration:
uci commit
Again, you will have to restart the service in order for changes to take affect:
/etc/init.d/network restart
LuCI is default graphical webUI for the OpenWrt. In order to use it, you will have to enable and compile it first.
While in the OpenWrt directory, invoke menuconfig:
make menuconfig
For the base package, select luci package:
LuCI ---> 1. Collections ---> <*> luci
LuCI is quite modular and has a large number of additional modules which can be selected if needed.
Once you build and flash the new image, LuCI can be accessed through the browser by typing the IP address of the board (192.168.1.1 by default) in the URL bar.