Route the list of hosts through the specified gateway (e.g. VPN).
🚀 Run it manually, using cron
, or any other way.
- Resolves IP addresses for hosts specified in a file;
- Combines similar addresses into subnets;
- Adds resulting subnets into static routes via specified gateway.
✅ The lt-version has no external python dependencies and does not use argparse
.
So it starts up to 10x faster on slow devices like OpenWRT routers.
curl https://raw.githubusercontent.com/SharUpOff/gwhosts/main/dist/gwhostslt.py -so - | sudo tee /usr/local/bin/gwhostslt > /dev/null
sudo chmod 755 /usr/local/bin/gwhostslt
pyroute2
(if installed) and argparse
.
So it starts up to 10x slower on slow devices like OpenWRT routers.
curl https://raw.githubusercontent.com/SharUpOff/gwhosts/main/dist/gwhosts.py -so - | sudo tee /usr/local/bin/gwhosts > /dev/null
sudo chmod 755 /usr/local/bin/gwhosts
gwhostslt 192.168.1.1 /etc/gwhosts
/etc/gwhosts
example:
github.com
google.com
crontab
example:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │ 7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * <command to execute>
* * * * * /usr/bin/python /usr/local/bin/gwhostslt 192.168.1.1 /etc/gwhosts
🛠 You are welcome to add support for other distributions, fix bugs or improve functionality.