Skip to content

Commit

Permalink
Epoch1970: Access Point refactoring (#1333)
Browse files Browse the repository at this point in the history
* Update README.md

* Rename access-point.md to access-point-routed.md

* Create access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update README.md

* Update README.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-bridged.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update access-point-routed.md

* Update README.md

* Copy-edits

* Copy-edits

* Copy-edits

* Copy-edits

* Copy-edits

* Copy-edits

* Copy-edits

* Minor copy-editing changes

"WiFi"-->"wireless LAN" x 2

* Minor copy-editing changes

"WiFi"-->"wireless" or "wireless LAN"

* Minor change in copy-editing

"WiFi"-->"wireless"

* Minor change in copy-editing

Attempt to add clarity around which section to omit in order to run a wireless network in isolation, rather than routing between wireless and Ethernet

* Tiny change in copy-editing

* Update access-point-bridged.md

* Update access-point-bridged.md

* Update access-point-routed.md

Co-authored-by: epoch1970 <jp.moins@gmail.com>
Co-authored-by: mwainwright <maw13@cantab.net>
Co-authored-by: Helen Lynn <helen@raspberrypi.org>
  • Loading branch information
4 people committed Apr 24, 2020
1 parent 2c7b13c commit 10e24b2
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 76 deletions.
8 changes: 4 additions & 4 deletions configuration/wireless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ The following documentation is available:
- A guide to setting up wireless networking using the Raspberry Pi Desktop
- [Command line](wireless-cli.md)
- A guide to setting up wireless networking from the command line
- [Routed Access point](access-point-routed.md)
- A guide to setting up the Raspberry Pi as a wireless access point and router for WiFi clients.
- [Bridged Access point](access-point-bridged.md)
- A guide to setting up the Raspberry Pi as a wireless access point, extending an ethernet LAN to WiFi clients.
- [Routed access point](access-point-routed.md)
- A guide to setting up the Raspberry Pi as a wireless access point and router for wireless LAN clients
- [Bridged access point](access-point-bridged.md)
- A guide to setting up the Raspberry Pi as a wireless access point, extending an Ethernet LAN to wireless LAN clients
- [Headless setup](headless.md)
- A guide to setting up the Raspberry Pi headless
67 changes: 36 additions & 31 deletions configuration/wireless/access-point-bridged.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

# Setting up a Raspberry Pi as a Bridged Wireless Access Point
# Setting up a Raspberry Pi as a bridged wireless access point

The Raspberry Pi can be used as a bridged wireless access point within an existing ethernet network. This will extend the network to wireless computers and devices.
The Raspberry Pi can be used as a bridged wireless access point within an existing Ethernet network. This will extend the network to wireless computers and devices.

If you wish to create a wireless network that could function stand-alone, consider instead setting up a [routed access point.](./access-point-routed.md)
If you wish to create a standalone wireless network, consider instead setting up a [routed access point](./access-point-routed.md).

```
+- RPi -------+
+---+ Bridge |
| | WiFi AP +-)))
| | WLAN AP +-)))
| | 192.168.1.2 | +- Laptop ----+
| +-------------+ (((-+ WiFi STA |
| +-------------+ (((-+ WLAN Client |
+- Router ----+ | | 192.168.1.5 |
| Firewall | | +- PC#2 ------+ +-------------+
(Internet)---WAN-+ DHCP server +-LAN-+---+ 192.168.1.3 |
Expand All @@ -21,21 +21,21 @@ If you wish to create a wireless network that could function stand-alone, consid
+-------------+
```

This can be done using the inbuilt wireless features of the Raspberry Pi 4, Raspberry Pi 3 or Raspberry Pi Zero W, or by using a suitable USB wireless dongle that supports access point mode.
It is possible that some USB dongles may need slight changes to their settings. If you are having trouble with a USB wireless dongle, please check the forums.
A bridged wireless access point can be created using the inbuilt wireless features of the Raspberry Pi 4, Raspberry Pi 3B, Raspberry Pi 3A+/3B+ or Raspberry Pi Zero W/WH, or by using a suitable USB wireless dongle that supports access point mode.
It is possible that some USB dongles may need slight changes to their settings. If you are having trouble with a USB wireless dongle, please check the [forums](https://www.raspberrypi.org/forums/).

This documentation was tested on a Raspberry Pi 3B running a factory installation of Raspbian Buster Lite (Jul. 2019).
This documentation was tested on a Raspberry Pi 3B running a fresh installation of Raspbian Buster.

<a name="intro"></a>
## Before you start

* Ensure you have administrative access to your Raspberry Pi. The network setup will be entirely reset as part of the installation: local access, with screen and keyboard connected to your Raspberry Pi, is recommended.

**Note:** If installing remotely through SSH,
* Connect to your Raspberry Pi *by name*, e.g. `ssh pi@raspberrypi.local`. The IP address of your Raspberry Pi on the network *will probably change* after installation.
**Note:** If installing remotely via SSH,
* Connect to your Raspberry Pi **by name**, e.g. `ssh pi@raspberrypi.local`. The IP address of your Raspberry Pi on the network **will probably change** after installation.
* Be ready to add screen and keyboard in case you lose contact with your Raspberry Pi after installation.
* Connect your Raspberry Pi to the ethernet network and boot the Raspbian OS.
* Ensure the Raspbian OS on your Raspberry Pi is [up to date](../../raspbian/updating.md) and reboot if packages were installed in the process.
* Connect your Raspberry Pi to the Ethernet network and boot the Raspbian OS.
* Ensure the Raspbian OS on your Raspberry Pi is [up-to-date](../../raspbian/updating.md) and reboot if packages were installed in the process.
* Have a wireless client (laptop, smartphone, ...) ready to test your new access point.

<a name="software-install"></a>
Expand All @@ -46,7 +46,7 @@ In order to work as a bridged access point, the Raspberry Pi needs to have the `
```
sudo apt install hostapd
```
Enable the wireless access point service to start when your Raspberry Pi boots:
Enable the wireless access point service and set it to start when your Raspberry Pi boots:

```
sudo systemctl unmask hostapd
Expand All @@ -58,33 +58,39 @@ Software installation is complete. We will configure the access point software l
<a name="bridging"></a>
## Setup the network bridge

A bridge network device in the Raspberry Pi will join the ethernet and wireless networks using its built-in interfaces.
A bridge network device running on the Raspberry Pi will connect the Ethernet and wireless networks using its built-in interfaces.

### Create a bridge device and populate the bridge

Add a bridge network device named `br0` by creating the following file:
Add a bridge network device named `br0` by creating a file using the following command, with the contents below:

```
sudo nano /etc/systemd/network/bridge-br0.netdev
```

File contents:
```
[NetDev]
Name=br0
Kind=bridge
```

In order to bridge the ethernet network with the wireless network, first add the built-in ethernet interface (`eth0`) as bridge member with the following file:
In order to bridge the Ethernet network with the wireless network, first add the built-in Ethernet interface (`eth0`) as a bridge member by creating the following file:

```
sudo nano /etc/systemd/network/br0-member-eth0.network
```

File contents:
```
[Match]
Name=eth0
[Network]
Bridge=br0
```

*Note:* The access point software will add the wireless interface `wlan0` to the bridge when the service starts. There is no need to create a file for that interface. This situation is particular to WiFi network interfaces.
**Note:** The access point software will add the wireless interface `wlan0` to the bridge when the service starts. There is no need to create a file for that interface. This situation is particular to wireless LAN interfaces.

Now enable the `systemd-networkd` service to create and populate the bridge when your Raspberry Pi boots:

Expand All @@ -96,7 +102,7 @@ sudo systemctl enable systemd-networkd

Network interfaces that are members of a bridge device are never assigned an IP address, since they communicate via the bridge. The bridge device itself needs an IP address, so that you can reach your Raspberry Pi on the network.

`dhcpcd`, the DHCP client on the Raspberry Pi, automatically requests an IP address for every active interface. So we need to block the `eth0` and `wlan0` interfaces from being processed, and let `dhcpcd` only configure `br0` via DHCP.
`dhcpcd`, the DHCP client on the Raspberry Pi, automatically requests an IP address for every active interface. So we need to block the `eth0` and `wlan0` interfaces from being processed, and let `dhcpcd` configure only `br0` via DHCP.

```
sudo nano /etc/dhcpcd.conf
Expand All @@ -106,25 +112,19 @@ Add the following line near the beginning of the file (above the first `interfac
```
denyinterfaces wlan0 eth0
```
Interface `br0` will be configured as per defaults via DHCP, no specific entry is necessary. Save the file to complete the IP configuration of the machine.
Interface `br0` will be configured in accordance with the defaults via DHCP; no specific entry is necessary. Save the file to complete the IP configuration of the machine.

<a name="ap-config"></a>
## Configure the access point software

Create the `hostapd` configuration file, located at `/etc/hostapd/hostapd.conf`, to add the various parameters for your wireless network.
Create the `hostapd` configuration file, located at `/etc/hostapd/hostapd.conf`, to add the various parameters for your new wireless network.

```
sudo nano /etc/hostapd/hostapd.conf
```

Add the information below to the configuration file. This configuration assumes we are using channel 7, with a network name of `NameOfNetwork`, and a password `AardvarkBadgerHedgehog`. Note that the name and password should **not** have quotes around them. The passphrase should be between 8 and 64 characters in length.

To use the 5 GHz band, you can change the operations mode from `hw_mode=g` to `hw_mode=a`. Possible values for `hw_mode` are:
- a = IEEE 802.11a (5 GHz)
- b = IEEE 802.11b (2.4 GHz)
- g = IEEE 802.11g (2.4 GHz)
- ad = IEEE 802.11ad (60 GHz)

```
interface=wlan0
bridge=br0
Expand All @@ -140,18 +140,23 @@ wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
```
Note the lines `interface=wlan0` and `bridge=br0`: these direct `hostapd` to add the `wlan0` interface as bridge member to `br0` when the access point starts, completing the bridge between ethernet and wireless.
Note the lines `interface=wlan0` and `bridge=br0`: these direct `hostapd` to add the `wlan0` interface as a bridge member to `br0` when the access point starts, completing the bridge between Ethernet and wireless.

To use the 5 GHz band, you can change the operations mode from `hw_mode=g` to `hw_mode=a`. Possible values for `hw_mode` are:
- a = IEEE 802.11a (5 GHz) (Raspberry Pi 3B+ onwards)
- b = IEEE 802.11b (2.4 GHz)
- g = IEEE 802.11g (2.4 GHz)

<a name="conclusion"></a>
## Run your new wireless access point

It is now time restart your Raspberry Pi and verify the wireless access point becomes automatically available.
Now restart your Raspberry Pi and verify that the wireless access point becomes automatically available.

```
sudo systemctl reboot
```
Once your Raspberry Pi has restarted, search for WiFi networks with your wireless client. The network SSID you specified in file `/etc/hostapd/hostapd.conf` should now be present, and it should be accessible with the specified password.
Once your Raspberry Pi has restarted, search for wireless networks with your wireless client. The network SSID you specified in file `/etc/hostapd/hostapd.conf` should now be present, and it should be accessible with the specified password.

If your wireless client has access to the local network and the Internet, congratulations on your new access point!
If your wireless client has access to the local network and the internet, congratulations on setting up your new access point!

If you encounter difficulties, contact the forums for assistance. Please refer to this page in your message.
If you encounter difficulties, contact the [forums](https://www.raspberrypi.org/forums/) for assistance. Please refer to this page in your message.
Loading

0 comments on commit 10e24b2

Please sign in to comment.