User Tools

Site Tools


wibed:example_ap

Wibed DNS capture tutorial

For this experiment we are gonna use the OpenWRT configuration tool UCI.

The objective is to capture the DNS requests/replies performed by the users attached to a HotSpot created in our experiment.

Configuration

It will create an AP device in the radio0 (2.4GHz), a network (192.168.100.0/24) with a dhcp server enabled and a firewall rule to masquerade (NAT) the packets from the AP clients to the Internet. Furthermore, tcpdump will be installed and finally it reboots the node to be sure all the new configuration is applied.

We have unified all this in a single script which will be included in our overlay.

/root/prepare_experiment.sh

uci set wireless.radio0.disabled=0
uci set wireless.ap0=wifi-iface
uci set wireless.ap0.ssid=HotSpot
uci set wireless.ap0.device=radio0
uci set wireless.ap0.network=lan
uci set wireless.ap0.mode=ap
uci set wireless.ap0.ifname=ap0
uci commit wireless
 
uci set network.lan=interface
uci set network.lan.type=bridge
uci set network.lan.proto=static
uci set network.lan.ipaddr=192.168.100.1
uci set network.lan.netmask=255.255.255.0
uci commit network
 
uci set dhcp.lan=dhcp
uci set dhcp.lan.interface=lan
uci set dhcp.lan.start=100
uci set dhcp.lan.limit=150
uci set dhcp.lan.leasetime=1h
uci set dhcp.lan.ignore=0
uci commit dhcp
 
echo "iptables -A POSTROUTING -t nat -s 192.168.100.0/24 -j MASQUERADE" >> /etc/rc.local
 
opkg update
opkg install tcpdump-mini
 
(sleep 30 && reboot) &

Also our overlay includes a script to start the experiment and capture the DNS data in a file.

→ Attention: this script is just an example, be careful with the Radio you are working with.

/root/run_experiment.sh

mkdir /save 2>/dev/null
tcpdump -n -i br-mgmt udp and port 53 > /save/dns.cap &

Installation

We pack these files inside a tar.gz compressed file.

cd /tmp
mkdir root
cp run_experimeht.sh root/
cp prepare_experiment.sh root/
tar cvzf dns-hotspot.tar.gz root

Then we create a new experiment in the WiBed controller, select the nodes we are going to use and upload the tar.gz file as overlay.

Execution

When nodes selected became READY (it means they have the overlay downloaded), we can start the experiment by pressing the button “START”.

The nodes then will install the overlay in the external USB memory and will restart to boot with the experimentation system loaded. Once it is achieved, the node becames in state RUNNING.

Now is time to execute our scripts to prepare and run the HotSpot. This time we will use the command execution system to perform both actions.

So we introduce the first command to prepare the overlay

sh /root/prepare_experiment.sh

And once the node has been rebooted (it will take between 30 and 50 seconds). We can execute the second script.

sh /root/run_experiment.sh

We can see the output of the command executed by clicking on the command link.

Now the wifi HotSpot is available and we are capturing the DNS headers in the file /save/dns.cap

To finish the experiment, we just press the button “FINISH” and the nodes will automatically go back to the original state.

wibed/example_ap.txt · Last modified: 2014/09/04 17:06 by ivilata