|if [ "$EUID" -ne 0 ]|
|then echo "Must be root"|
|# Allow overriding from eth0 by passing in a single argument|
|if [ $# -eq 1 ]; then|
|sed -i -- 's/#net.ipv4.ip_forward/net.ipv4.ip_forward/g' /etc/sysctl.conf|
|#Change value of net.ipv4.ip_forward if not already 1|
|sed -i -- 's/net.ipv4.ip_forward=0/net.ipv4.ip_forward=1/g' /etc/sysctl.conf|
|#Activate on current system|
|echo 1 > /proc/sys/net/ipv4/ip_forward|
|iptables -t nat -A POSTROUTING -o $ADAPTER -j MASQUERADE|
|iptables -A FORWARD -i $ADAPTER -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT|
|iptables -A FORWARD -i wlan0 -o $ADAPTER -j ACCEPT|
Since my last repo' is mainly based on this couple of scripts of yours, I would like to share it with you : https://github.com/WebMaestroFr/rpi-roam-webapp. I'm pretty new to shell scripts (and command lines in general to be honest) but very curious to know what you think of this, and if it follows what you consider good practice.
@Lewiscowles1986 i realy would like to thank you for this script. I am trying to create a captive portal since may 22(almos ten days working). I followed every tutorial i found and i could't made it works. I faced a lot of trouble and i was able to passthrough everithing but the internet connection. I was able to see and connect in my network, but no internet connection. I decided to separate things and first try to create a simple hotspot router. I faced the same thing on every place i went, every tutorial i followed and now is the first time i got abble to connect and use the internet with some device. My notebook couldn't connect, but my cellphone did. I am so happy. Thank you so much for this script, it was a light for me. Now i can try the captive portal again. Thank you one more time.
Hi @Lewiscowles1986, I used your excellent script to turn my Raspberry Pi 3 into an access point. I've just tried to add this adapter-passthrough script to
Can you spot what's wrong?
I got it working, here's what I had to do:
@vicatcu yeah raspbian stretch has some awful decisions including the renaming of adapters. Try working with https://gist.github.com/Lewiscowles1986/390d4d423a08c4663c0ada0adfe04cdb as well to allow you to set