Ad Hoc configuration

1.iwconfig check whether to support ad hoc mode

iwconfig and ifconfig as a network card configuration commands, commands to configure a wireless network card.

If there is: iwconfig: wlan0 no wireless extensions, indicates that the kernel configuration does not turn on the appropriate configuration options.

I development board for the ZYNQ7000 series, if Ubuntu system on a simple PC, this option is enabled by default, can be found iwconfig information.

Solution:

petalinux tool to re-read hardware information, configuring the kernel, file system, u-boot, the device tree, and finally compiled BOOT.Bin file. (Normal ARM Linux system development process)

In particular in the kernel configuration option to join in the following figure: "cfg80211 wireless extensions compatibility", thus opened the wireless LAN extensions, you can use iwconfig command

After restarting, enter the command iwconfig can be found in the relevant information about the wireless network card.

(Picture above is my development board option, also view CONFIG_WIRELESS_EXT or CONFIG_CFG80211_WEXT options, online search too)

 

2. Master build MANET

(All the following commands in root mode, or in front of each command with "sudo" can)

ifconfig wlan0 down (if the device can turn off the card appears busy, I did not develop board, no input)

iwconfig wlan0 mode "ad-hoc"(ad hoc模式)

iwconfig wlan0 essid "My_AdHoc_Net" (wireless network name)

iwconfig wlan0 key off (password)

iwconfig wlan0 channel 1 (default channel 1) (iwlist wlan0 channel to view the available channels)

 

After setting the appropriate IP to NIC:

ifconfig wlan0 192.168.5.10

ifconfig wlan0 up (open card)

See iwconfig card information, the card mode can be seen as the ad hoc mode, ESSID information, frequency, cell, etc.

ifconfig see card information, see the LAN IP and MAC address

 

simply speaking:

iwconfig wlan0 mode "ad-hoc"(ad hoc模式)

iwconfig wlan0 essid "My_AdHoc_Net" (wireless network name)

ifconfig wlan0 192.168.5.10

These three commands can be built, above the node.

 

3. From the access node to the ad hoc network

ifconfig wlan0 down

iwconfig wlan0 mode "ad-hoc"(ad hoc模式)

iwconfig wlan0 essid "My_AdHoc_Net" (the name of the wireless network, the master node of the same network name, and the need, before the same communication essid)

iwconfig wlan0 key off (no password, enter the command or not)

iwconfig wlan0 channel 1 (default channel 1) (the same channel and the master node needs)

 

After setting the appropriate IP to NIC:

ifconfig wlan0 192.168.5.11 (and requires the master node in the same network segment)

ifconfig wlan0 up (open card)

See iwconfig card information, the card mode can be seen as the ad hoc mode, ESSID information, frequency, cell, etc.

ifconfig see card information, see the LAN IP and MAC address

 

4. The two nodes each ping

Generally, the ping is, since the ad hoc network to build the master node will time out before a request to join an existing ad-hoc network, if no response is received, then establish their own

From node is added to the ad hoc network, still this process, but the outside world has been ad hoc network, the master node and the slave node has interactive information, learn each other's MAC address

 

If the ping fails, indicating no interaction before, not each other's MAC address, you can enter the command: arp -n to check the ARP information

If there is no corresponding information arp, then manually create each other's arp static address, the command is as follows:

arp -s 192.168.5.10 xx:xx:xx:xx:xx:xx

arp -s 192.168.5.11 xx:xx:xx:xx:xx:xx

With the MAC address, then ping, can ping through the

 

The script file configuration

Each node must be turned on manually re-enter the relevant commands for the development for more trouble, use the following two methods:

Method one: writing a command to /etc/rc.local file, boot from running

Method Two: Write .sh script that will write the configuration command script, then ./XX.sh(sudo chmod + x XX.sh modify executable permissions) or to sh XX.sh

 

Building an ad hoc network terminal 6.PC

If the system is only set up in Ubuntu the PC, the following methods may be employed:

vi /etc/network/interfaces

Write:

auto wlan0

iface wlan0 inet static

address 192.168.5.10

netmask 255.255.255.0

wireless-channel 1

wireless-essid My_AdHoc_Net

wireless-mode ad-hoc

At last:

sudo /etc/init.d/networking restart can, or restart.

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/jpzhu/p/11983620.html