Uci-defaults: change wan interface from eth0 to usb0

1- i need to change the network interface wan from eth0 to usb0

network.wan.ports='usb0'
uci commit network

is this code right?

2- and i also want that the wifi is enabled by default SSID: OpenWrt | Mode: Master

how to do this?

You should use something like this:

uci -q batch << EOF
set network.wan.device='usb0'
delete wireless.radio0.disabled
delete wireless.default_radio0.disabled
delete wireless.radio1.disabled
delete wireless.default_radio1.disabled
EOF

The uci commit isn't necessary. It will be done automatically during boot.

You might have to check what your wireless settings look like, if radio0 and radio1 exist, etc., depending on your device.

1 Like

thank you. i will try it and try to reset the router and see.

this is my wifi settings:

so i just have readio0? than the code will be just this?

uci -q batch << EOF
set network.wan.device='usb0'
delete wireless.radio0.disabled
delete wireless.default_radio0.disabled
EOF

Maybe just use this instead, which ignores any naming of the wifi sections:

uci -q batch << EOF
set network.wan.device='usb0'
delete wireless.@wifi-device[0].disabled
delete wireless.@wifi-iface[0].disabled
EOF
4 Likes

thank you. is it working well.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.