[Wylug-help] peer to peer wifi programming

Yiannis Gatsoulis menig at leeds.ac.uk
Thu Jul 20 17:06:36 BST 2006


simon wrote:
> On Thu, Jul 20, 2006 at 11:31:26AM +0100, Yiannis Gatsoulis wrote:
>   
>> You are right, apologies for not mentioning that. What I ve done (which 
>> seems to be working now) is that (using the gnome network settings 
>> dialog) I am assigning a static IP leaving blank the ESSID field. 
>> Activating the interface and changing the mode to ad-hoc. Both in the 
>> client and the server. After a while an iwconfig gives me that ESSID is 
>> something like Private Interferometer Network.... A quick google did not 
>> yield any results.... so I am guessing that the machines in ad-hoc  mode 
>> create a network between them.
>>
>>     
>
> Hi (again),
>   
Hello, apologies but I have to post back..... as I think I am doing 
something wrong in the process.... since it does not work all the 
time.... Let me explain what I ve done..... and let's say I leave the 
graphical tools for now..... (except from setting the static IP as I 
dont know for now how this is done from the terminal).
There are two PCs both running ubuntu (or ubuntu variations, eg. 
XUbuntu), and let me call them pc1 and pc2 and their wifi cards are 
eth1. The two pcs are within the Uni of Leeds wireless network.

PC1:

/sbin/ifdown eth1
/sbin/iwconfig eth1 essid off channel 0 mode ad-hoc
/sbin/ifup eth1

PC2:
/sbin/ifdown eth1
/sbin/iwconfig eth1 essid off channel 0 mode ad-hoc
/sbin/ifup eth1

Now running the server-program on  one side and then the client on the 
other it fails with an error message "no route to host". HOWEVER, 
sometimes the two pcs all of the sudden appear an essid name which is 
not one of the wireless routers in my school. Something completely 
different like "chen", "private inter....", "foo bar" or something. But 
then the client is able to connect to the server.... So I thought that 
that would be the virtual network created by the two pcs..... but I have 
a feeling I am wrong.....

> Yes your understanding on ad-hoc networks is correct, they agree that
> one will act as a master. When this one moves out of range, the
> remaining renegoiate for the role.
>   
Thanks, in fact I think the same is under win xp if I recall well. One 
machine creates a virtual network where others can connect. Coming back 
to the problem though and considering the above.... you say that one 
will act as the master.... do I need to set the mode of both cards to 
ad-hoc to do so or it needs a bit encouregement? Trying setting one to 
master fails with error:
$ /sbin/iwconfig eth1 mode Master
Error for wireless request "Set Mode" (8B06) :
    SET failed on device eth1 ; Invalid argument.

> One gotcha that you need to look out for is BSSID. When 2 machines
> ad-hoc together the agree on a BSSID (in addition to the prescribed
> ESSID), normally the MAC address of whichever takes the role of master.
>
> [BSSID shows up a 'Cell' in iwconfig.]
>
> If you have 2 sets of 2 machines they can agree on different BSSID's and
> even when they move close enough together they still can't see everyone as
> the different BSSID's - which ad-hoc netorking treats as seperate
> networks.
>
> The solution seems to be to set a BSSID on all of your machines, this
> way they'll all be able to talk.
>   
Now you got me lost, but maybe actually pointing the error.....
Here is a typical output of iwconfig when things do NOT work:

eth1      unassociated  ESSID:off/any
          Mode:Ad-Hoc  Channel=0  Cell: Not-Associated
          Bit Rate=0 kb/s   Tx-Power=20 dBm   Sensitivity=8/0
          Retry limit:7   RTS thr:off   Fragment thr:off
          Encryption key: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

and ifconfig output for that is:
eth1      Link encap:Ethernet  HWaddr 00:0E:35:51:4B:BA
          inet addr:192.168.21.1  Bcast:192.168.21.255  Mask:255.255.255.0
          inet6 addr: fe80::20e:35ff:fe51:4bba/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:229 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1694800 (1.6 MiB)  TX bytes:201032 (196.3 KiB)
          Interrupt:7 Base address:0x6000 Memory:ff6fd000-ff6fdfff

and output of route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use 
Iface
192.168.21.0    *               255.255.255.0   U     0      0        0 eth1


That is from PC1. For PC2 I cannot provide an output unfortunately now, 
but it is on the same lines (I guess different MAC address, IP 
"192.168.21.2", etc.).

To be honest I don't have a clue what bssid is and don't know how to set 
it. Googling gives me evidences that it should be iwconfig eth1 ap 
"bssid number in some kind of format, ip address?". Wiki says that bssid is:

*BSSID* - *B*asic *S*ervice *S*et *ID*entifier. The IEEE 802.11 
<http://en.wikipedia.org/wiki/IEEE_802.11>-1999 Wireless Lan 
specification defines a BSSID as the MAC address 
<http://en.wikipedia.org/wiki/MAC_address> of the Station (STA 
<http://en.wikipedia.org/wiki/STA>) in an Access Point 
<http://en.wikipedia.org/wiki/Access_Point> (AP) in an infrastructure 
mode BSS <http://en.wikipedia.org/wiki/Basic_Service_Set>. This field 
uniquely identifies each BSS.

In an IBSS <http://en.wikipedia.org/wiki/IBSS>, the *BSSID* is a locally 
administered IEEE <http://en.wikipedia.org/wiki/IEEE> MAC address 
<http://en.wikipedia.org/wiki/MAC_address> generated from a 48-bit 
random number. The individual/group bit of the address is set to 0. The 
universal/local bit of the address is set to 1.

A *BSSID* with a value of all 1s is used to indicate the broadcast 
*BSSID*. A broadcast *BSSID* may only be used during probe requests.

-----

But on another article of ssid from wiki:

In Wi-Fi <http://en.wikipedia.org/wiki/Wi-Fi> Wireless LAN 
<http://en.wikipedia.org/wiki/Wireless_LAN> computer networking 
<http://en.wikipedia.org/wiki/Computer_network>, a *service set 
identifier* (*SSID*) is a code attached to all packets on a wireless 
network <http://en.wikipedia.org/wiki/Wireless_network> to identify each 
packet as part of that network. The code consists of a maximum of 32 
alphanumeric <http://en.wikipedia.org/wiki/Alphanumeric> characters 
<http://en.wikipedia.org/wiki/Character_%28computing%29>. All wireless 
devices attempting to communicate with each other must share the same 
SSID. Apart from identifying each packet, SSID also serves to uniquely 
identify a group of wireless network devices used in a given "Service Set".

There are two major variants of the SSID.

    * Ad-hoc wireless networks (IBSS
      <http://en.wikipedia.org/wiki/IBSS>) that consist of client
      machines without an access point use the *IBSS ID* (Independent
      Basic Service Set Identifier);
    * whereas on an infrastructure network which includes an access
      point (BSS <http://en.wikipedia.org/wiki/Basic_Service_Set>) or
      possibly an (ESS
      <http://en.wikipedia.org/wiki/Extended_Service_Set>), the *BSS ID*
      or *ESS ID* (E for Extended) is used instead.

----
So I am more confused :) I hope with this info it might obvious to you 
what I am doing wrong and point me in the right direction.

> As noted in my other email, if you're thinking of more that 2 mobile nodes
> on the net you might be interested in OLSR (meshing protocol).
>   
Two will do...... no need to control more than one robots at the same 
time from the same station for now.... :P
> Simon.
>   
Yianni



More information about the Wylug-help mailing list