Here it is
To follow this guide you will need to have sudo permissions on your device.
First things first
Make sure your tiny friend has its packages updated and is ready to go.
sudo apt update && sudo apt upgrade
Create network bridge device
To connect the the wireless and wired interfaces we will create a bridge device for them.
- Create the following file and add the content below to it:
/etc/systemd/network/bridge-br0.netdev
[NetDev] Name=br0 Kind=bridge
This will define the bridge itself, next we will define the members of the bridge.
- Create the following file and add the content below:
/etc/systemd/network/br0-member-eth0.network
[Match] Name=eth0 [Network] Bridge=br0
You’d think that we’re supposed to add the wireless interface as a member as well, but the wifi software
hostapd
will do this for us.
Hence we’re not adding it here.
Enable systemd-networkd
This will ensure the bridge is created and populated with its defined members when the Pi boots.
sudo systemctl enable systemd-networkd
Configure DHCP client settings
Next up, edit the /etc/dhcpcd.conf
file to deny DHCP leases for the wlan0
and eth0
interfaces.
Finally we will add the br0 interface so that does get an IP.
- Add the following near the beginning of the file, as long as it’s before the first
interface xxx
linedenyinterfaces wlan0 eth0
- At the end of the line, add the following configuration line
interface br0
Ensure Wireless operation
Your wifi will be disabled until you define a country code.
To ensure wifi is not blocked, run the following command, or set your country code, or do both:
sudo rfkill unblock wlan
Install and configure hostapd package
Install:
sudo apt install hostapd
Configure:
/etc/hostapd/hostapd.conf
country_code=DE
interface=wlan0
bridge=br0
ssid=NameOfYourWifiNetwork
hw_mode=a
channel=44
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=CorrectHorseBatteryStaple
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Note that country_code
,hw_mode
and channel
may differ on your location.
Reboot
Reboot your Pi and wifi should be available.
Depending on the rest of your network setup, connected clients should receive a DHCP lease and have internet connectivity.
Enjoy.
Source: https://www.raspberrypi.com/documentation/computers/configuration.html#setting-up-a-bridged-wireless-access-point