Wednesday, November 4, 2009

Linux Ad-Hoc Wireless Network

The following example uses eth1 for the wifi interface though this may be wlan0, ath0 or something else in your case.

Preparation

Ensure that network manager has been stopped and then bring the interface down.
sudo /etc/dbus-1/event.d/25NetworkManager stopsudo ifdown eth1

Configuration


  1. Switch the card into ad hoc mode
    · sudo iwconfig eth1 mode ad-hoc
  2. Set the channel/frequency that you want to use.
    · sudo iwconfig eth1 channel 11
  3. Add the name (ssid) for the network you want to create/join. Use single quotes if there is a space in the name.
    · sudo iwconfig eth1 essid 'name'
  4. Add a WEP encryption key
    · sudo iwconfig eth1 key 1234567890

Activation

  1. Bring the interface back up
    sudo ifconfig eth1 up
  2. Start dhclient to get an address
    · sudo dhclient eth1
    If you want to do it manually, you will have to make up an IP address.
    · sudo ifconfig eth1 10.0.0.1 netmask 255.255.255.0

    echo 1 > /proc/sys/net/ipv4/ip_forwardiptables -t nat -A POSTROUTING -o eth0 -j
    MASQUERADE

Reference https://help.ubuntu.com/community/WifiDocs/Adhoc

No comments:

Post a Comment