Introduction: Raspberry Pi As Completely Wireless Router

Picture of Raspberry Pi As Completely Wireless Router

This instructable is to create a wireless router from a raspberry pi and a wireless adapter, None of this work is original just pieced together after several fails I hope this helps. My sources are:

https://howtoraspberrypi.com/create-a-wi-fi-hotspo...

https://github.com/billz/raspap-webgui

https://github.com/billz/raspap-webgui/issues/141 contributor Caxton1

For this project I used a raspberry pi zero w but any raspberry pi may be used and a edimax wifi adapter.

https://www.amazon.com/gp/product/B003MTTJOY/

If the raspberry pi does not have an onboard wifi two adapters should be able to accommodate they must have access point capabilities. I am using a fresh version of jessie with pixel. I am unsure about other versions.

I will be using the adapter as my connection to the external wifi and the onboard wifi as my access point or point other devices can connect to. internet-->wlan1-->wlan0-->device

Step 1: Prepairing the Additional Wifi Adapter

Picture of Prepairing the Additional Wifi Adapter

With the raspberry pi on and connected insert the wifi adapter into the raspberry usb

Verify in the pixel desktop that both wireless connections are present and one is connected to a external wifi router

Update the pi with:

sudo apt-get update && sudo apt-get upgrade -y

Then move the wifi credentials to another location with

sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.sav

sudo cp /dev/null /etc/wpa_supplicant/wpa_supplicant.conf

Step 2: Install the Workhorse and Web Gui

Now install the web gui that will do most of the work

sudo wget -q https://git.io/voEUQ -O /tmp/raspap && bash /tmp/raspap

Wait for the next prompt

Type "y" to continue

Type "y" to install

Type "y" to reboot

Your raspberry will not have internet access for the next step

Step 3: Re-enable Internet Access and Correct Configuration File

Picture of Re-enable Internet Access and Correct Configuration File

To re-enable internet access we need put the wifi credentials file back in place with

sudo cp /etc/wpa_supplicant/wpa_supplicant.conf.sav /etc/wpa_supplicant/wpa_supplicant.conf

Then reboot again

sudo reboot

Once rebooted in the pixel desktop verify that one connection is associated with your wifi ssid and the other is with an ssid "raspi-webgui"

Open a terminal, edit the /etc/network/interfaces with sudo nano /etc/network/interfaces file in my case I will delete "wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf" from the wlan0 section and in the wlan1 section change the line "iface wlan1 inet manual" to "iface wlan1 inet dhcp"

My file looks like this

# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d

auto lo iface lo inet loopback

iface eth0 inet manual

#wlan0 as access point

allow-hotplug wlan0

iface wlan0 inet manual

#wlan1 connects with external wifi

allow-hotplug wlan1

iface wlan1 inet dhcp

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Once closed restart the raspberry

sudo reboot

Step 4: Getting a the Wifis to Talk to Each Other

After the reboot the internet will be accessible now the wlan1 and wlan0 have to be told to talk to each other, In the terminal:

sudo apt-get install iptables-persistent -y
select yes to save current IPV4 rules

select yes to save current IPV6 rules

sudo nano /etc/hostapd/hostapd.conf

Comment out the driver #driver=nl80211

sudo nano /etc/default/hostapd

Find the line #DAEMON_CONF="" and change it to DAEMON_CONF="/etc/hostapd/hostapd.conf"

sudo nano /etc/init.d/hostapd

Find the line DAEMON_CONF= and change it to DAEMON_CONF=/etc/hostapd/hostapd.conf

sudo nano /etc/sysctl.conf

uncomment the line #net.ipv4.ip_forward=1 so that it becomes net.ipv4.ip_forward=1

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE sudo iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT sudo sh -c "iptables-save > /etc/iptables/rules.v4"

sudo reboot

Step 5: Connect to and Configure Your Wi-Fi Hotspot

Picture of Connect to and Configure Your Wi-Fi Hotspot

When your raspberry pi restarts, and you should see a “raspi-webgui” network in the list of accessible networks.

Once the network is visible, all you have to do is connect to it, the default password is ChangeMe.

You can change this password, network name, and many other things by connecting to the admin interface of your raspberry hotspot via your web browser, by default the address should be 10.3.141.1.

login:admin

password:secret

I hope this helps

Comments

About This Instructable

147views

3favorites

License:

More by kcschenk01:Raspberry Pi As Completely Wireless RouterInfrared-RF 433-Bluetooth Arduino Remote
Add instructable to: