|
|
@ -267,19 +267,18 @@ 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
|
|
|
|
|
|
|
|
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
|
|
|
|
# random static IP just in case
|
|
|
|
ip_base=$(echo "$dns" | cut -d'.' -f1-3) # Get the first three octets of the DNS IP
|
|
|
|
#uci set network.lan.ipaddr=$nodeip # Set the randomly chosen 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Do not need these running
|
|
|
|
# Do not need these running
|
|
|
|
for i in firewall dnsmasq odhcpd; do
|
|
|
|
for i in firewall dnsmasq odhcpd; do
|
|
|
@ -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
|
|
|
|
# Commit all changes
|
|
|
|
|
|
|
|
uci commit network
|
|
|
|
|
|
|
|
|
|
|
|
# remove the firewall config
|
|
|
|
# In case of separate wireless config, commit that too
|
|
|
|
|
|
|
|
uci commit wireless
|
|
|
|
mv /etc/config/firewall /etc/config/firewall.unused
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|