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

iiab-clone-wifi needs template from hostapd - record wifi_up_down [& doc re: Ansible facts like ansible_ap0, ansible_eth0, ansible_wlan0] [& 5GHz versus 2.4GHz test] #3555

Merged
merged 1 commit into from Apr 27, 2023

Conversation

jvonau
Copy link
Contributor

@jvonau jvonau commented Apr 27, 2023

Fixes bug:

This issue should show up on a clean install with wifi_up_down: True, slight hole in testing

Description of changes proposed in this pull request:

iiab-clone-wifi needs template from hostapd.yml that moved so reposition the restart to be after hostapd.yml

Smoke-tested on which OS or OS's:

Not as of yet, but if installs start failing at the noted restarting of iiab-clone-wifi, the service file is not installed yet.

Mention a team member @username e.g. to help with code review:

@holta holta added this to the 8.1 milestone Apr 27, 2023
@holta
Copy link
Member

holta commented Apr 27, 2023

@EMG70 if you have time to test this in the coming week, that'd be incredible! Using either approach:

  1. Fresh install of PR iiab-clone-wifi needs template from hostapd - record wifi_up_down [& doc re: Ansible facts like ansible_ap0, ansible_eth0, ansible_wlan0] [& 5GHz versus 2.4GHz test] #3555 with IIAB on a new OS:

    curl iiab.io/install.txt | bash -s 3555
    
  2. Or on an existing IIAB:

    sudo rm /etc/iiab/install-flags/iiab-complete
    sudo iiab 3555
    

CLARIF / TEST PLAN: (DRAFT)

  • Make sure wifi_up_down: True remains in /etc/iiab/local_vars.yml during all testing of this PR (3555).
  • If IIAB's hotspot is working well out-of-the-gate...
    • Run: sudo iiab-hotspot-off
    • Try connecting IIAB to your home's WiFi (actual Internet) by clicking on the widget (for WiFi configuration) in the top-right of the IIAB's Graphical Desktop. Or use sudo raspi-config or similar, if your IIAB's OS has no graphical desktop.
    • Run: sudo iiab-hotspot-on
  • Test:
    • Confirm IIAB's still online, after removing its Ethernet cable as an experiment ?
    • Confirm whether WiFi client devices can still connect to IIAB and view the IIAB home page ?

Tangentially related:

@jvonau
Copy link
Contributor Author

jvonau commented Apr 27, 2023

No this issue will only show up on a fresh install with wifi_up_down: True as that is what puts the service file in place.

@jvonau
Copy link
Contributor Author

jvonau commented Apr 27, 2023

Better yet just do a plain install with unittest to confirm there is a bug, then apply the fix.

@jvonau
Copy link
Contributor Author

jvonau commented Apr 27, 2023

Confirmed bug's presents and this is the fix http://sprunge.us/K6rCCu

@holta
Copy link
Member

holta commented Apr 27, 2023

What sets ansible_ap0 to help make this work?

(Is there a better search than...

https://github.com/iiab/iiab/search?q=ansible_ap0

...to help shed light on these kinds of questions ?)

@holta
Copy link
Member

holta commented Apr 27, 2023

I don't know where Ansible best documents this. But Ansible evidently sets up a variable like ansible_eth0 for each network interface, e.g.:

root@box:~# ansible -m setup localhost | grep -A85 ansible_eth0 | pastebinit -b sprunge.us
[WARNING]: No inventory was parsed, only implicit localhost is available
( http://sprunge.us/G0YIUr?en )

Which I assume means that variable ansible_ap0 does not exist until... the next Ansible run after ap0 [*] is created?

[*] ap0 is the downstream hotspot interface side of... IIAB's bidirectional WiFi... i.e. when wifi_up_down: True is set.

@jvonau
Copy link
Contributor Author

jvonau commented Apr 27, 2023

Funny that search point right to the answer. Guess you forgot about #3389 (comment) where that discussion is documented.

@holta
Copy link
Member

holta commented Apr 27, 2023

Ok.

(Ansible docs are improving, but they're still not very searchable in cases like this.)

@holta holta merged commit 57bf481 into iiab:master Apr 27, 2023
@jvonau
Copy link
Contributor Author

jvonau commented Apr 27, 2023

Ref: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#vars-and-facts

@holta holta changed the title iiab-clone-wifi needs template from hostapd - record wifi_up_down iiab-clone-wifi needs template from hostapd - record wifi_up_down [& doc re: Ansible facts like ansible_ap0, ansible_eth0, ansible_wlan0] Apr 27, 2023
@jvonau jvonau deleted the hotfix branch April 28, 2023 00:56
@holta
Copy link
Member

holta commented Apr 28, 2023

@EMG70 worked hard to test this with a new install of SMALL-sized IIAB on 64-bit RasPiOS with Desktop, on RPi 400 — and asks if everything looks Ok below?

Does this mean 5GHz is partially working?
(i.e. is 2.4GHz perhaps no longer mandatory in some cases?)

1165 COMMAND: /usr/sbin/iw dev    # List wireless interfaces
1166 
1167 phy#0
1168 	Unnamed/non-netdev interface
1169 		wdev 0x3
1170 		addr e6:5f:01:0d:8f:7f
1171 		type P2P-device
1172 		txpower 31.00 dBm
1173 	Interface ap0
1174 		ifindex 4
1175 		wdev 0x2
1176 		addr 02:64:ce:eb:c5:6d
1177 		ssid Internet in a Box
1178 		type AP
1179 		channel 36 (5180 MHz), width: 80 MHz, center1: 5210 MHz
1180 		txpower 31.00 dBm
1181 	Interface wlan0
1182 		ifindex 3
1183 		wdev 0x1
1184 		addr e4:5f:01:0d:8f:7f
1185 		ssid SKY3C17E
1186 		type managed
1187 		channel 36 (5180 MHz), width: 80 MHz, center1: 5210 MHz
1188 		txpower 31.00 dBm

His iiab-diagnostics: http://sprunge.us/BtTyun?en

He writes:

Ethernet cable was removed after installation and connected RPI400 to SKY3C17E (home wifi)
Here are results.
I can connect to internet in a box hotspot and view iiab homepage OK

At first iiab-test-wifi had hostapd on different channel and message saying editing channel..
It changed on next display without doing any changes

If I hook up to Sky router, I can also connect to box directly via my dhcp enabled router

His screenshot:

IMG-20230428-WA0006

@holta
Copy link
Member

holta commented Apr 28, 2023

@EMG70 writes:

Just disabled 5GHz in router advanced menu

There is not really a function for disabling 5GHz but just disable syncing on the two channels.
Soon as I did that the 5GHz disappeared on my CLI tests

In short, he disabled both checkboxes, by the red below:

sky-router--39209148-873a-4988-883e-9f3a788cdb18

Then he ran iw dev (on the RPi 400) whose output is here:

iw-dev--ffa5e41a-fb51-4bdf-9fc3-3bf0d9f5a6cd

And he ran iiab-test-wifi whose output is here:

iiab-test-wifi--6f803e4b-bf9a-4722-96f6-b4dca7a66309

@holta holta changed the title iiab-clone-wifi needs template from hostapd - record wifi_up_down [& doc re: Ansible facts like ansible_ap0, ansible_eth0, ansible_wlan0] iiab-clone-wifi needs template from hostapd - record wifi_up_down [& doc re: Ansible facts like ansible_ap0, ansible_eth0, ansible_wlan0] [& 5GHz versus 2.4GHz test] Apr 28, 2023
@jvonau
Copy link
Contributor Author

jvonau commented Apr 28, 2023

I feel I keep repeating myself but the message gets lost somewhere. If you note in the picture of the router that there are different tabs at the top for 2.4/5GHz. I'll bet one can have a different ssid between 2.4/5GHz, change one to be able to tell the bands apart. I don't have time to get into details as I'm moving and may not have internet for awhile.

@jvonau
Copy link
Contributor Author

jvonau commented Apr 28, 2023

Carefully reread #3537 but be warned that RasPiOS doesn't offer the same band limiting feature as netplan does. The band blocking is done on netplan (I should of posted the generated /run/netplan/* file) by adding a list of frequencies (freq_list:) to the generated wpa_supplicant.conf file. See https://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf

@holta
Copy link
Member

holta commented Apr 28, 2023

I'll bet one can have a different ssid between 2.4/5GHz, change one to be able to tell the bands apart.

Indeed @EMG70 ran exactly that experiment over the past hour, renaming his home's 5GHz hotspot to "SKY3C17E-5G" for now.

And it worked, for some reason even despite the fact that he forgot to run iiab-hotspot-off before clicking on RasPiOS's WiFi-SSID-selecting wizard (risky, but the OS appears not to be damaged in this case!)

Finally, it seems he can choose either 2.4 GHz or 5 GHz (clicking on the graphical wizard to select one Upstream SSID or the other) as shown below, in this case with 5 GHz across both of the RPi 400's WiFi interfaces:

image

OBSERVATION: Channel 11 (as set in /etc/iiab/local_vars/yml) is entirely ignored above, but at least it works on Channel 36 as mandated by the home's router.

I'm moving

Good Luck with the move.

@jvonau
Copy link
Contributor Author

jvonau commented Apr 28, 2023

And it worked, for some reason even despite the fact that he forgot to run iiab-hotspot-off before clicking on RasPiOS's WiFi-SSID-selecting wizard (risky, but the OS appears not to be damaged in this case!)

That would be because of the 'hooks' that are installed within dhcpcd or networkd-dispatcher. Does more or less the same function as iiab-test-wifi but on the fly not just at boot.

Finally, it seems he can choose either 2.4 GHz or 5 GHz (by selecting one Upstream SSID or the other) as shown here with 5 GHz across both of the RPi 400's WiFi interfaces:

Good, now you can document how your home AP can (should?) be configured.

OBSERVATION: Channel 11 (as set in /etc/iiab/local_vars/yml) is entirely ignored above, but at least it works on Channel 36 as mandated by the home's router.

Same would hold true for country code.

@jvonau
Copy link
Contributor Author

jvonau commented Apr 28, 2023

Same would hold true for country code.

That would only apply for iiab-test-wifi run during boot, the hooks just deal with channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants