September 8, 2010

setup wireless LAN among Ubuntu linux OS

Fix Wireless Ad-Hoc in GUI [click]


Wireless Extensions CLI tools
This process is often used as the fall back position if the gui tools fail to work. 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 service network-manager stop
sudo ifconfig eth1 down
iwconfig (or ifconfig) //look up if there is anything abnormal
sudo dhclient eth1  ////Bring the interface back up

Configuration:
sudo iwconfig eth1 mode ad-hoc  //Switch the card into ad hoc mode
*sudo iwconfig eth1 channel 4  //Set the channel/frequency that you want to use.
sudo iwconfig eth1 essid 'name'  //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 key 1234567890  //Add a WEP encryption key
*sudo dhclient eth1  //Start dhclient to get an address
sudo ifconfig eth1 169.254.34.2  //If you want to do it manually, you will have to make up an IP address.

You should now be connected to the ad hoc network. Use the iwconfig command to view the cell being used. This must match the same cell on the other PCs that you want to connect to.

Testing:
ping 169.254.34.2  //Once you have two or more computers connected to the ad hoc network, all of them showing the same cell number and having different IP addresses, then try pinging one from the others. If that doesn't work then try specifying the interface name along with the address.
ping -I eth1 169.254.34.2  //If you have more than one interface with link-local addresses there can be some routing confusion, so I recommend that you bring down these unused interfaces while connected to non-DHCP networks. If the other interfaces are all on DHCP networks, such as in the case of InternetConnectionSharing this is not necessary.
sudo ifdown eth0

Example Interfaces File:
Currently Network Manager does not support static address settings and Network-Admin does not support ad hoc networks. So instead we can configure the network in the /etc/network/interfaces file. The following is an example.

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
wireless-mode ad-hoc
wireless-channel 4
wireless-essid 'name'
wireless-key 1234567890
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1



ps. some useful command:
ifconfig [click]  iwconfig [click]
wlanconfig [click]  tcpdump [click]

No comments:

Post a Comment

Days of our lives

Daisypath Anniversary tickers