[Solved] Static leases in uci-defaults

Hi there,

I like to pre-configure my firmware image with some settings in the uci-defaults (IP-Address, WiFi, static leases for my network clients).

IP-Adress and WiFi is no problem.
But I don't see the entries for my static leases.
Maybe there's a problem in my script, or it is not possible?

This is my script, which I use in the firmware builder frontend.

# Beware! This script will be in /rom/etc/uci-defaults/ as part of the image.
# Uncomment lines to apply:
# wlan_name="OpenWrt"
# wlan_password="12345678"

# log potential errors
exec >/tmp/setup.log 2>&1

if [ -n "$root_password" ]; then
  (echo "$root_password"; sleep 1; echo "$root_password") | passwd > /dev/null

# Configure LAN
# More options: https://openwrt.org/docs/guide-user/base-system/basic-networking
if [ -n "$lan_ip_address" ]; then
  uci set network.lan.ipaddr="$lan_ip_address"
  uci commit network

# Configure WLAN
# More options: https://openwrt.org/docs/guide-user/network/wifi/basic#wi-fi_interfaces
if [ -n "$wlan_name" -a -n "$wlan_password" -a ${#wlan_password} -ge 8 ]; then
  uci set wireless.@wifi-device[0].disabled='0'
  uci set wireless.@wifi-iface[0].encryption='psk2'
  uci set wireless.@wifi-iface[0].ssid="$wlan_name"
  uci set wireless.@wifi-iface[0].key="$wlan_password"
  uci commit wireless

#Static Names
uci add host
uci set dhcp.@host[-1].name='laptop-sony-lan'
uci set dhcp.@host[-1].mac='FF:FF:FF:FF:FF:FF'
uci set dhcp.@host[-1].ip=''
uci commit dhcp

echo "All done!"

Maybe someone can help me?

Thanks for your help :slight_smile:

dhcp host
Fixed with right prefix.


Oh dammit. I missed that :see_no_evil:
Thanks for the fast help :slight_smile:

1 Like

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