OpenWrt Forum Archive

Topic: uci updating on wrong place

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

My current network configuration is given below

root@OpenWrt:~# uci -n show network
network.loopback=interface
network.loopback.proto=static
network.loopback.netmask=255.0.0.0
network.loopback.ipaddr=10.10.10.14
network.loopback.ifname=wlan1
network.globals=globals
network.globals.ula_prefix=fd81:1146:2d7b::/48
network.wan=interface
network.wan.proto=dhcp
network.wan.ifname=wlan0
network.wan.ipaddr=18.1.1.1
network.wan6=interface
network.wan6.ifname=eth1
network.wan6.proto=dhcpv6
network.lan=interface
network.lan.force_link=1
network.lan.type=bridge
network.lan.proto=dhcp
network.lan.gateway=192.168.1.1
network.lan.netmask=255.255.255.0
network.lan.ip6assign=60
network.lan.ifname=eth0 eth1 wlan0
network.lan.ipaddr=192.168.1.177
network.@switch[0]=switch
network.@switch[0].name=switch0
network.@switch[0].reset=1
network.@switch[0].enable_vlan=1
network.@switch_vlan[0]=switch_vlan
network.@switch_vlan[0].device=switch0
network.@switch_vlan[0].vlan=1
network.@switch_vlan[0].ports=0 1 2 3 4
network.@interface[0]=interface
network.@interface[0].ifname=wlan0
network.@interface[0].ipaddr=101.1.1.1


I am trying to change IP of unnamed section @interface[0] to 8.8.8.8 using the following command
uci set network.@interface[0].ipaddr=8.8.8.8
but it updates on my loopback which is the first entry in the configuration

network.loopback=interface
network.loopback.proto=static
network.loopback.netmask=255.0.0.0
network.loopback.ifname=wlan1
network.loopback.ipaddr=8.8.8.8
network.globals=globals
network.globals.ula_prefix=fd81:1146:2d7b::/48
network.wan=interface
network.wan.proto=dhcp
network.wan.ifname=wlan0
network.wan.ipaddr=18.1.1.1
network.wan6=interface
network.wan6.ifname=eth1
network.wan6.proto=dhcpv6
network.lan=interface
network.lan.force_link=1
network.lan.type=bridge
network.lan.proto=dhcp
network.lan.gateway=192.168.1.1
network.lan.netmask=255.255.255.0
network.lan.ip6assign=60
network.lan.ifname=eth0 eth1 wlan0
network.lan.ipaddr=192.168.1.177
network.@switch[0]=switch
network.@switch[0].name=switch0
network.@switch[0].reset=1
network.@switch[0].enable_vlan=1
network.@switch_vlan[0]=switch_vlan
network.@switch_vlan[0].device=switch0
network.@switch_vlan[0].vlan=1
network.@switch_vlan[0].ports=0 1 2 3 4
network.@interface[0]=interface
network.@interface[0].ifname=wlan0
network.@interface[0].ipaddr=101.1.1.1


How to solve this issue ?

Use nano or vi to modify /etc/config/network and give your interfaces proper names like "loopback", "lan", "wan" and possibly "wlan". Or do you have some valid reason for not doing so?

As an aside, it is considered a bad practice to bind the wireless interface from /etc/config/network side. The reason is that if you have multiple radios on your router, the identifiers "wlan0" and "wlan1" may swap around. It is more robust to assign the UCI network name of a wireless interface from the /etc/config/wireless side, using the 'option network' setting, and leave the 'option ifname' out from /etc/config/network.

Saving the curious question last: why do you want to create an interface that uses the same IP address that is globally linked to Google's DNS server?

(Last edited by Antek on 13 Jul 2017, 07:44)

The discussion might have continued from here.