Return to The DoDWAN platform

Network configuration

DoDWAN

The DoDWAN platform

Overview
Download
Contact

DoDWAN Apps for netbooks

Installation
Starting DoDWAN Apps
DoDWAN Apps Overview

DoDWAN Apps for smartphones

Overview
Hints and tips

DoDWAN SDK

Installation
Running DoDWAN programs
Using the DoDWAN API
Reference Java API

Additional documentation

Network configuration
Configuration properties
Launching environment

Introduction

DoDWAN is a middleware system that supports opportunistic (a.k.a. delay/disruption-tolerant) communication in partially or intermittently connected mobile ad hoc networks. It is primarily meant to run on mobile hosts equipped with Wi-Fi interfaces.

In order to run DoDWAN-based applications on a flotilla of mobile hosts (such as laptops, netbooks or smartphones), one must first configure these devices so they can constitute an ad hoc network. Configuring a Wi-Fi interface for ad hoc communication can be quite tricky, though, so DoDWAN is distributed with two shell scripts set-dodwan-network.sh and set-dodwan-network.ps1 that are meant to help users configure their mobile devices for ad hoc networking (on Linux platforms and Windows 7 platforms respectively).

On a Linux platform the Wi-Fi interface can thus be set as shown below:

% sudo sh set-dodwan-network.sh
Detected Wi-Fi interface: wlan0
Interface wlan0 is now configured for ad hoc networking (ssid=DODWAN-ADHOC, channel=1)

 

On a Windows 7 platform the Wi-Fi interface can be set by executing the following command in a Powershell launched with Administrator privilege. Note that this operation must be done only once as the produced configuration is by default persistent (to reboot) in Windows 7. You may need to previously authorize the execution of shell scripts by issuing the command Set-ExecutionPolicy RemoteSigned in a Powershell run with Aministrator privilege. In addition, be sure that your firewall does not prevent a Java program (like DoDWAN) to receive data on your wireless interface (you may have to deactivate your firewall or at least to define rules in it to allow Java to exploit incoming traffic on the DoDWAN network, on UDP port 8500).

> set-dodwan-network.ps1
Detected Wi-Fi interface: Wireless network connection
Profile DODWAN is added on interface Wireless network connection.
Profile "DODWAN" of interface "Wireless network connection" is updated.
Connection request is received successfully.
Ok.

 

If these scripts do not run satisfactorily on your system, or if you are just curious to know what they do, please consult the following sections that provide step-by-step instructions for configuring the Wi-Fi interface on a Linux platform or on a Windows 7 platform.

Finally, if you need to cancel the Wi-Fi DoDWAN ad hoc configuration, you can run the provided script unsetdodwan-network.sh on Linux (as root), or the Poweshell script unset-dodwan-network.ps1 on Windows 7 (with Administrator privilege).

Preparing to run DoDWAN on a Linux system

Preparing your system

Most current Linux distributions include the so-called NetworkManager, which runs continuously in the background and is supposed to ease network configuration on mobile hosts by re-configuring these interfaces automatically whenever possible.

In order to set your Wi-Fi chipset in ad hoc mode, and especially in order to ensure that it remains in this mode once it has been set, you will probably have to disable the NetworkManager altogether.

Likewise your Linux system probably includes Avahi support. Again you will probably need to disable the Avahi support on your system, as this does not help in an ad hoc network and can even disrupt interface configuration.

% sudo /etc/init.d/network-manager stop
% sudo /etc/init.d/avahi-daemon stop

Note: the actual syntax required for disabling these services on your system may depend on which distribution of Linux this system is running.

Once you are confident that NetworkManager and Avahi will not meddle with your configuration of the Wi-Fi chipset, you can proceed with this configuration.

Setting the Wi-Fi interface in ad hoc mode

You will need the wireless-tools package, which contains a number of tools for manipulating wireless interfaces.

With the iwconfig command provided in this package you can set your Wi-Fi interface in ad hoc mode, and set the ESSID and channel number that will identify your ad hoc network:

% ifconfig wlan0 down
% iwconfig wlan0 mode ad-hoc
% iwconfig wlan0 essid DODWAN-ADHOC
% iwconfig wlan0 channel 1
% iwconfig wlan0 power off
% ifconfig wlan0 up

In this example we assume the name of the Wi-Fi interface is wlan0 (this name may of course be different on your own system). The network identifier (a.k.a. ESSID) is set to DODWAN-ADHOC in this example, and the channel is set to 1. You can of course choose another name or channel number, provided you set the same values on all the hosts you wish to include in your ad hoc network.

Note: with some chipset drivers, some iwconfig commands can only be issued when the interface is down, while other commands can only be issued when it is up. Similarly, with some drivers the commands issued to configure the Wi-Fi interface must be issued in a specific order (which varies between one driver and another). You may therefore have to proceed by trial and error before your interface is configured as expected.

Likewise setting the power off option (which basically disables any form of power saving mode on the chipset) is optional, as many Wi-Fi chipsets do not accept this option.

Checking that a Wi-Fi interface is configured as desired

In order to check that your Wi-Fi interface is configured as expected, you can use the iwconfig command again:

% iwconfig wlan0 | head -2
wlan0     IEEE 802.11abgn ESSID:"DODWAN-ADHOC"
          Mode:Ad-Hoc Frequency:2.412 GHz Cell:3A:E6:D4:D8:B4:58

In this example it can be observed that interface wlan0 is running in ad hoc mode, and that it is set to operate on frequency 2.412 GHz (that is the central frequency for channel 1) as part of a wireless network whose identifier is DODWAN-ADHOC.

Configuring the Wi-Fi interface for IP networking

Once your Wi-Fi chipset is operating in ad hoc mode, you still have to make sure it can be used for IP networking.

Before starting DoDWAN on your hosts, you simply need to make sure that the wlan0 interface on each host has an automatically-assigned link-local IPv6 address (that is, an address with prefix fe80::), and that it is enabled for multicast networking.

On most recent distributions of Linux, network interfaces are enabled for IPv6 and multicast networking by default, so you should simply check that this is the case for the interface you intend to use. This can be done as shown below:

% /sbin/ifconfig wlan0 | grep "inet6\|MULTI"
      inet6 addr: fe80::222:19ff:fe2c:c68b/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

In this example, the interface named wlan0 has an fe80:: link-local address as expected, and it is enabled for multicast networking. This interface can therefore be used by DoDWAN without any further configuration.

Note: a network interface may have several IPv6 addresses. This is not a problem, as long as this interface has at least an fe80:: link-local address.

If the Wi-Fi interfaces are IPv6-enabled and multicast-enabled on all the hosts you plan to use, then no further configuration is required to run DoDWAN on these hosts. You can therefore try to start DoDWAN on each host. Please refer to the appropriate sections in DoDWAN’s User Manual or DoDWAN’s Developer Manual, depending on your needs.

Dealing with a host that features multiple network interfaces

DoDWAN uses a multicast group to broadcast UDP datagrams among neighbor hosts. If one of the hosts you plan to use features several network interfaces, then you need to specify which of these interfaces is to be used by DoDWAN when joining this multicast group.

To select this interface you need to specify its address in DoDWAN’s interface_address property (see Configuration_properties for details on how to set DoDWAN’s configuration parameters).

You also need to set a route for multicast networking, that is, a route must be established to reach the multicast group through the selected interface:

% sudo ip -6 route add ff02::236:1:2:3 dev wlan0 table local

Of course the interface name must be adjusted to fit your own system.

Preparing to run DoDWAN on a Windows 7 system

Establishing a wireless network in Windows 7 is generally performed with the graphical user interface, via several tools accessible via the Control Panel / Network and Sharing Center. Another simple way to complete this task is to use the scripting language provided by Powershell, which will also allow us to identify and worked out possible difficulties.

Building a profile for DoDWAN ah hoc network

Windows 7 registers all wireless networks configurations in so-called profiles so that the user can easily ”connect” to a desired network. A profile is specified in an XML file that describes a number of parameters (essentially its SSID and security mode). The profile suitable for a DoDWAN ad hoc network, available in the DoDWAN Apps and the DoDWAN SDK distributions, is the following:

<?xml version="1.0"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
 <name>DODWAN</name>
 <SSIDConfig>
  <SSID>
    <name>DODWAN-ADHOC</name>
  </SSID>
  <nonBroadcast>false</nonBroadcast>
 </SSIDConfig>
 <connectionType>IBSS</connectionType>
 <connectionMode>manual</connectionMode>
 <autoSwitch>false</autoSwitch>
 <MSM>
  <security>
   <authEncryption>
    <authentication>open</authentication>
    <encryption>none</encryption>
    <useOneX>false</useOneX>
   </authEncryption>
  </security>
 </MSM>
</WLANProfile>

We will assume that this file is saved as dodwan-profile.xml. You may change the SSID in this file, as far as you ensure that all the devices in your DoDWAN network share the same SSID.

Setting the Wi-Fi interface in ad hoc mode

The first thing to do is to identify the name of the Wi-Fi interface. This interface is named as a (long) human-readable string that is obtained with the netsh command:

> netsh wlan show interfaces
There is 1 interface on the system:
Name                 : Wireless Network Connection
Description          : Linksys WUSB600N Dual-Band Wireless-N USB Network Adapter #4 
GUID                 : f87c893d-8452-4ab6-b0e2-6ed0ce0b1e60 
Physical Address     : 00:1e:e5:e4:b7c:80
State                : disconnected

The previously created XML profile can be associated with the Wi-Fi interface through the following command:

> netsh wlan add profile filename="dodwan-profile.xml" interface="Wireless Network Connection"
Profile DODWAN is added to interface Wireless Network Connection.

You should then see a new entry named DODWAN (the name of the profile) in the list shown after clicking on the network icon in the status bar.

Connecting to the DoDWAN ad hoc network

A connection to an ad hoc network can only be done manually, unlike connections to a wireless access point for which the user may want to automatically establish a connection to, when the access point is within radio range. One can connect to the DODWAN network through the network icon in the status bar, or by using the following netsh command:

> netsh wlan connect DODWAN 
Connection request is received successfully.

Checking that a Wi-Fi interface is configured as desired

You can use the show interfaces command as previously to check that the Wi-Fi interface is properly configured. Now the connection to the DODWAN network is established, this command shows more details:

> netsh wlan show interfaces
There is 1 interface on the system:
Name                 : Wireless Network Connection
Description          : Linksys WUSB600N Wireless-N USB Network Adapter #4 
GUID                 : f87c893d-8452-4ab6-b0e2-6ed0ce0b1e60 
Physical Address     : 00:1e:e5:e4:b7c:80 
State                : ad hoc network formed
SSID                 : DODWAN-ADHOC
BSSID                : 00:22:6b:73:aa:5a
Network Type         : Ad hoc
Radio Type           : 802.11g
Authentication       : Open
Encryption           : None
Connection Mode      : Profile
Channel              : 1
Receive Rate (Mbps)  : 54
Transmit Rate (Mbps) : 54
Signal               : 16% 
Profile              : DODWAN

Configuring the Wi-Fi interface for IP networking

Once your Wi-Fi chipset is operating in ad hoc mode, you still have to make sure it can be used for IP networking.

On Windows 7, network interfaces are enabled for IPv6 and multicast networking by default, so you should simply check the value of the IPv6 address of the interface you intend to use. For the interface mentioned above, this can be done as shown below:

> netsh interface ipv6 show addresses interface="Wireless Network Connection" level=normal

Interface 12: Wireless Network Connection

Addr Type  DAD State    Valid Life  Pref. Life  Address
———  ———--  ———-  ———-  ————————
Other      Preferred    infinite    infinite    fe80::13c3:6cda:abac:a018%12

In this example, the interface named Wireless Network Connection has an fe80:: link-local address as expected. This interface can therefore be used by DoDWAN without any further configuration.

Note: a network interface may have several IPv6 addresses. This is not a problem, as long as this interface has at least an fe80:: link-local address.

If the Wi-Fi interfaces are IPv6-enabled and multicast-enabled on all the hosts you plan to use, then no further configuration is required to run DoDWAN on these hosts. You can therefore try to start DoDWAN on each host. Please refer to the appropriate sections in DoDWAN’s User Manual or DoDWAN’s Developer Manual, depending on your needs.

Dealing with a host that features multiple network interfaces

DoDWAN uses a multicast group to broadcast UDP datagrams among neighbor hosts. If one of the hosts you plan to use features several network interfaces, then you need to specify which of these interfaces is to be used by DoDWAN when joining this multicast group.

To select this interface you need to specify its address in DoDWAN’s interface_address property (see href=”https://www-casa.irisa.fr/dodwan/developer-manual-5/”>Configuration_properties for details on how to set DoDWAN’s configuration parameters).

You also need to set a route for multicast networking, that is, a route must be established to reach the multicast group through the selected interface. Note that this command must be run with Administrator privilege (you can, for example, use the sub-menu ”Run as Administrator” when you launch a Powershell for this purpose).

> netsh interface ipv6 add route interface="Wireless Network Connection" ff02::236:1:2:3/128

Of course the interface name must be adjusted to fit your own system.

Hints and Tips

Warnings about ad hoc networking with Wi-Fi chipsets

Configuring a Wi-Fi ad hoc network can be quite tricky. Indeed, before going further there are a number of things you probably need to know about ad hoc networking with Wi-Fi chipsets:

  1. Most Wi-Fi chipsets behave correctly in managed mode (that is, when they must associate with access points).
  2. Many Wi-Fi chipsets do not behave correctly in ad hoc mode, though. Several hosts featuring different Wi-Fi chipsets (or similar chipsets but different drivers) may be unable to communicate in ad hoc mode, even if they are correctly configured for ad hoc networking.
  3. Many smartphones featuring Wi-Fi chipsets simply cannot work in ad hoc mode. In some cases this is because the chipset drivers in these systems do not support ad hoc networking. In most cases, though, the reason is that smartphone vendors deliberately disable the ad hoc mode in their device. This mode can then usually be enabled by fiddling with the system.

A consequence of these observations is that if you intend to configure a number of hosts so they can chitchat in ad hoc mode, then it is recommended to first check that these hosts feature similar Wi-Fi chipsets with similar drivers, and of course that these drivers support the ad hoc mode.

If you intend to use heterogeneous hosts and Wi-Fi chipsets to constitute an ad hoc network, then please keep in mind that this is quite a challenge. Indeed, a single host with a faulty behavior may play havoc with the whole ad hoc network.

Switching between IPv4 and IPv6 transmissions

DoDWAN can use either an IPv4 or an IPv6 networking stack, but it uses IPv6 by default.

Using the IPv6 networking stack is recommended because network interfaces get link-local fe80:: addresses automatically. No further configuration is therefore necessary for these interfaces.

If you need to use IPv4 networking rather than the recommended IPv6, then you will have to assign static IPv4 addresses to network interfaces manually. Do not assume your mobile hosts will get addresses from a DHCP server: there is no DHCP server in a mobile ad hoc network.

You will also need to change the following configuration properties in DoDWAN.

dodwan.interface_address
dodwan.local_address
dodwan.remote_address

Please see Configuration_properties for details about how to set these properties, and suggestions for generic values that can do in most circumstances.

Additionnaly, the route for sending IP packets to the DoDWAN multicast group should be set using an ipv4 address with a command such as the following one in a Linux host:

% sudo route add 236.1.2.3 dev wlan0

or this one on a Windows host:

> netsh interface ipv4 route add route 236.1.2.3/32 "Wireless Network Connection"

or this one on a Windows host:

Please note that whether you decide to use IPv4 or IPv6 transmissions, your choice must of course be consistent on all the hosts–and all instances of DoDWAN–in your network.

Changing the multicast group used by DoDWAN

Instances of DoDWAN running on different hosts use a single multicast group to communicate.

By default this group is an IPv6 multicast group with address ff02::236:1:2:3. You may of course decide to use another address, and configure all mobile hosts in your ad hoc network accordingly.

If you decide to change this address you must:

  1. set the remote_address property in DoDWAN’s configuration (see Configuration_properties) ;
  2. ensure there is a route to reach that address in the system’s routing table.

Changing the UDP port used by DoDWAN

Communication between instances of DoDWAN rely on the broadcast of UDP datagrams. By default UDP port #8500 is used for this purpose.

This port number can be changed by setting the dtn_port property in DoDWAN’s configuration parameters (see Configuration_properties).

Neighbor wireless hosts fail to communicate

You may sometimes observe circumstances when two neighbor hosts do not seem to be able to communicate in ad hoc mode.

There are many reasons why such a situation should occur. First you should of course check that both hosts are configured correctly (i.e. Wi-Fi chipset settings, IP settings, etc.), and possibly try to ping one host from the other host.

It may occur that the channel used by two neigbour hosts is not the same. On Linux, you have the possibility to choose the channel when configuring the Wi-Fi interface with iwconfig so it shouldn’t be a problem. On Windows, this parameter is not available for configuration. The system scans the differrent frequencies and adopts the channel on which it has detected a neighbor with the same SSID. When no such neighbor can be detected, the default channel is chosen. This default channel is often channel 1, so it a good idea to choose this channel if you have Windows hosts in your network. Note that some Wi-Fi chipset drivers allows a ”preferred channel” to be set. This preferred channel is then chosen as the default channel.

If there is apparently no problem with the hosts’ configuration, then it is worth checking that both Wi-Fi chipsets use the same BSSID. On linus thiscan be done with the following command:

% iwconfig wlan0 | head -2
wlan0     IEEE 802.11abgn ESSID:"DODWAN-ADHOC"
          Mode:Ad-Hoc Frequency:2.412 GHz Cell:3A:E6:D4:D8:B4:58

In this example interface wlan0 is configured to operate in ad hoc mode, and its current “cell” identifier (or BSSID) is 3A:E6:D4:D8:B4:58. On Windows, the command netsh wlan show interfaces gives also the BSSID.

The BSSID (Basic Service Set Id), as defined by the IEEE 802.11 standard, is a value that is used as some kind of “magic cookie” by mobile hosts. Two neighbor hosts can only communicate if they use the same BSSID value.

In a Wi-Fi network operating in infrastructure mode (that is, with an access point) the BSSID is determined by the access point, so that all hosts associated with this access point adopt the BSSID it has chosen.

In a Wi-Fi network operating in ad hoc mode, however, a distributed algorithm is used to set the BSSID, but all mobile hosts are still meant to share the same BSSID. Sometimes neighbor hosts fail to adopt the same value, and although they are within radio range of one another two hosts can use different BSSID values.

When such a situation occurs there is not much you can do, except maybe ensure that all mobile hosts in your ad hoc network feature similar Wi-Fi chipsets with similar drivers (this is not a guarantee, but it usually helps…).

Getting rid of DoDWAN network configuration

The network configuration described above for a Linux system is not persistent, so a simple reboot of your system is sufficient for completely cancelling it. Alternatively, you can use the provided script unset-dodwan-network.sh (run as root).

On the contrary, on Windows 7, the configuration of the Wi-Fi interface and the multicast route are maintained even after a reboot. You can use the following commands (run with Administrator privilege, and adapted to your own Wi-Fi interface) to get rid of them. The provided Powershell script unset-dodwan-network.ps1 (run with Administrator privilege) will normally do this job for you:

> netsh wlan disconnect "Wireless Network Connection"
Disconnection request is received successfully
> netsh wlan delete profile name=DODWAN
Profile "DODWAN-ADHOC" is deleted from interface "Wireless Network Connection"
> netsh interface ipv6 delete route interface="Wireless Network Connection" ff02::236:1:2:3/128
Ok

Running DoDWAN in a wired LAN

DoDWAN is primarily meant to run in a wireless mobile ad hoc network. Yet it can also be used in a wired LAN (typically an Ethernet network), notably for testing new applications before going wireless.

Basically, you simply need to make sure that the Ethernet interface on each host has an automatically-assigned link-local IPv6 address (that is, an address with prefix fe80::), and that it is enabled for multicast networking. You may also have to adjust the multicast address, or to set a route for multicast networking as explained in the former sections.