Ubuntu TP-Link TL-WN723N Ad-Hoc Network

Tags: May 11, 2014 3:20 PM

The Wifi ad-hoc network configuration that will be created for this task are composed from the following devices:

  1. Computer A (TP-Link TL-WN723N) IP: 192.168.1.25/29
  2. Computer B (Other Wireless) IP: 192.168.1.26/29

Step by Step Ad-Hoc Configuration

This is important, the Computer B should be configured first followed by Computer A. It might not work if configured using opposite order. Bug: https://github.com/lwfinger/rtl8188eu/issues/4

Computer B

Assuming the name of the wireless device is wlan0. Commands below will create ad-hoc network without encryption. The SSID name is "MYHOME""

$ ip link set wlan0 down
$ iwconfig wlan0 channel 1 essid MYHOME mode ad-hoc
$ ip link set wlan0 up
$ ip addr add 192.168.1.26/29 dev wlan0

Computer A

Do exactly the same as Computer B.
$ ip link set wlan0 down
$ iwconfig wlan0 channel 1 essid MYHOME mode ad-hoc
$ ip link set wlan0 up
$ ip addr add 192.168.1.25/29 dev wlan0

On Both Side

Scan for ad-hoc cells in range and make sure the "Cell" output for Computer A and Computer B identical. On this example the cell address for both of side have to 3E:2F:27:B0:33:14.

$ iwlist scan wlan0
wlan0     Scan completed :
          Cell 01 - Address: 3E:2F:27:B0:33:14
                    ESSID:"MYHOME"
                    Protocol:IEEE 802.11bg
                    Mode:Ad-Hoc
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:off
                    Bit Rates:54 Mb/s
                    Quality=0/100  Signal level=2/100
If cell address for both side is not same then pick one of them and make it as the default. The cell address is same as access point, so to set the address the iwconfig <DEV> ap <ADDR> can be used.
$ iwconfig wlan0 ap 3E:2F:27:B0:33:14
Try to ping each other to make sure they can reach each other.
$ ping 192.168.1.26
PING 192.168.1.26 (192.168.1.26) 56(84) bytes of data.
64 bytes from 192.168.1.26: icmp_req=1 ttl=64 time=3.27 ms
64 bytes from 192.168.1.26: icmp_req=2 ttl=64 time=1.28 ms
64 bytes from 192.168.1.26: icmp_req=3 ttl=64 time=1.18 ms
64 bytes from 192.168.1.26: icmp_req=4 ttl=64 time=1.93 ms
64 bytes from 192.168.1.26: icmp_req=5 ttl=64 time=1.43 ms
^C
--- 192.168.1.26 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 1.181/1.822/3.277/0.772 ms

References

Share on Facebook Twitter

0 comments:

Post a Comment