How to create a wifi hotspot / router to share your media and files. This is a localized hotspot where everyone can connect to and upload or download file to the Raspberry Pi 2, or even watch media using plex. thanks for the view!
The Steps
Install iw to check wifi dongle
sudo apt-get install iw
sudo iw list
Remove WPA Supplicant
sudo apt-get purge wpasupplicant
install dhcp server
sudo apt-get install isc-dhcp-server
setup dhcp
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.25 10.10.0.50;
option domain-name-servers 8.8.4.4;
option routers 10.10.0.1;
interface wlan0;
}
install hostapd for hosting access point
sudo apt-get install hostapd
configure hostapd
to create/edit hostapd.conf
nano /etc/hostapd/hostapd.conf
add these lines to hostapd.conf file
interface=wlan0
driver=nl80211
ssid=YOUR_STATION
hw_mode=g
channel=11
wpa=1
wpa_passphrase=SECRETPASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600
macaddr_acl=0
to Test:
*remember to reboot before attempting these steps*
sudo ifconfig wlan0 10.10.0.1
sudo /etc/init.d/isc-dhcp-server restart
-d is for debug mode so you can see if any errors appear
sudo hostapd -d /etc/hostapd/hostapd.conf
to make persistent
nano /etc/network/interfaces
add or eidt these following line
auto wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0
nano /etc/rc.local
add these lines
hostapd -B /etc/hostapd/hostapd.conf
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
add this line to sysctl.conf
nano /etc/sysctl.conf
net.ipv4.ip_forward = 0
You do a very good job with your videos .
Thanks.
I’ve tried a lot of ways to do this and yours is the only one that works.
Well done! . . . . one thing, to complete/improve your command list you might want to add “sudo nano /etc/dhcp/dhcpd.conf” before your “setup dhcp” step.
Will this work with raspberry pi 3b? If not please make a video and a page like this on how to.
I also want to know if pi3b will use a wifi dongle if its attatched, I cant find answers on the web and looking at my pi3b i cant tell if it is or isnt but I am still learning, please help.
For raspberry pi 3 b onboard wifi just put # infront of driver option. It will work. I’m trying to test tor on it as well but not getting far at all.
Im trying to forward the internet from another usb wifi dongle but i am not able to forward the internet, But the stuff locally available in the pi is accessible but not able to use the internet
great tuts :v
I think there is an error in the forwarding (last line). It should say:
net.ipv4.ip_forward = 1
instead of :
net.ipv4.ip_forward = 0
Hi,
very good Tutorial. Roee Schmidt is right, it has to be
net.ipv4.ip_forward = 1
And you missed a few sudo’s. BTW you could use
sudo -i
at first
Will this work on the raspberry pi zero w. Please let me know.
Your video is great but the problem is very hard to see when you pause the video some time the control bar is blocking what you type and very hard to read on a mobile device, there typo in your direction as well. Otherwise your doing an great job
Can you update article for raspberry PI3, i am getting below error.
] Restarting isc-dhcp-server (via systemctl): isc-dhcp-server.serviceJob for isc-dhcp-server.service failed because the control process exited with error code.
See “systemctl status isc-dhcp-server.service” and “journalctl -xe” for details.
failed!
I encountered the isc-dhcp-server issue as well and it seems to be related to the timings when the network services are up when the initial start of the dhcp server is attempted.
I get the error at boot time, but when restarting it manually afterwards it worked.
There is some more information here: https://raspberrypi.stackexchange.com/questions/70517/isc-dhcp-server-needs-to-be-restarted-after-reboot
Hi will this work with raspien stretch on raspi3+