Created
July 28, 2024 04:48
-
-
Save zoonderkins/aebcee2c524473957571a99a04398dcf to your computer and use it in GitHub Desktop.
gl-inet router init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Model that I use | |
## 1. AXT-1800 | |
## 2. AR-750s | |
#### | |
# Replace 172.20.10.1 and 172.20.10.6 to your mobile 4g/5g hotspot | |
# I use Iphone | |
# 172.20.10.1 is the gateway | |
# 172.20.10.6 is the IP address for client | |
### | |
# Set TTL values using iptables and ip6tables | |
iptables -t mangle -A POSTROUTING -j TTL --ttl-set 65 | |
iptables -t mangle -I POSTROUTING -j TTL --ttl-set 65 | |
iptables -t mangle -A PREROUTING -i sta0 -j TTL --ttl-set 65 | |
iptables -t mangle -A POSTROUTING -i sta0 -j TTL --ttl-set 65 | |
iptables -t mangle -A PREROUTING -i br-lan -j TTL --ttl-set 65 | |
iptables -t mangle -A POSTROUTING -i br-lan -j TTL --ttl-set 65 | |
iptables -t mangle -A POSTROUTING -s 172.20.10.1 -j TTL --ttl-set 65 | |
iptables -t mangle -A POSTROUTING -s 172.20.10.6 -j TTL --ttl-set 65 | |
ip6tables -t mangle -I POSTROUTING -j HL --hl-set 65 | |
# 76.76.2.32 is OISD-Full adblock via ControlD | |
# 94.140.14.14 is adblock from Adguard | |
# Update /etc/resolv.conf with custom nameservers | |
cat <<-EOF > /etc/resolv.conf | |
nameserver 127.0.0.1 | |
nameserver ::1 | |
nameserver 76.76.2.32 | |
nameserver 94.140.14.14 | |
EOF | |
# Update /etc/hosts with custom entries and block domains | |
{ | |
cat <<-EOF | |
127.0.0.1 localhost | |
::1 localhost ip6-localhost ip6-loopback | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
EOF | |
curl https://big.oisd.nl/domainswild2 | grep -v '^#' | grep -v '^[[:space:]]*$' | sed 's/^/0.0.0.0 /' | |
} > /etc/hosts.tmp && mv /etc/hosts.tmp /etc/hosts && echo "Hosts file updated." && \ | |
/etc/init.d/dnsmasq restart && echo "dnsmasq restarted successfully." || \ | |
(echo "An error occurred. Please check the commands and try again." && exit 1) | |
## Here is set the fan speed 0 = off, 255 = max | |
# Set the thermal cooling device state | |
echo 255 > /sys/class/thermal/cooling_device0/cur_state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment