eStadium Project

Lab 1: Network Setup – Ad-Hoc Mode

Objectives

  • Being familiar to the command iwconfig andifconfig to setup an ad-hoc network.

We set up two computers (PC1 and PC2) as an Ad-hoc network and test the connectivity by using the command iwconfig, ifconfig, and ping (consult the command format for more information by typing man iwconfig or man ifconfig or man ping).

Remark:

  • This lab is working on Ubuntu OS.
  • If the “permission deny” occurs when using the command iwconfig or ifconfig, put the word sudo in front of iwconfig / ifconfig, for example,

> sudo iwconfig wlan0 mode Ad-Hoc channel 1 essid “WNET”

  • If there is anexisting or nearby WLAN, make sure that in step 5), 8), and 9), we choose a different channel (not need to be channel 1 or 5). If this nearby WLAN uses channel 1, we could run the lab by using channel 6 or 11. We can know the channel used by this WLAN by using the command

> iwlist wlan0 scanning

1)Disconnect the current network by right clicking on this network icon (upper right corner) and disabling Enable Networking. Then the network icon will look like .

2)Open terminal window by selecting Applications>Accessory>Terminal.

3)For both PC, use the command iwconfig to find the wireless interface card name.

Type

> iwconfig

The screen will show (***note that it might not show exactly the same***)

Generally wlan0 is the wireless interface card name. Suppose wlan0 is our card name.

4)Setup PC1

  • Type

> sudo ifconfig wlan0 down

  • Type (to setup ad-hoc mode, using channel 1, which frequency is 2.412 GHz, and the network name is WNET)

> sudo iwconfig wlan0 mode ad-hoc channel 1 essid “WNET”

  • Type (to see our setup)

iwconfig wlan0

The screen will show

  • Type (to setup IP address: 192.168.12.1)

> sudo ifconfig wlan0 192.168.12.1

  • Type (to see the result)

> ifconfig wlan0

The screen will show

5)Setup PC2

  • Type

> sudo ifconfig wlan0 down

  • Type (to setup ad-hoc mode, using channel 1, which frequency is 2.412 GHz, and the network name is WNET)

> sudo iwconfig wlan0 mode ad-hoc channel 1 essid “WNET”

  • Type (to see our setup)

iwconfig wlan0

  • Type (to setup IP address: 192.168.12.2)

> sudo ifconfig wlan0 192.168.12.2

  • Type (to see the result)

> ifconfig wlan0

*** The ad-hoc network setup is succcessful when both PCs has the same network name, same frequency, same cell number. ***

6)Test the connectivity between two PCs.

On PC1, type (to send the data from PC1 to PC2)

> ping 192.168.12.2

The screen should show the data can be transmitted successfully.

7)Test the connectivity when two PCs have different channels. Let PC2 use channel 5.

On PC2, type

> iwconfig wlan0 channel 5

Now PC2 uses another frequency (we can see by type iwconfig wlan0).

On PC1, type (to send the data to PC2)

> ping 192.168.12.2

The screen should show that the transmission fails.

8)Test the connectivity when two PCs have different BSS name. Set PC2 back to the channel 1 and set the BSS of PC2 to ANONET.

On PC2, type

> iwconfig wlan0 channel 1 essid “ANONET”

Now PC2 uses channel 1 but has another BSS (we can see by type iwconfig wlan0).

On PC1, type (to send the data to PC2)

> ping 192.168.12.2

The screen should show that the transmission fails.