Difference between revisions of "Connecting to the Pi"
(+newer laptops info) |
(add missing step) |
||
Line 28: | Line 28: | ||
iw dev wlp4s0 set type ibss | iw dev wlp4s0 set type ibss | ||
+ | |||
+ | And bring the interface up: | ||
+ | |||
+ | ip link set wlp4s0 up | ||
After that, join the ad-hoc network. '''Replace ''FREQUENCY''''' with an actual frequency. Choose the frequency from [https://en.wikipedia.org/wiki/List_of_WLAN_channels#2.4_GHz_(802.11b/g/n/ax) this table]. You'll probably use 2.4 GHz (802.11b/g/n/ax) channels 1 or 2, which are 2412 and 2417 MHz respectively, so you would replace ''FREQUENCY'' with <code>2412</code> or <code>2417</code>. | After that, join the ad-hoc network. '''Replace ''FREQUENCY''''' with an actual frequency. Choose the frequency from [https://en.wikipedia.org/wiki/List_of_WLAN_channels#2.4_GHz_(802.11b/g/n/ax) this table]. You'll probably use 2.4 GHz (802.11b/g/n/ax) channels 1 or 2, which are 2412 and 2417 MHz respectively, so you would replace ''FREQUENCY'' with <code>2412</code> or <code>2417</code>. |
Revision as of 21:27, 2 April 2019
Here's how to connect to the Pi.
Contents
Ad hoc
OS X
Connect to RPiwireless from the WiFi dropdown menu, then ssh pi@192.168.1.1
. Doesn't work? Try arp -a
at a terminal. If an IP address associated with the hostname pehuen-pi
[1] comes up, use that in the SSH command instead. Otherwise, keep trying 192.168.1.1 (192.168.2.2 sometimes works).
Dylan's laptop
Disconnect from all WiFi networks. Open the program Windows Powershell from the Start menu. In the terminal that appears, run netsh wlan connect RPiwireless
.
If that worked, the laptop should now be connected to RPiwireless, and complain about no Internet access. This is sensible, since the Pi doesn't have any other way to connect to the Internet.
You may now use an SSH client (either PuTTY or MobaXterm) to connect to pi@192.168.1.1. Not sure which one to use? MobaXterm is easier; open the program using the shortcut on the desktop, then click "New Session", select "SSH", enter 192.168.1.1 as the IP and pi
as the username, then connect.
Arch Linux
These instructions will use the tools ip and iw. Make sure you have them installed before proceeding. Also, you might have to do some of these commands with sudo.
Helpful background information: the Arch Wiki's articles on wireless network configuration and ad-hoc networking.
First, make sure your network interface (i.e. network card) doesn't have anything running on it. In the examples below, dev wlp4s0
is used as the name of the interface. If your interface name is different (get the interface name with iw dev
, and it'll be after the word "Interface"), replace as necessary. If you use netctl, the following command will stop the current connection:
netctl stop $(netctl list | grep '^\*' | cut -d'*' -f2)
Now, while your interface is down, change it over to IBSS (the type for ad-hoc data):
iw dev wlp4s0 set type ibss
And bring the interface up:
ip link set wlp4s0 up
After that, join the ad-hoc network. Replace FREQUENCY with an actual frequency. Choose the frequency from this table. You'll probably use 2.4 GHz (802.11b/g/n/ax) channels 1 or 2, which are 2412 and 2417 MHz respectively, so you would replace FREQUENCY with 2412
or 2417
.
iw dev wlp4s0 ibss join RPiwireless FREQUENCY
Now, register an IP address: (I haven't figured out if this next command is strictly necessary)
ip addr add 192.168.1.2/255.255.255.0 dev wlp4s0
And try to connect: (you may have to wait a minute or so before this starts working)
ssh pi@192.168.1.1
The username (the pi@
part) is important because otherwise ssh may try to use your current username, which will almost certainly not be pi
).
Warning! The ssh connection produced by this method is almost unusably slow at times. I (Daniel, April 2019) am trying to fix this. I hypothesize you may be able to switch the channel on the Pi side (by editing the "channel" specified in /etc/network/interfaces
) to avoid interference.
Windows 10, newer laptops
First, open Powershell and run netsh wlan show wirelesscapabilities
, then look for a line that says "IBSS". It'll either say "Supported" or "Not Supported".
If it says "Not Supported", your current driver doesn't support ad-hoc networks. Microsoft has deprecated ad-hoc IBSS, which is a fancy name for ad-hoc networks of the type discussed on this page. So, you'll need an old driver that supports ad-hoc IBSS, as well as the hardware to run it on. I don't think newer laptops support this. For more information on which hardware supports this, Intel has a list. (Check which network device you have by going to Device Manager, selecting "Devices by type" under the "View" menu, and looking for something that looks like it should be a wireless adapter.) For a potential workaround, see this Super User answer.
If you end up with IBSS being supported, you'll want to open network settings, open the Wi-Fi menu, click "Manage known networks", and then "Add a new network". Enter RPiwireless for the name, keep the security as "Open", and leave both checkboxes unchecked. Now, in Powershell:
netsh wlan set profileparameter RPiwireless connectiontype=ibss
It might give you this error:
Failed to modify the profile. Error 0x8000D: The BSS type is not valid.
In which case your hardware and/or driver doesn't support ad-hoc IBSS.
If it worked, though, you can connect to the Pi's network using:
netsh wlan connect RPiwireless
Now, the Pi doesn't have DHCP, so you'll need to assign it an IP manually. Try DHCPwiz. After that, DHCPwiz will give you an IP address, and then you can use PuTTY or MobaXterm to connect to pi@
the Pi's IP address.
Notes/references
- ↑ Pehuen Moure was on the team in (at least) 2017