Update 'root/etc/init.d/easymesh'

pull/1/head
ben 1 year ago
parent 582fbc7455
commit afa546c60a

@ -267,13 +267,12 @@ set_easymesh() {
if [ "$ap_mode" = 1 ]; then if [ "$ap_mode" = 1 ]; then
# Backup Configurations # Backup Configurations if your scared
cp /etc/config/wireless /etc/config/wireless.backup cp /etc/config/wireless /etc/config/wireless.backup
cp /etc/config/network /etc/config/network.backup cp /etc/config/network /etc/config/network.backup
cp /etc/config/dhcp /etc/config/dhcp.backup cp /etc/config/dhcp /etc/config/dhcp.backup
# Generate a random IP in the same subnet for fun
# 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 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 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 nodeip="${ip_base}.${last_octet}" # Concatenate the base IP with the new last octet
@ -289,31 +288,40 @@ for i in firewall dnsmasq odhcpd; do
fi fi
done done
# Now switch to DHCP client # Set LAN interface to DHCP client
uci set network.lan.proto='dhcp' uci set network.lan.proto='dhcp'
uci delete network.wan uci delete network.wan
uci delete network.wan6 uci delete network.wan6
uci delete network.lan.ipaddr uci delete network.lan.ipaddr
uci delete network.lan.netmask uci delete network.lan.netmask
#break some stuff # Set netmask and gateway (assuming $netmask and $dns didn't break more stuff)
uci set network.lan.netmask=$netmask # Set your desired netmask uci set network.lan.netmask=$netmask
uci set network.lan.gateway=$dns # Set the gateway IP (usually your main router IP) uci set network.lan.gateway=$dns
#uci set network.lan.dns=$dns # Set the DNS IP
uci set system.@system[0].hostname=$gateway 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
# remove the firewall config # Commit all changes
uci commit network
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 /etc/init.d/network restart
# restart wifi
wifi reload
# Removing firewall configuration
mv /etc/config/firewall /etc/config/firewall.unused
fi fi

Loading…
Cancel
Save