xref: /openwifi/doc/app_notes/ad-hoc-two-sdr.md (revision a6085186d94dfe08b0e09c18c8d4b1b4fe38ea35)
1*a6085186SLina Ceballos<!--
2*a6085186SLina CeballosSPDX-FileCopyrightText: 2019 Jiao Xianjun <[email protected]>
3*a6085186SLina CeballosSPDX-License-Identifier: AGPL-3.0-or-later
4*a6085186SLina Ceballos-->
5*a6085186SLina Ceballos
6*a6085186SLina Ceballos
79c1c62f1SXianjun Jiao- Power on two SDR boards. Call one board "adhoc1" and the other "adhoc2". On each board, the TX and RX antenna should vertical/orthogonal to each other as much as possible to gain a good TX/RX isolation.
89c1c62f1SXianjun Jiao- Connect a computer to the adhoc1 via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal:
99c1c62f1SXianjun Jiao  ```
109c1c62f1SXianjun Jiao  ssh [email protected]
119c1c62f1SXianjun Jiao  (password: openwifi)
129c1c62f1SXianjun Jiao  service network-manager stop
139c1c62f1SXianjun Jiao  cd openwifi
149c1c62f1SXianjun Jiao  ./wgd.sh
159c1c62f1SXianjun Jiao  (Wait for the script completed)
169c1c62f1SXianjun Jiao  ifconfig sdr0 up
179c1c62f1SXianjun Jiao  ./sdr-ad-hoc-up.sh sdr0 44 192.168.13.1
189c1c62f1SXianjun Jiao  (Above command setup ad-hoc network at channel 44 with static IP assigned to sdr0 NIC)
199c1c62f1SXianjun Jiao  iwconfig sdr0
209c1c62f1SXianjun Jiao  ```
219c1c62f1SXianjun Jiao- You shold see output like:
229c1c62f1SXianjun Jiao  ```
239c1c62f1SXianjun Jiao  sdr0    IEEE 802.11  ESSID:"sdr-ad-hoc"
249c1c62f1SXianjun Jiao          Mode:Ad-Hoc  Frequency:5.22 GHz  Cell: 92:CA:14:27:1E:B0
259c1c62f1SXianjun Jiao          Tx-Power=20 dBm
269c1c62f1SXianjun Jiao          Retry short limit:7   RTS thr:off   Fragment thr:off
279c1c62f1SXianjun Jiao          Encryption key:off
289c1c62f1SXianjun Jiao          Power Management:off
299c1c62f1SXianjun Jiao  ```
309c1c62f1SXianjun Jiao  If you see "Cell: Not-Associated", please wait and run "iwconfig sdr0" again until a randomly generated Cell ID appears.
319c1c62f1SXianjun Jiao
329c1c62f1SXianjun Jiao- Connect another computer to the adhoc2 via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal:
339c1c62f1SXianjun Jiao  ```
349c1c62f1SXianjun Jiao  ssh [email protected]
359c1c62f1SXianjun Jiao  (password: openwifi)
369c1c62f1SXianjun Jiao  service network-manager stop
379c1c62f1SXianjun Jiao  cd openwifi
389c1c62f1SXianjun Jiao  ./wgd.sh
399c1c62f1SXianjun Jiao  ifconfig sdr0 up
409c1c62f1SXianjun Jiao  ./sdr-ad-hoc-up.sh sdr0 44 192.168.13.1
419c1c62f1SXianjun Jiao  iwconfig sdr0
429c1c62f1SXianjun Jiao  ```
439c1c62f1SXianjun Jiao- You shold see output like:
449c1c62f1SXianjun Jiao  ```
459c1c62f1SXianjun Jiao  sdr0    IEEE 802.11  ESSID:"sdr-ad-hoc"
469c1c62f1SXianjun Jiao          Mode:Ad-Hoc  Frequency:5.22 GHz  Cell: 92:CA:14:27:1E:B0
479c1c62f1SXianjun Jiao          Tx-Power=20 dBm
489c1c62f1SXianjun Jiao          Retry short limit:7   RTS thr:off   Fragment thr:off
499c1c62f1SXianjun Jiao          Encryption key:off
509c1c62f1SXianjun Jiao          Power Management:off
519c1c62f1SXianjun Jiao  ```
529c1c62f1SXianjun Jiao  The "Cell: 92:CA:14:27:1E:B0" should be the same as adhoc1, because the later joined node should discover the Cell ID of the existing network and join/get it automatically. If not, please adjust the antenna/distance and re-run the commands.
539c1c62f1SXianjun Jiao
549c1c62f1SXianjun Jiao  Now the communication link should be already setup between the two ad-hoc nodes, and you can ping each other.
55