Category Archives: Linux

Ad Hoc Wireless Networking with Ubuntu


Ensure that network manager has been stopped and then bring the interface down.

sudo /etc/dbus-1/event.d/25NetworkManager stop sudo ifdown eth1

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 'harits_wlan'

4. Add a WEP encryption key (optional, as per the configuration requirement)

·                                        sudo iwconfig eth1 key 1234567890


1. Bring the interface back up

·                                        sudo ifconfig eth1 up

2. Start dhclient to get an address

·                                        sudo dhclient eth1

3. If you want to do it manually, you will have to make up an IP address.

·                                        sudo ifconfig eth1

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.


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


(source – )

%d bloggers like this: