Skip to content

Instantly share code, notes, and snippets.

@BigNerd95
Created November 13, 2019 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BigNerd95/842353bd18fca320208ee36bf8040da1 to your computer and use it in GitHub Desktop.
Save BigNerd95/842353bd18fca320208ee36bf8040da1 to your computer and use it in GitHub Desktop.
Make a curl request using a new pppoe connection (this allows you to make requests using many different IPs without dropping your internet connection)
#!/bin/sh
url="http://api.ipify.org/"
user="pppoeuser"
pass="pppoepwd"
nic="dsl0.835"
name="wan100"
echo "Starting new pppoe connection"
/usr/sbin/pppd updetach ipparam $name ifname pppoe-$name user $user password $pass lcp-echo-interval 86400 lcp-echo-failure 1024 lcp-echo-adaptive +ipv6 set AUTOIPV6=1 set PEERDNS=0 nodefaultroute usepeerdns maxfail 1 ip-up-script /lib/netifd/ppp-up ipv6-up-script /lib/netifd/ppp6-up ip-down-script /lib/netifd/ppp-down ipv6-down-script /lib/netifd/ppp-down mtu 1492 mru 1492 plugin rp-pppoe.so nic-$nic
if [ -f /var/run/pppoe-$name.pid ]
then
echo "Connection OK"
echo $(curl "$url" -s --interface pppoe-$name)
echo "Closing connection"
kill $(cat /var/run/pppoe-$name.pid)
else
echo "Connection error!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment