Ad-Hoc Wi-Fi Network Setup

Volkan YAZICI's picture

Forums: 

Hi,

I'm trying to setup an ad-hoc Wi-Fi network, but having trouble to get
it working. Below are the steps I follow.

foo# iwconfig wlan0 mode ad-hoc chan 11 essid inci
foo# ifconfig wlan0 192.168.1.1

bar# iwconfig wlan0 mode ad-hoc chan 11 essid inci
bar# ifconfig wlan0 192.168.1.2
bar# ping 192.168.1.1 -I wlan0

But ping fails miserably. What might I be missing? (See the detailed
command outputs in the attachment.)

Best.

------------------------------------------------------------------------

foo# lspci | grep Atheros
07:04.0 Network controller: Atheros Communications Inc. AR922X Wireless Network Adapter (rev 01)

foo# iwconfig wlan0 mode ad-hoc chan 11 essid inci
foo# iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"inci"
Mode:Ad-Hoc Frequency:2.462 GHz Cell: E6:65:50:32:B9:13
Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

foo# ifconfig wlan0 192.168.1.1
foo# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 94:0c:6d:ea:c2:4b
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::960c:6dff:feea:c24b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 Dirol TX bytes:9688 (9.6 KB)

bar# lspci | grep Atheros
07:04.0 Network controller: Atheros Communications Inc. AR922X Wireless Network Adapter (rev 01)

bar# iwconfig wlan0 mode ad-hoc chan 11 essid inci
bar# iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"inci"
Mode:Ad-Hoc Frequency:2.462 GHz Cell: Not-Associated
Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

bar# ifconfig wlan0 192.168.1.2
bar# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 94:0c:6d:ea:b5:a4
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 Dirol TX bytes:4434 (4.4 KB)

------------------------------------------------------------------------

Ad-Hoc Wi-Fi Network Setup

Camaleón's picture

On Fri, 27 May 2011 17:44:36 +0300, Volkan YAZICI wrote:

> I'm trying to setup an ad-hoc Wi-Fi network, but having trouble to get
> it working. Below are the steps I follow.
>
> foo# iwconfig wlan0 mode ad-hoc chan 11 essid inci
> foo# ifconfig wlan0 192.168.1.1
>
> bar# iwconfig wlan0 mode ad-hoc chan 11 essid inci
> bar# ifconfig wlan0 192.168.1.2
> bar# ping 192.168.1.1 -I wlan0
>
> But ping fails miserably. What might I be missing? (See the detailed
> command outputs in the attachment.)

(...)

Just in case, I would follow these steps:

http://wiki.debian.org/WiFi/AdHoc#Manual_Method

Greetings,

Ad-Hoc Wi-Fi Network Setup

Volkan YAZICI's picture

On Fri, 27 May 2011 15:49:39 +0000 (UTC), Camaleón writes:
> On Fri, 27 May 2011 17:44:36 +0300, Volkan YAZICI wrote:
>
>> I'm trying to setup an ad-hoc Wi-Fi network, but having trouble to get
>> it working. Below are the steps I follow.
>>
>> foo# iwconfig wlan0 mode ad-hoc chan 11 essid inci
>> foo# ifconfig wlan0 192.168.1.1
>>
>> bar# iwconfig wlan0 mode ad-hoc chan 11 essid inci
>> bar# ifconfig wlan0 192.168.1.2
>> bar# ping 192.168.1.1 -I wlan0
>>
>> But ping fails miserably. What might I be missing? (See the detailed
>> command outputs in the attachment.)
>
> (...)
>
> Just in case, I would follow these steps:
>
> http://wiki.debian.org/WiFi/AdHoc#Manual_Method

As far as I checked, they are exactly the same steps.

Best.

Ad-Hoc Wi-Fi Network Setup

Camaleón's picture

On Fri, 27 May 2011 19:17:06 +0300, Volkan YAZICI wrote:

> On Fri, 27 May 2011 15:49:39 +0000 (UTC), Camaleón writes:
>> On Fri, 27 May 2011 17:44:36 +0300, Volkan YAZICI wrote:
>>
>>> I'm trying to setup an ad-hoc Wi-Fi network, but having trouble to get
>>> it working. Below are the steps I follow.
>>>
>>> foo# iwconfig wlan0 mode ad-hoc chan 11 essid inci foo# ifconfig
>>> wlan0 192.168.1.1
>>>
>>> bar# iwconfig wlan0 mode ad-hoc chan 11 essid inci bar# ifconfig
>>> wlan0 192.168.1.2
>>> bar# ping 192.168.1.1 -I wlan0
>>>
>>> But ping fails miserably. What might I be missing? (See the detailed
>>> command outputs in the attachment.)
>>
>> (...)
>>
>> Just in case, I would follow these steps:
>>
>> http://wiki.debian.org/WiFi/AdHoc#Manual_Method
>
> As far as I checked, they are exactly the same steps.

It can be trivial but did you also restart the "wlan0" interfaces?

Greetings,

Ad-Hoc Wi-Fi Network Setup

Volkan YAZICI's picture

On Fri, 27 May 2011 16:40:48 +0000 (UTC), Camaleón writes:
> It can be trivial but did you also restart the "wlan0" interfaces?

While I was issuing iwconfig commands, wlan0 was already set down; after
iwconfig I waked up the wlan0 via ifconfig. What do you mean by
restarting an interface?

Best.

Ad-Hoc Wi-Fi Network Setup

Camaleón's picture

On Fri, 27 May 2011 19:51:59 +0300, Volkan YAZICI wrote:

> On Fri, 27 May 2011 16:40:48 +0000 (UTC), Camaleón writes:
>> It can be trivial but did you also restart the "wlan0" interfaces?
>
> While I was issuing iwconfig commands, wlan0 was already set down; after
> iwconfig I waked up the wlan0 via ifconfig. What do you mean by
> restarting an interface?

"ifdown/ifup" and maybe "/etc/init.d/networking restart" just to be
sure Smile

Greetings,

Ad-Hoc Wi-Fi Network Setup

Volkan YAZICI's picture

On Fri, 27 May 2011 16:56:39 +0000 (UTC), Camaleón writes:
> "ifdown/ifup" and maybe "/etc/init.d/networking restart" just to be
> sure Smile

My /etc/network/interfaces is empty, but loopback device. I'm just
issuing plain old ifconfig, and IMHO it should be working. I need to
find a way to get more details about the problem, about why it doesn't
work.

Best.

Ad-Hoc Wi-Fi Network Setup

William Hopkins's picture

On 05/27/11 at 08:03pm, Volkan YAZICI wrote:
> On Fri, 27 May 2011 16:56:39 +0000 (UTC), Camaleón writes:
> > "ifdown/ifup" and maybe "/etc/init.d/networking restart" just to be
> > sure Smile
>
> My /etc/network/interfaces is empty, but loopback device. I'm just
> issuing plain old ifconfig, and IMHO it should be working. I need to
> find a way to get more details about the problem, about why it doesn't
> work.

I agree. It's best to start with ifconfig/iwconfig anyway.
When you set 'foo' to ad-hoc, can you scan from 'bar' and see it?

Ad-Hoc Wi-Fi Network Setup

Volkan YAZICI's picture

On Mon, 30 May 2011 03:13:16 -0400, William Hopkins writes:
> On 05/27/11 at 08:03pm, Volkan YAZICI wrote:
>> On Fri, 27 May 2011 16:56:39 +0000 (UTC), Camaleón writes:
>> > "ifdown/ifup" and maybe "/etc/init.d/networking restart" just to be
>> > sure Smile
>>
>> My /etc/network/interfaces is empty, but loopback device. I'm just
>> issuing plain old ifconfig, and IMHO it should be working. I need to
>> find a way to get more details about the problem, about why it doesn't
>> work.
>
> I agree. It's best to start with ifconfig/iwconfig anyway.
> When you set 'foo' to ad-hoc, can you scan from 'bar' and see it?

Below are the latest diagnostics.

1) I configure 1st machine as follows.

# iwconfig wlan0 mode ad-hoc chan 1 essid foo
# ifconfig wlan0 192.168.1.1"

"dmesg | tail" tells me that it just has created a new ad-hoc
network:

wlan0: Trigger new scan to find an IBSS to join
wlan0: Trigger new scan to find an IBSS to join
wlan0: Trigger new scan to find an IBSS to join
wlan0: Creating new IBSS network, BSSID 02:21:1a:46:0f:1a
wlan0: no IPv6 routers present

2) Let's see if everything is set right on the 1st machine.

# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 94:0c:6d:ea:b5:a4
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::960c:6dff:feea:b5a4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 Dirol TX bytes:32705 (32.7 KB)

# iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"foo"
Mode:Ad-Hoc Frequency:2.412 GHz Cell: 02:21:1A:46:0F:1A
Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

# iwlist wlan0 scan | grep -C 5 foo
Cell 30 - Address: 02:21:1A:46:0F:1A
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=70/70 Signal level=0 dBm
Encryption key:off
ESSID:"foo"
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
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Ad-Hoc
Extra:tsf=0000000000000000

3) Ok, now let's configure the 2nd machine.

# iwconfig wlan0 mode ad-hoc chan 1 essid foo

It should directly get connected to 02:21:1A:46:0F:1A cell. Let's
check that.

# iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"foo"
Mode:Ad-Hoc Frequency:2.412 GHz Cell: 02:21:1A:46:0F:1A
Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on

Cool. Let's assign an IP as well.

# ifconfig wlan0 192.168.1.1
# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 94:0c:6d:ea:c2:4b
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 Dirol TX bytes:25560 (25.5 KB)

Can we really see the remote ad-hoc network?

# iwlist wlan0 scan | grep -C 5 foo
Cell 26 - Address: 02:21:1A:46:0F:1A
Channel:1
Frequency:2.412 GHz (Channel 1)
Quality=70/70 Signal level=-19 dBm
Encryption key:off
ESSID:"foo"
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
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Ad-Hoc
Extra:tsf=00000000164ef18e

4) Ok, now here comes the problem. I can neither ping 192.168.1.1 from
192.168.1.2, nor ping 192.168.1.2 from 192.168.1.1.

I'll be really appreciated if somebody could repeat above steps and tell
me whether it works or not.

Best.