Hustle! Ad Hoc Wireless connections from Linux to Windows

February 4th, 2007 mysurface Posted in ifconfig, Network, nm-applet, ping, route | Hits: 60435 | 3 Comments »

Hustle! To setup an Ad Hoc wireless connection between windows and Linux, it spend me half an hour of trying just because desperately wanna get Internet access. I decided to write down because the steps are confusing. Bare in mind the steps shown bellow just work on the case that I gonna illustrate later and we do not guaranteed it will works fine at your side too. If you find a better way, please feel free to leave me a message, because the steps shown bellow is really inconvenience for us.

First of all, let me explain why we wanna do this. My friend as a host notebook installed with windows XP, he has an wired Ethernet connected to his router , which is where he get the Internet access from. He has a internal wifi adapter which makes Internet share possible through wireless.

At my side, I have Linux installed with wifi adapter too (eth1). I would like to mention what tools and commands I use along the setup. I have gnome-network-manager installed, which uses nm-applet to help me connect access point with wpa encryption. I uses ifconfig to configure my IP address and uses iwconfig to check my wireless adapter information, and probably need to use route to set a default gateway.

Okay, lets get started.

First of all, we have to make ad hoc connection between two laptops, then we will consider to bridge the two wired and wireless adapters at windows side to perform Internet sharing.

Step 1, Ad hoc wireless setup.
Go to your windows Network connection setting, click start -> Connection to, and show all connections OR Right on the Ethernet status icon at the right down corner of the screen and choose Open Network Connections.

Enable wireless adapter, then right click on the icon and go to properties, select Wireless Network tab, add an adhoc point, make sure it is less hustle, connection setting we choose open Newtork Authentication and Disable data encryption. Pick a simple name, a simple IP and gateway. ( don’t conflict with the network of your LAN, if your router gateway is 192.168.0.254, then uses 192.168.1.0/24 for wireless LAN). Okay I set 192.168.1.2 for here, netmask 255.255.255.0 and gateway doesn’t matter much, I put 192.168.1.1.

At Linux side, make sure nm-applet is loaded, click on it and select New Wireless Network Connection, type the same name as the one at windows side. At the same time, type this

sudo ifconfig eth1 192.168.1.3 netmask 255.255.255.0

Try to get connected at both side, if it doesn’t at the first time. Prepare your command line above, click nm-applet to connect again and consequently run the command line again. Incompetent nm-applet do not allow you to configure static IP, it always assume you are connecting to a wireless router that can assign you IP. You can hack it by running command line stated above. For windows side it should be easy to get connected to Ad hoc.

Make sure nm-applet gives you green light, to check whether you are connected, try to ping.

ping -I eth1 192.168.1.2

And you also can check your wireless status, by this

iwconfig eth1

The output should looks likes bellow:


eth1      IEEE 802.11b  ESSID:"zion2"
          Mode:Ad-Hoc  Frequency:2.462 GHz  Cell: 02:04:23:CC:F2:59
          Bit Rate:11 Mb/s   Tx-Power=20 dBm   Sensitivity=8/0
          Retry limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=72/100  Signal level=-56 dBm  Noise level=-85 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:1  Invalid misc:3   Missed beacon:0

Step 2. Bridging wireless and wired Ethernet
At the same Network Connection panel in windows, hold down control key, click on wireless and wired icon and right click, select “Bridge Connections”.
After Bridging, you need to set IP for the bridge, right click on the bridge icon created and set a static IP to connect to Router gateway at TCP/IP Properties.

Okay in my case it is 192.168.0.2 netmask 255.255.255.0 gateway puts router’s IP(let say 192.168.0.254). Fire up your Internet browser and see whether you still can online. Cannot? right click on bridge icon, disable and enable it back and check again with your browser.

At Linux side, run ifconfig again to set to a IP in the same subnet as router and the bridge.

sudo ifconfig eth1 192.168.0.3 netmask 255.255.255.0

Oh! don’t forget to add a default route for it to point to router gateway too

sudo route add default gw 192.168.0.254

Check with your firefox! If you get online, congratulation!

[tags]wireless, wireless ad hoc, Internet sharing, windows[/tags]

3 Responses to “Hustle! Ad Hoc Wireless connections from Linux to Windows”

  1. Nice post, but that doesn’t always really to be compatible with my router ip address, any ideas?

  2. You write important, the topics are cool. I like this web page. For how long are you currently blogging? What amount of time do you invest in it? Hopefully that I can make use of a few of your texts on my web site.

  3. I savour, lead to I discovered just what I was taking a look for. You have ended my four day lengthy hunt! God Bless you man. Have a nice day. Bye

Leave a Reply