Creating an adhoc host with Ubuntu

Sponsored Link

Have you ever needed to wirelessly network a Windows PC's directly to a Ubuntu machine?  In other words, you lack a router, switch, or other networking mechanism, each PC has a wireless device and you need to trade a file or play a network game?  Read on.


Ubuntu's NetworkManager 0.7.0 contains the necessary features for creating an Ubuntu adhoc network host.

In Ubuntu:

  • Left click on the NetworkManager icon and select Create New Wireless Network

image1

  • Specify an adhoc network name, i.e. UbuntuAdhoc
  • Select your favorite security method (this example specifies None)
  • Click the Create button

As of Ubuntu 8.10, NetworkManager pretends to connect to the newly created UbuntuAdhoc wireless network but inevitably fails and the NetworkManager defaults back to the last successful network connection.  See below to rectify.

Editing Network Connections:

  • Click on the NetworkManager icon, select Edit Connections.
  • Select the Wireless tab, select the UbuntuAdhoc network and click the edit button.

Editing the UbuntAhoc network:

  • Click the Connect automatically check-box
  • On the Wireless tab, ensure the mode is set to Ad-hoc

image2

  • Select the Ipv4 Settings tab
  • Select the Manual method in the drop down
  • Click the Add button and enter a local IP address, Netmask and Gateway, i.e. 192.255.0.1, 255.255.255.0, and 1.1.1.1 respectively.
  • Leave DNS Servers and Search Domains blank

image3

  • Click OK.

Connecting your Ubuntu session to the new adhoc Network:

  • Left click on the NetworkManager icon and select Connect to Hidden Wireless Network...
  • Select UbuntuAdhoc on the connection dropdown and click Connect.
  • Voila, your Ubuntu session should be connected to itself. Hover over NetworkManager icon, and you should see the yellow message: Wireless network connection to ‘UbuntuAdhoc‘ (0%).

image4

Note: the NetworkManager bars will appear empty since the network adapter technically is not connected to any network. These bars remain empty even when another computer joins the network. Regardless, the connection will work fine.

In Windows XP:

Wireless Connection Properties:

  • Right click the Wireless Connection icon (either from the Windows tray or via the control panel) and select Properties. Ensure to right click on the the windows network icon and not the icon specific to the hardware driver.
  • Select TCP/IP option in The connection uses the following items: window, and click the Properties button. (In this image, I was lazy as I used a Lan connection properties window as my virtual XP session did not have a wireless option to capture, but TCP/IP example is identical).

image5

Internet Protocol (TCP/IP) Properties:

  • Specify an IP address within a few increments of the Ubuntu IP address, i.e. 192.255.0.2. Ensure to match the subnet mask and gateway to the ones specified in UbuntuAdhoc (255.255.255.0 and 1.1.1.1, respectively).

image6

  • Click OK in the both the Internet Protocol (TCP/IP) Properties window and then Wireless Internet Connection Properties window.

Click on your respective window wireless connection icon, select UbuntuAdhoc from list of connections and connect.

Note: Assuming the original IP address was auto selected, ensure to set the Inernet Protocol (TCP/IP) Properties back to Obtain an IP address automatically when reconnecting to another wireless network.

If anyone knows of an easier way please post.

Sponsored Link

You may also like...

61 Responses

  1. Muppet says:

    Follow debabrata. It’s that simple!

    These steps are NOT necessary:
    * Don’t select Manual — IP4 Settings “Automatic (DHCP)” works fine
    * Don’t enter a local IP address, Netmask and Gateway
    * Don’t force Ubuntu to connect to the new network

    You have created a wireless access point, i.e., your own hotspot. Other wireless devices, e.g., a laptop running Windows 7, can connect to it as clients.

    You can see a list of clients that connected in /var/lib/misc/dnsmasq.leases on the Ubuntu host.

Leave a Reply

Your email address will not be published. Required fields are marked *