What is OpenWrt? OpenWrt is commonly found in third-party firmware for wireless routers (soft routers). It is an efficient, reliable, and feature-rich router firmware. OpenWrt can be described as an embedded Linux distribution. (The mainstream router firmware includes dd-wrt, tomato, openwrt, and padavan.) Compared to a single, static system, OpenWrt’s package management provides a fully writable filesystem, allowing you to customize your device to suit any application.
The network configuration file for OpenWrt is /etc/config/network, which is responsible for configuring the switching chip VLAN, network interfaces, and routing.
Method 1: Change using command
We can enter the ifconfig
command in the console to view the system’s IP address
root@OpenWrt:/# ifconfig
First, enter in the SSH console
vi etc/config/network
root@OpenWrt:~# vi /etc/config/network
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 packet_steering '1'
config interface 'lan'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
option _orig_ifname 'eth0'
option _orig_bridge 'true'
option ifname 'eth0 eth1 eth2'
config interface 'wan'
option proto 'dhcp'
option ifname 'eth3'
Simply change 192.168.1.1 to the desired IP address, for example, 192.168.8.1 Press i to enter modification mode, after modifying, press esc to exit editing, then :wq to save and exit. After saving and exiting, restart the development board (if using the command, you can use reboot), and you will find the IP address has changed to 192.168.8.1.
Method 2: Change using the WEB console
Log in to the OpenWrt WEB console
Click on Network –> Interfaces –> LAN
Click Edit
to enter the LAN interface modification page
Change the IPv4 Address
from 192.168.1.1
to your desired IP, and after modification, click Save & Apply
at the bottom.