From afa546c60aa88e49fbeeb5c29985fbe635a2ed0a Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 4 Nov 2023 07:45:56 +0000 Subject: [PATCH] Update 'root/etc/init.d/easymesh' --- root/etc/init.d/easymesh | 52 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/root/etc/init.d/easymesh b/root/etc/init.d/easymesh index 876891f..26b11f3 100755 --- a/root/etc/init.d/easymesh +++ b/root/etc/init.d/easymesh @@ -267,19 +267,18 @@ set_easymesh() { if [ "$ap_mode" = 1 ]; then - # Backup Configurations - cp /etc/config/wireless /etc/config/wireless.backup - cp /etc/config/network /etc/config/network.backup - cp /etc/config/dhcp /etc/config/dhcp.backup +# Backup Configurations if your scared +cp /etc/config/wireless /etc/config/wireless.backup +cp /etc/config/network /etc/config/network.backup +cp /etc/config/dhcp /etc/config/dhcp.backup +# Generate a random IP in the same subnet for fun +ip_base=$(echo "$dns" | cut -d'.' -f1-3) # Get the first three octets of the DNS IP +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 - # Generate a random IP in the same subnet - ip_base=$(echo "$dns" | cut -d'.' -f1-3) # Get the first three octets of the DNS IP - 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 - - # random static IP just in case - #uci set network.lan.ipaddr=$nodeip # Set the randomly chosen IP +# random static IP just in case +#uci set network.lan.ipaddr=$nodeip # Set the randomly chosen IP # Do not need these running for i in firewall dnsmasq odhcpd; do @@ -289,31 +288,40 @@ for i in firewall dnsmasq odhcpd; do fi done -# Now switch to DHCP client - +# Set LAN interface 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 +# Set netmask and gateway (assuming $netmask and $dns didn't break more stuff) +uci set network.lan.netmask=$netmask +uci set network.lan.gateway=$dns uci set system.@system[0].hostname=$gateway +# Configure LAN bridge and add ethernet interfaces to the bridge +uci set network.lan.ifname='eth0 eth1 wan lan1 lan2 lan3' # Add ethernet interfaces and the kitchen sink here +uci set network.lan.type='bridge' - # commit all changes +# If you also need to configure the wireless network to be part of the bridge: +uci set wireless.default_$apall.network='lan' # Make sure the Wi-Fi is part of the lan network -uci commit +# Commit all changes +uci commit network -# remove the firewall config - -mv /etc/config/firewall /etc/config/firewall.unused +# In case of separate wireless config, commit that too +uci commit wireless +# Restart the network to apply changes /etc/init.d/network restart +# restart wifi +wifi reload + +# Removing firewall configuration +mv /etc/config/firewall /etc/config/firewall.unused + fi