Internet Connection Sharing on Ubuntu & Windows with Ad-hoc

Hi!

First I was very excited when my brother asked for my help to choose him a laptop. My other task was to share our internet connection between a Desktop PC and two laptops without using switch or router. Of course the story became more interesting due to the different operating systems. I’ll try to show how to set up your home network in such situations.

Important to make sure that you have installed drivers for networking interfaces!

About the connection: cable-net,  the modem is connected to the Desktop-PC with USB.

Configuring the wired interfaces:

Desktop-PC has two networking interfaces, the first (in the following text: eth0) has automatic network  address through the modem (DHCP). We need to allow to the other computers in our network (in this case just one laptop) to connect to the internet through this connection [1].

The another network interface of Desktop-PC is eth1 – it has static address, set to 192.168.0.1 with subnet mask 255.255.255.0 . We need to connect this network card (eth1) to one of our laptops directly. I connected it first to the laptop with Windows XP, of course you can connect it to the laptop with Linux but the Internet Connection Sharing and the IP configuration becomes more complicated in that case. When connecting our Desktop-PC and laptop directly we must to use crossover (crosslink) cable! So, we connected our Desktop-PC’s card (eth1) with our Laptop’s ethernet card (in the following text: eth2). The address configuration for this card need to be also automatic – eth1 will deal for eth2 an address, subnet mask and gateway too.

Configuring the wireless interface on Windows:

At this point you have working internet connection on both Desktop-PC and laptop (with the interface eth2). We’ll share this connection with the second laptop through an ad-hoc network. First of all you need to configure the eth2 card to allow the other computers in the network to connect to the internet through this connection ( see [1]).

Create an Ad-hoc wireless network with your integrated wireless card (wlan0 in the following)  on the laptop with Windows XP (no encryption used in this example to simplify the setup).

After creating an Ad-hoc network,  set static address for wlan0, IP: 192.168.88.1, subnet: 255.255.255.0. You have configured your Windows machines, move to the laptop with Linux.

Configuring the wireless interface on Linux:

In this example I’m using Ubuntu 9.10 Karmic Koala, but you will find the same expressions on other Linux distributions and in different Network Configuration Interfaces. Create a new wireless connection and set the connection type to Ad-hoc.

The most important part is the IP configuration. On your Linux laptop for the wireless interface (wlan1) set static addresses for IP: 192.168.88.88 (actually the end of this address can be anything – in the allowed range – the only important thing is that it must be different from the last part of your static address of the interface wlan0), subnet 255.255.255.0, for Gateway and DNS set the IP address of the interface wlan0.

Apply the changes and connect to this Ad-hoc network on your Windows and Linux laptops.

If you have any question, please comment.

Advertisements

5 thoughts on “Internet Connection Sharing on Ubuntu & Windows with Ad-hoc

  1. hola hu

    I can’t get my ICS to work. Even after following the steps mentioned in your article I can no way connect my xp laptop to connect to my Ubuntu 9.04 box. BTW, why should we set a static IP for wlan? because the IP I get is assigned by DHCP and it keeps changing everytime. Can you please help me fix that thing. And to be precise mine is “pppoe” instead of wlan, anyways thats not an issue I guess, right ?

    Reply
    1. akoskm Post author

      This article is about connecting with Ubuntu to a laptop with Windows XP installed.
      Creating an ad-hoc network on Ubuntu and then connecting to it with Windows XP is a bit complicated.

      Reply
  2. Ionut Adrian Luchian

    can you make a tutorial with – How to create an ad hoc network on Ubuntu and then connecting to it with Windows XP?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s