Emulab Tutorial - Using Wireless Networking

Some Emulab nodes may contain wireless interfaces, and those nodes may be scattered around at various locations. To find out where those nodes are located and what their node IDs are, see the wireless floormaps page. When you click on one of the colored dots, you will be taken to a page describing the node and what type of interfaces the node has installed in it.

Before using a wireless network interface in an experiment, please read the following Acceptable Use Policy (AUP) regarding wireless interfaces. By using our wireless nodes, you agree to be bound by this AUP. Creating an Experiment with Wireless-Capable Nodes:

To use a wireless network in an experiment, you must provide a few Emulab specific NS directives in your NS file, which are illustrated in the following small example:
	source tb_compat.tcl
	set ns [new Simulator]

	# Allocate the nodes.  Their "wifi-ness" is determined later,
	# by the type of networks you request to be set up on them.
	set nodew1 [$ns node]
	set nodew2 [$ns node]
	set nodew3 [$ns node]
	set node4  [$ns node]

	# A wireless lan connecting the first three nodes.
	set lan0 [$ns make-lan "nodew1 nodew2 nodew3" 54Mb 0ms]

	# A regular duplex link from a wireless-capable node to a plain node.
	set link0 [$ns duplex-link $nodew1 $node4 100Mb 0ms DropTail]

	# Choose the wireless lan protocol.
	tb-set-lan-protocol $lan0 "80211g"

	# You must choose which node acts as the access point.
	tb-set-lan-accesspoint $lan0 $nodew1

	# Choose some other settings.
	tb-set-lan-setting $lan0 "channel" 2
	tb-set-node-lan-setting $lan0 $nodew1 "txpower" "auto"

	# Currently you must use Redhat 9.0 on wireless nodes.
	# Let the other node default to RHL-STD (currently 7.3).
	tb-set-node-os $nodew1 RHL90-WIRELESS
	tb-set-node-os $nodew2 RHL90-WIRELESS
	tb-set-node-os $nodew3 RHL90-WIRELESS

	# Turn on static routing.
	$ns rtproto Static
	$ns run			
A few points should be noted: Numerous interface settings are possible using tb-set-lan-setting and tb-set-node-lan-setting. These mostly correspond to options that are available using the iwconfig command on Redhat 9.0. Not all options are accepted by all cards, and the format of the value you provide for the option must be acceptable to iwconfig. At some point in the future we hope to make this more explicit so that know exactly what options are available each type of card, and what their legal values are. For now you have to be something of an expert. Here is a rough guide to what you can currently specify: After your experiment is swapped in, the above settings (including the accesspoint) can be changed on the fly, using either the link_config script on users.emulab.net, or with the XMLRPC interface. For example, if you want to change the accesspoint of a lan, first determine the MAC address (dotted or undotted notation is fine) of the interface you want to be the accesspoint, and then use link_config:
	link_config myproj myexp lan0 accesspoint=00:09:5B:94:26:AF
Or you can use the XMLRPC interface from your desktop or from users.
	sshxmlrpc_client.py link_config proj=myproj exp=myexp
		link=lan0 "params={'accesspoint': '00:09:5B:94:26:AF'}"
You may also change the settings for an individual node in a wireless lan (although in some cases this could make the lan unusable if you were to change a setting on just a single node). To do this, use the -s option to link_config or the src argument to the XMLRPC interface:
	link_config -s nodew1 myproj myexp lan0 txpower=50

	sshxmlrpc_client.py link_config proj=myproj exp=myexp
		src=nodew1 link=lan0 "params={'txpower': 50}"
To enable and disable the interface for individual nodes on the lan:
	link_config -s nodew1 myproj myexp lan0 enable=no
	link_config -s nodew1 myproj myexp lan0 enable=yes

	sshxmlrpc_client.py link_config proj=myproj exp=myexp
		src=nodew1 link=lan0 "params={'enable': 'no'}"

Note this currently operates by bringing the interface up/down with
the ifconfig command. 


Choosing Physical Nodes:

As mentioned above, Emulab's default mapping of nodes in your virtual topology, to physical nodes with wireless interfaces, does not currently take into account physical connectivity (walls, floors, electrical conduits, etc. all conspire to make it possible that two wireless nodes 50 apart from each other will not actually be able to communicate with each other). We are planning to add this capability in the future, but in the meantime it is mostly up to you to choose nodes that make sense for your topology. You might end up having to make some trial and error runs, trying to find the right set of nodes (including setting the accesspoint to different nodes in a lan) before you get a working set.

To assist in this chore there are two Emulab specific NS extensions you can use in your NS file. The first approach is to use the tb-use-physnaming extension.
	tb-use-physnaming 1
	
	set pc222 [$ns node]
	set pc223 [$ns node]
	set pc224 [$ns node] 
which says that whenever a node is named by an existing physical node in the testbed, do an implicit fix-node. This saves a little bit of typing, and in some cases might be easier to manage then the second approach, which is to use tb-fix-node for all (or some) of the nodes in your lan. Using the wireless floormaps choose which nodes you want, and then in your NS file:
	set nodew1 [$ns node]
	set nodew2 [$ns node]
	set nodew3 [$ns node]

	tb-fix-node $nodew1 pc222
	tb-fix-node $nodew2 pc223
	tb-fix-node $nodew3 pc224 
Keep in mind that the physical nodes you choose must be free when you swap in your experiment!