Debian Method
On each node, open /etc/network/interfaces in a text editor:
$ su
# sensible-editor /etc/network/interfaces- Define stanzas for each node's wireless interface, setting the network SSID and the device's operating mode to ad-hoc:
Node A
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-channel 1
wireless-essid MYNETWORK
wireless-mode ad-hocNode B
auto wlan0
iface wlan0 inet static
address 192.168.1.2
netmask 255.255.255.0
wireless-channel 1
wireless-essid MYNETWORK
wireless-mode ad-hocMadWifi users: You are required to provide driver-specific options (madwifi-base, madwifi-mode), in order to recreate the VAP in ad-hoc mode:
auto ath0
iface ath0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-channel 1
wireless-essid MYNETWORK
madwifi-base wifi0
madwifi-mode ad-hoc
- Save the file and exit the editor.
Raise the interface on each node:
# ifup wlan0
Scan for ad-hoc cells in range (necessary for some drivers to trigger IBSS scanning):
# iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 02:0F:B5:4F:74:ED
ESSID:"MYNETWORK"
Mode:Ad-Hoc
Frequency:2.412 GHz (Channel 1)
Quality=42/70 Signal level=-53 dBm Noise level=-95 dBm
Encryption key:off
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; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100To test, ping node A from node B:
you@nodeB$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.073 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.062 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.063 ms
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.061/0.064/0.073/0.010 ms
For general /etc/network/interfaces information, see the interfaces(5) man page.
Manual Method
On each node, bring the wireless interface down, change the device's operating mode and SSID, then raise the interface:
$ su
# ifconfig wlan0 down
# iwconfig wlan0 channel 1
# iwconfig wlan0 essid MYNETWORK
# iwconfig wlan0 mode ad-hoc
# ifconfig wlan0 upMadWifi users: You need to destroy the existing station VAP and create a new one in ad-hoc mode:
$ su
# wlanconfig ath0 destroy
# wlanconfig ath0 create wlandev wifi0 wlanmode adhoc
# iwconfig ath0 channel 1
# iwconfig ath0 essid MYNETWORK
# ifconfig ath0 up
Scan for ad-hoc cells in range (necessary for some drivers to trigger IBSS scanning):
iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 02:0F:B5:4F:74:ED
ESSID:"MYNETWORK"
Mode:Ad-Hoc
Frequency:2.412 GHz (Channel 1)
Quality=42/70 Signal level=-53 dBm Noise level=-95 dBm
Encryption key:off
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; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100- On each node, assign an IP address to the wireless interface:
Node A
# ifconfig wlan0 192.168.1.1 netmask 255.255.255.0
Node B
# ifconfig wlan0 192.168.1.2 netmask 255.255.255.0
To test, ping node A from node B:
you@nodeB$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.073 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.061 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.062 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.063 ms
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.061/0.064/0.073/0.010 ms
Troubleshooting
Etch users: The rt2x00 "next-generation" drivers (rt2400pci, rt2500pci, rt2500usb, rt61pci, rt73usb) supplied in the EtchAndAHalf (2.6.24) kernel may not support ad-hoc operation. Install a 2.6.26 kernel from Debian Backports to provide updated drivers.
- The default operating frequency/channel (2.412 GHz: channel 1) is frequently congested. Try using a different channel in the event of station association difficulties.
- Wireless LAN devices compliant with IEEE 802.11 specifications will only support a maximum bit rate of 11 Mbit/s.
See Also
http://hostap.epitest.fi/ | hostapd is a daemon to turn a computer into an access point.
No comments:
Post a Comment