Quantcast
Channel: User Mohammad Ali - Raspberry Pi Stack Exchange
Viewing all articles
Browse latest Browse all 44

Answer by Mohammad Ali for Connecting Raspberry Pi Zero W to ethernet and serving as WiFi access point

$
0
0

I have written you a tutorial below on how you can setup your pi as a router. although performance will likely be abysmal(sub 20mbps) because of the amount of encryption required to operate an accesss point and the pi's lack of hardware acceleration for this particular software.

id recommend you start by bringing your os up to date by running the following command:

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

Then we will begin by installing a program called hostapd, which will be used to setup our wireless access point. We will also need a package called bridge-utils to manage bridge devices.

sudo apt-get install hostapd bridge-utils

We then want to turn off some of the new services that we just installed by running the following command:

sudo systemctl stop hostapd

Next, we will create a bridge br0 using the brctl command

sudo brctl addbr br0

Then we want to add eth0(the wired connection) as one of the ports for br0 (bridge 0)

sudo brctl addif br0 eth0

We then can open up your network interfaces file by running the following command:

sudo nano /etc/network/interfaces

and we can add in the following lines:

allow-hotplug wlan0iface wlan0 inet manual #create a network interface without an ipauto br0 #makes it start on boot upiface br0 inet dhcp #automatically assign ip addresses to our clients with dhcpbridge_ports eth0 wlan0 #bridges our wireless and wired interfaces together

Then, we will configure our wireless access point:

We will start by opening a file named hostapd.conf which can be located in /etc/hostapd. We will use the following command to open it:

sudo nano /etc/hostapd/hostapd.conf

We then want to paste the following lines into it:

interface=wlan0 #use the wifibridge=br0 # the bridge we set upssid=bandzar.com #the router namehw_mode=g #g = IEEE 802.11g (2.4 GHz)channel=8 # just a random channel i choosewmm_enabled=0 #wifi multimedia disabled as your divice is probably too low powermacaddr_acl=0 #disable mac address based authauth_algs=1 # 1=wpa, 2=wep, 3=bothignore_broadcast_ssid=0 #Send empty SSID in beacons and ignore probe request frames that do notwpa=2 #requires authentication to accesswpa_passphrase=thanksMohammad # the passwordwpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP

Finally, we can edit the hostapd file in the /etc/default directory using the following command:

sudo nano /etc/default/hostapd

and all we want to do is uncomment the following line and add the path to the file we previously edited, so it looks like the following:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

you should now be able to restart and see a wifi access point when you have ethernet plugged in


Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>