No DHCP response when connecting to WEP wifi - linux

I am unable to connect to WEP wifi on Linux (Mint): I get no DHCP offer.
My bash script (that I launch as root) does the following:
pkill dhclient
pkill wpa_supplicant #just in case
ip link set dev wlan0 down
ip addr flush dev wlan0
iwconfig wlan0 essid "MyWifi"
iwconfig wlan0 enc off
ip link set dev wlan0 up
dhclient -v wlan0
When I launch it, I get no DHCP offer:
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/e8:4e:06:24:b2:9e
Sending on LPF/wlan0/e8:4e:06:24:b2:9e
Sending on Socket/fallback
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11 (xid=0x17d23b2f)
...
Important:
I do not have NetworkManager (not running and removed - I saw that was a common issue) and I prefer to use command line.
When I scan for my wifi, I see it no problem:
sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 20:C9
[..]
Cell 02 - Address: 02:26:C6:2F:46:7E
Channel:9
Frequency:2.452 GHz (Channel 9)
Quality=54/70 Signal level=-56 dBm
Encryption key:off
ESSID:"MyWifi"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 48 Mb/s
54 Mb/s; 6 Mb/s; 9 Mb/s
Bit Rates:12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
Mode:Ad-Hoc
Extra:tsf=0000000001ed4e21
Extra: Last beacon: 32ms ago
IE: Unknown: 000B6950686F6E65204D795769
IE: Unknown: 010882848B96606C0C12
IE: Unknown: 030109
IE: Unknown: 06020000
IE: Unknown: 2A0100
IE: Unknown: 320418243048
I know that wifi works as I have other equipments connect to it
I know my wifi dongle works too as I manage to connect to other wifi (WPA).

Ok I found the solution. I was using mode 'managed' by default. But in the iwlist scan, it says 'ad-hoc':
Mode:Ad-Hoc
So, the correct script to connect to my Wifi is:
#!/bin/bash
pkill dhclient
pkill wpa_supplicant #just in case
ip link set dev wlan0 down
ip addr flush dev wlan0
iwconfig wlan0 essid "MyWifi"
iwconfig wlan0 enc off
iwconfig wlan0 key off
iwconfig wlan0 mode Ad-Hoc
ip link set dev wlan0 up
dhclient -v wlan0
and that works :)

Related

Odroidh2 Debian - Unable to ping network gateway / no network connectivity

I have an OdroidH2 with docker setup.
It was working fine for a few months and suddenly, out of nowhere it stopped having any internet/intranet connectivity.
It's connectivity is going through an Ethernet cable, not WiFi and the interface that is supposed to have the connection is enp3s0 with an ip address of 192.168.1.100.
I have performed the following troubleshooting steps:
Restart (of course, always the first step)
Checked interface settings via ifconfig and also in /etc/network/interfaces
Checked the routing via route -n
Checked iptables (iptables was populated with the docker configuration, I've flushed the iptables including nat and mangle and set the default policy to ACCEPT for input, forward and output. Restarted the networking service afterwards)
Checked if it was able to ping itself and the default gateway (it is able to ping itself but not the gateway, or any other devices)
Checked if another device was able to ping the OdroidH2 (host unreachable)
Checked dmesg and for some reason, I had 2 firmwares that were not able to be loaded (already installed and rebooted after installation):
rtl_nic/rtl8168g-2.fw (after checking, this is the firmware for the network interfaces)
i915/glk_dmc_ver1_04.bin (didn't research much about this one, something to do with runtime power management??)
After all of these steps, I still am unable to get the network connectivity going.
Below you can find information regarding my current configuration:
dmesg output
Stackoverflow does not allow me to put all the information from my dmesg output so I had to put it on google drive: dmesg_output
/etc/hosts
127.0.0.1 localhost
192.168.1.100 dc1 dc1.samdom.andrewoliverhome.local samdom.andrewoliverhome.local
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
iptables -nvL output (after clearing and reloading the networking service)
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
/etc/resolv.conf
#nameserver 127.0.0.1
#nameserver 8.8.8.8
#nameserver 8.8.4.4
search samdom.andrewoliverhome.local
#domain samdom.andrewoliverhome.local
nameserver 192.168.1.100
nameserver 8.8.8.8
route -n output
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 enp3s0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker_gwbridge
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-debc10cb5b21
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp3s0
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo enp2s0 enp3s0
#auto lo br0
iface lo inet loopback
# The primary network interface
iface enp2s0 inet dhcp
allow-hotplug enp2s0 enp3s0
#iface enp2s0 inet manual
# post-up iptables-restore < /etc/iptables.up.rules
# This is an autoconfigured IPv6 interface
#iface enp2s0 inet dhcp
iface enp3s0 inet static
address 192.168.1.100
netmask 255.255.255.0
# broadcast 169.254.99.255
network 192.168.1.0
gateway 192.168.1.254
#iface enp2s0 inet manual
#iface enp3s0 inet manual
#iface br0 inet static
# bridge_ports enp2s0 enp3s0
# address 192.168.1.100
# broadcast 192.168.1.255
# netmask 255.255.255.0
# gateway 192.168.1.254
#
In /etc/resolv.conf, the reason I have the primary nameserver to be itself is because I am running a docker container that is serving as a samba-ad-dc.
In order for OdroidH2 to find all of my devices in the domain, it needs to make dns queries to the samba dc, if samba is not able to find a dns record, it will autoforward it to 8.8.8.8.
Any help would be greatly appreciated (:
After all the troubleshooting done, the issue is not within the OdroidH2 itself, it was with my router.
The LAN port that I'm using malfunctioned. I switched the Ethernet cable to a different LAN port and it worked.

Tunnel Gre problem between two hosts (vps and dedicated server)

Hello guys i need to resolve this problem (all server have installed centos 7): i'm trying to create a gre tunnel through vps (in Italy - OpenVZ) and a dedicated server (in Germany), but they do not communicate internally (ping and ssh command tests). Next i create a gre tunnel trought vps (in Italy - OpenVZ) and vps (in France - KVM OpenStack) and their communicate, i next i had create a tunnel trought vps (in France - KVM OpenStack) and a dedicated server (in Germany) their communicate. I can not understand why the vps (in Italy - OpenVZ) and the dedicated server (in Germany) do not communicate, ideas on how I can fix (
I also tried with iptables disabled, firewalld is not enable)? Thanks
In other words:
In other attempts (by this i mean that i managed to successfully create the GRE Tunnel between these machines):
The VPS (in France) and VPS (in Italy) communicate internally (ping and ssh command tests)
The VPS (in France) and Dedicated Server (in Germany) communicate internally (ping and ssh command tests)
Problem (by this i mean that i could not successfully create the GRE Tunnel between these machines):
The VPS (in Italy) and Dedicated Server (in Germany) do not communicate internally (ping and ssh command tests). I also asked hosting services if they had any restrinzione but nothing.
My configuration:
VPS command for tunnel:
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
iptunnel add gre1 mode gre local VPS_IP remote DEDICATED_SERVER_IP ttl 255
ip addr add 192.168.168.1/30 dev gre1 ip link set gre1 up
Dedicated server command for tunnel:
iptunnel add gre1 mode gre local DEDICATED_SERVER_IP remote VPS_IP ttl 255
ip addr add 192.168.168.2/30 dev gre1
ip link set gre1 up
[root#VPS ~]# ping 192.168.168.2
PING 192.168.168.2 (192.168.168.2) 56(84) bytes of data.
^C
--- 192.168.168.2 ping statistics ---
89 packets transmitted, 0 received, 100% packet loss, time 87999ms
[root#DE ~]# ping 192.168.168.1
PING 192.168.168.1 (192.168.168.1) 56(84) bytes of data.
^C
--- 192.168.168.1 ping statistics ---
92 packets transmitted, 0 received, 100% packet loss, time 91001ms
[root#VPS ~]# tcpdump -i venet0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes ^C 0 packets captured 1 packet received by filter 0 packets dropped by kernel
[root#DE ~]# tcpdump -i enp2s0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on enp2s0, link-type EN10MB (Ethernet), capture size 262144 bytes ^C 0 packets captured 0 packets received by filter 0 packets dropped by kernel
[root#VPS ~]# lsmod | grep gre
ip_gre 4242 -2
ip_tunnel 4242 -2 sit,ip_gre
gre 4242 -2 ip_gre
[root#DE ~]# lsmod | grep gre
ip_gre 22707 0
ip_tunnel 25163 1 ip_gre
gre 13144 1 ip_gre
Console image with full command output
If ip_forwarding is required for the tunnel to work, you need to do /sbin/sysctl -p
And what does the output of ip tunnel show and ip route show on both the ends

Linux WiFI AP : refresh `iw dev wlan0 station dump` output (inactive time)

I have a Linux (3.14.36) embedded board acting as a WiFi AP.
The WiFi chipset doesn't support monitoring mode.
My laptop(the client) is connected to this board by WiFi
The WiFi AP is acting as a network bridge to another computer, and doesn't provide an IP adress to the client (the WiFi AP only has the MAC address of the client)
I want to monitor the signal strengh of the connection WiFi AP <-> Client and be able to trigger a "refresh" of the signal strengh value.
Doing : iw dev wlan0 station dump gives me :
Station xx:xx:xx:xx:xx:xx (on wlan0)
inactive time: 123820 ms // <-- The problem
rx bytes: 10291
rx packets: 60
...
signal: -65 dBm // What I want to refresh
...
I understood that the signal strengh is updated every time there is a network activity. (So, in the example above, it has been refreshed 123s ago).
How can I force a refresh of this value ? (By forcing the AP to send "something" to the client for example) Knowing that the board/WiFi driver/WiFi device doesn't support tools such as iwconfig
For anyone finding this thread now:
I had this issue and my solution was to ping the device before doing the iw dump, e.g.
Get the list of of connected MAC addresses:
iw dev wlan0 station dump | grep 'signal' | awk '{print $2}'
Then get the IP address from these MAC addresses (alternatively you could use arp):
ip neigh | grep 'ma:ca:dd:re:ss:ss' | awk '{print $1}'
Then ping each of those:
ping -c 1 'IP.address'
Then get the refreshed signal for that MAC address
iw dev wlan0 station get 'ma:ca:dd:re:ss:ss' | grep 'signal' | awk '{print $2}'
I wrapped all this up in a Python script and it seemed to give reliable data.
I'll give it a try:
You're embedded so I guess you have busybox. You have no IP but you may then use arping (if this applet is not configured in your busybox build, change the config) to send something small and useless that may wake up the thing. What IP to use for your ARP requests? Well it seems you can use a "dummy" IP.
I'm running this on a PC but I do have busybox with its arping, and I use a wired interface, but here is the concept:
jbm#sumo:~/sandbox/iw$ sudo busybox arping -w 1 -U -I eth0 0.0.0.0
ARPING to 0.0.0.0 from 192.168.1.66 via eth0
Sent 2 probe(s) (2 broadcast(s))
Received 0 reply (0 request(s), 0 broadcast(s))
The useful thing is that though the "dummy" IP, I can check with tcpdump that the arp requests do actually go on the wire (or in the air in your case):
jbm#sumo:~$ sudo tcpdump -i eth0 -v arp
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
10:42:20.111100 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 0.0.0.0 (Broadcast) tell sumo, length 28
10:42:21.111206 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 0.0.0.0 (Broadcast) tell sumo, length 28
^C
2 packets captured
2 packets received by filter
0 packets dropped by kernel
So sending ARP request on your wireless interface may be enough to "wake up" your connection and refresh your RSSI.
EDIT:
See the interesting uses and properties of IP 0.0.0.0 here:
https://en.wikipedia.org/wiki/0.0.0.0
EDIT 2:
Re-thinking about it, I realized there will be a problem if your wireless interface does not have an IP itself. Which, if I'm not mistaking, may not necessarily be case in your bridging configuration. In such case, arping will not have a source address to build its request packets (nor will know how to listen for responses), and will fail.
But you can create your own "mini-unidirectional arping", using an AF_PACKET socket and build your own ARP request packet with a dummy/random source IP address. It will be unidirectional because the response to your forged ARP request, if any, would go to to the random source IP which may and preferably should not exist. But it the principle of just awaking your wireless connection by sending "something", that may do the trick.
For inspiration on how to code this "mini-unidirectional arping", have a look at busybox implementation from its udhcpc/udhcpd (it's simpler than the full-blown arping busybox applet):
https://git.busybox.net/busybox/tree/networking/udhcp/arpping.c#n38
The from_ip parameter is what you want to forge. You can use your actual MAC as from_mac, just for the sake of dignity :-) You don't even have to wait for a response (starting line 89), so that would be something like 50 lines of C code + a little main if you want to add a few options to it.

How can I check whether a subnet IPv4 address is unused while IPv4 is switched off?

I've found sources that suggest how I can find whether an IP address is available using ping, arping and nmap, but all of these solutions fail when IPv4 is switched off. I'd like to find a way of automatically detecting whether an IPv4 address is available before assigning it to a new machine that does not have an IPv4 address. For example,
$ sudo arping 192.168.2.205
ARPING 192.168.2.205
60 bytes from 00:50:56:91:a5:0d (192.168.2.205): index=0 time=730.931 msec
60 bytes from 00:50:56:91:a5:0d (192.168.2.205): index=1 time=362.976 msec
60 bytes from 00:50:56:91:a5:0d (192.168.2.205): index=2 time=730.205 msec
^C
--- 192.168.2.205 statistics ---
4 packets transmitted, 3 packets received, 25% unanswered (0 extra)
$ sudo ifconfig eth0 0.0.0.0
$ sudo arping 192.168.2.205
arping: Unable to automatically find interface to use. Is it on the local LAN?
arping: Use -i to manually specify interface. Guessing interface eth0.
arping: Unable to get the IPv4 address of interface eth0:
arping: libnet_get_ipaddr4(): ioctl(): Cannot assign requested address
arping: Use -S to specify address manually.
Is there a way to achieve this?

Raspberry Pi ad-hoc networking

I want to try some networking projects with Raspberry Pis, and I need to just send packets between a pair of pis. I would be happy as a first step just being able to ping between to Raspberry Pis in ad-hoc mode. I have not successfully done this despite looking at several tutorials and examples online.
I have 2x Raspberry Pis with the Debian Wheezy OS installed. I am using the following USB adapter which I installed firmware for on both pis and tested that they work by connected them in managed mode to a router:
Bus 001 Device 004: ID 050d:945a Belkin Components F7D1101 v1 Basic Wireless Adapter [Realtek RTL8188SU]
Here are is some printouts about the networking information:
/etc/network/interfaces at each pi:
pi1#raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet manual
address 192.168.2.1
netmask 255.255.255.0
wireless-channel 4
wireless-essid pi-ad-hoc
wireless-mode ad-hoc
pi2#raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet manual
address 192.168.2.2
netmask 255.255.255.0
wireless-channel 4
wireless-essid pi-ad-hoc
wireless-mode ad-hoc
ifconfig at each pi:
pi1#raspberrypi ~ $ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr ec:1a:59:46:8e:5a
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:26 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
pi2#raspberrypi ~ $ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr ec:1a:59:46:59:0a
inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:6 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
iwconfig at each pi:
pi1#raspberrypi ~ $ iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"pi-ad-hoc" Nickname:"rtl_wifi"
Mode:Ad-Hoc Cell: 02:11:87:FA:4A:02 Bit Rate:54 Mb/s
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
pi2#raspberrypi ~ $ iwconfig wlan0
wlan0 IEEE 802.11bg ESSID:"pi-ad-hoc" Nickname:"rtl_wifi"
Mode:Ad-Hoc Cell: 02:11:87:C4:F2:01 Bit Rate:54 Mb/s
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
route at one pi (identical on other pi):
pi1#raspberrypi ~ $ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
192.168.2.0 * 255.255.255.0 U 0 0 0 wlan0
iwlist scan at each pi:
pi1#raspberrypi ~ $ sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 02:11:87:FA:4A:02
ESSID:"pi-ad-hoc"
Protocol:IEEE 802.11bg
Mode:Ad-Hoc
Frequency:2.427 GHz (Channel 4)
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Quality:0 Signal level:0 Noise level:0
Cell 04 - Address: 02:11:87:C4:F2:01
ESSID:"pi-ad-hoc"
Protocol:IEEE 802.11bg
Mode:Ad-Hoc
Frequency:2.427 GHz (Channel 4)
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Signal level=100/100
pi2#raspberrypi ~ $ sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 02:11:87:C4:F2:01
ESSID:"pi-ad-hoc"
Protocol:IEEE 802.11bg
Mode:Ad-Hoc
Frequency:2.427 GHz (Channel 4)
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Quality:0 Signal level:0 Noise level:0
Cell 02 - Address: 02:11:87:FA:4A:02
ESSID:"pi-ad-hoc"
Protocol:IEEE 802.11bg
Mode:Ad-Hoc
Frequency:2.427 GHz (Channel 4)
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Signal level=100/100
Ping does not work, and no networking seems to work between them. From iwconfig, you can see that they each have a different "Cell" address (not the same Cell as in the iwlist scan) which is the pseudo-base station ID that is used to define an ad-hoc network (my best understanding from what I've read). Also, from the iwlist, each pi can see their own plus the other pi's ad-hoc network. I assume they need to select the same Cell id to communicate, and I'm unsure how to get them to do this automatically. I tried statically forcing these to be the same with the following command at each pi which did not change the cell id and therefore did not work:
sudo iwconfig wlan0 ap (some address)
I also tried a solution which uses ap_scan=2 in the wpa_supplicant config which did not seem to help.
Anyone have any idea what I've done wrong?
Thanks,
Andy.
After some searching I found that the Belkin USB adapter I was using apparently didn't have ad-hoc mode support with the linux drivers. I bought some other wireless USB adapaters that worked great "Edimax EW-7811Un 150 Mbps Wireless 11n Nano Size USB Adapter". They are cheaper, smaller, and they worked in ad-hoc mode without even needing to worry drivers. The details I put for troubleshooting can be used as a guide if you are also wanting to do ad-hoc raspberry PI projects.
This works for me in /etc/network/interfaces:
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wireless-essid "MYPINET"
wireless-channel 3
wireless-mode ad-hoc
wireless-ap 11:5F:02:38:5C:45
address 192.168.10.1
netmask 255.255.255.0
The essid, channel and ap can be any valid value (same on all your Pi's). Make sure to assign different addresses on the same subnet to your different Pi's and you should be fine. The ap defines the cell ID that was mentioned above. FWIW I am using a TP-link WN725N. It has the RTL8188CUS chipset and works fine out of the box even though dmesg indicates the Pi is treating it as an RTL8192.
I was unsuccessful with any adapter using the RTL8188CUS chipset. Luckily, I had a number of Ralink RT5370 dongles (from this kit) that support the nl80211 interface and ad-hoc mode.
My solution involves using wpa_supplicant and is configured with 2 files. Ensure that the nl80211 driver is installed:
sudo apt-get install libnl1
Next, create the following wpa_supplicant configuration file called /etc/wpa_supplicant-adhoc.conf on each Pi:
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
ap_scan=2
network={
ssid="pihoc_wpa"
mode=1
frequency=2462
proto=WPA
key_mgmt=WPA-NONE
pairwise=NONE
group=TKIP
psk="password"
}
where you can choose the ssid, frequency (look here for valid values), and psk. Make sure that you are part of the user group net-dev using the command
getent group netdev
and if not, you can add yourself using
sudo usermod -a -G netdev userName
Next, add the following block to the /etc/network/interfaces file on each Pi:
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 10.10.2.1
netmask 255.255.255.0
pre-up wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant-adhoc.conf
where each Pi has a different address field beginning with 10.10.2.. Also, if your RT5370 adapter is using an interface other than wlan0 (e.g. wlan1, wlan2, etc.), be sure to use that interface name instead.
At this point, the Pis should automatically join the network upon being rebooted. Test the connection by pinging or using ssh, for example run the following from the agent with IP address 10.10.2.1:
ssh 10.10.2.2
to access the agent with IP address 10.10.2.2.
The steps listed here are adapted from this Arch Linux wiki article and this Raspberry Pi forum discussion.

Resources