Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions to host a wireless network from a Raspberry Pi #3138

Merged
merged 2 commits into from
Oct 6, 2023

Conversation

nathan-contino
Copy link
Collaborator

@nathan-contino nathan-contino added the bookworm 🐛 Issue with Bookworm label Sep 28, 2023
Copy link
Contributor

@aallan aallan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets get some proper diagrams in here before proceeding.


Consider a wired network that uses the `10.x.x.x` IP block. You can connect your Raspberry Pi to that network and serve wireless clients on a separate network that uses another IP block, such as `192.168.x.x`. In the diagram below, note that the laptop exists in an IP block separate from the router and wired clients:

----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you ping @jackbenwillis about these diagrams? I think we'd want proper artwork in here. I know the original tutorials had ASCII art, but we're trying to do a bit better about things these days!

=== Use your Raspberry Pi as a network bridge

By default, the wireless network hosted from your Raspberry Pi exists separately from the parent network connected via Ethernet. In this arrangement, devices connected to the parent network cannot directly communicate with devices connected to the wireless network hosted from your Raspberry Pi. If you want connected wireless devices to be able to communicate with devices on the parent network, you can configure your Raspberry Pi as a https://en.wikipedia.org/wiki/Network_bridge[network bridge]. With a network bridge in place, each device connected to the Pi-hosted wireless network is assigned an IP address in the parent network. In the diagram below, note that the laptop exists in the same IP block as the router and wired clients:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one!

@aallan aallan added the waiting for revisions Waiting for the OP to make revisions label Sep 29, 2023
@aallan
Copy link
Contributor

aallan commented Oct 2, 2023

Lets get some proper diagrams in here before proceeding.

I've thrown a task into Asana for the design team.

@aallan
Copy link
Contributor

aallan commented Oct 5, 2023

Ready to merge?

@nathan-contino
Copy link
Collaborator Author

No blocking comments, ready when you are.

@aallan aallan merged commit 6aac071 into develop Oct 6, 2023
1 check passed
@aallan aallan deleted the host-wireless-access-point branch October 6, 2023 13:39
Comment on lines +63 to +68
To disable the network:

1. Click the network icon in the system tray. Select *Turn Off Wireless LAN*.
2. Click the network icon in the system tray. Select *Turn On Wireless LAN*.

The wireless module should automatically connect to your preferred wireless network when you complete the second step. If it doesn't, pick a wireless network from the dropdown.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, this section doesn't seem to make sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What specifically doesn't make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it was just me misunderstanding things, but it seems to be saying "To disable the network... turn it off and on again" ??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More specifically, the only way to disable the hotspot and start using your wifi module to connect to other networks is to... disable and re-enable the wireless radio. I should probably update this to say "hotspot network". I added this because the UI doesn't provide an easy way to get out of hotspot mode that I can find, and I'm afraid some users might get "stuck" in hotspot mode and not know how to get out of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also be worth clarifying that when you "turn it on again" the hotspot network will have been disabled? I think that might have been what was confusing me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that the hotspot network doesn't automatically survive a reboot? Or does NetworkManager treat a reboot event differently to disabling and then re-enabling the WiFi?

Copy link
Collaborator Author

@nathan-contino nathan-contino Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Basically:

  • network manager always connects to the highest priority connection on launch (including the hotspot)
  • the UI doesn't include any way to disable the hotspot and switch back to wireless client mode
  • if you don't set the hotspot priority (that is, if all priority levels are equal), network manager connects to available known networks as a client first

So turning wireless off and on again just passes the buck to priority settings. You can set the hotspot priority highest to force network manager to default to the hotspot on launch. But if you set the priority higher there doesn't seem to be any way to reliably get back to client mode using the UI.

It is tempting to remove the UI instructions entirely here and point users to the CLI method instead. Increasingly I suspect it might be the only viable option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Apologies for opening the hornet's nest, but I'll leave you and Alasdair to thrash out the best solution 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, considering, I think we should dump the GUI instructions and revert to CLI only.

* If you have already created a wireless hotspot connection, add the existing interface to the bridge with the following command:
+
----
sudo nmcli connection modify 'Hotspot' master bridge0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the Hotspot name here correspond to the <example-network-name> used earlier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In network manager, networks have both a name and an ssid. is the ssid for that network, but using the hotspot command in nmcli seems to always generate a network with the name "Hotspot" unless you specify a different name.

Added a sentence clarifying this!

@aallan aallan removed the waiting for revisions Waiting for the OP to make revisions label Oct 10, 2023
@aallan
Copy link
Contributor

aallan commented Oct 10, 2023

Network diagrams uploaded and added directly to develop in 92d1f6a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookworm 🐛 Issue with Bookworm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tutorial around building a wireless hotspot to bypass captive portals
3 participants