diff --git a/root/etc/init.d/easymesh b/root/etc/init.d/easymesh index f4d261d..876891f 100755 --- a/root/etc/init.d/easymesh +++ b/root/etc/init.d/easymesh @@ -278,45 +278,42 @@ if [ "$ap_mode" = 1 ]; then last_octet=$((RANDOM % 254 + 1)) # Generate a random value for the last octet between 1 and 254 nodeip="${ip_base}.${last_octet}" # Concatenate the base IP with the new last octet - # Configure Bridge and Interfaces - uci set network.lan.type='bridge' - uci set network.lan.ifname='eth0' # assuming eth0 is the LAN interface - uci set network.lan.proto='static' - uci set network.lan.ipaddr=$nodeip # Set the randomly chosen IP - uci set network.lan.netmask='255.255.255.0' # Set your desired netmask - uci set network.lan.gateway=$dns # Set the gateway IP (usually your main router IP) - uci set network.lan.dns=$dns # Set the DNS IP - uci set system.@system[0].hostname=$gateway - - # Add the Wi-Fi interface to the LAN bridge - uci set wireless.default_$apall.network='lan' # Adjust if your wireless interface name differs - - # Disable and stop dnsmasq - uci commit dhcp; echo '' > /etc/config/dhcp - /etc/init.d/dnsmasq disable - /etc/init.d/dnsmasq stop - - # Delete existing WAN interface - uci delete network.wan - - # Delete WAN zone from firewall - wan_zone=$(uci show firewall | grep '=zone' | grep '.name=' | grep 'wan' | cut -d'.' -f2) - if [ ! -z "$wan_zone" ]; then - uci delete firewall.$wan_zone - fi + # random static IP just in case + #uci set network.lan.ipaddr=$nodeip # Set the randomly chosen IP - # Adjust the firewall settings as necessary +# Do not need these running +for i in firewall dnsmasq odhcpd; do + if /etc/init.d/"$i" enabled; then + /etc/init.d/"$i" disable + /etc/init.d/"$i" stop + fi +done + +# Now switch to DHCP client + +uci set network.lan.proto='dhcp' +uci delete network.wan +uci delete network.wan6 +uci delete network.lan.ipaddr +uci delete network.lan.netmask + +#break some stuff +uci set network.lan.netmask=$netmask # Set your desired netmask +uci set network.lan.gateway=$dns # Set the gateway IP (usually your main router IP) +#uci set network.lan.dns=$dns # Set the DNS IP +uci set system.@system[0].hostname=$gateway + + + # commit all changes + +uci commit + +# remove the firewall config + +mv /etc/config/firewall /etc/config/firewall.unused + +/etc/init.d/network restart - # Commit the changes - uci commit firewall - uci commit network - uci commit wireless - uci commit system - # Restart services to apply changes - sync - /etc/init.d/network restart - /etc/init.d/wireless restart - /etc/init.d/system reload fi