Using ns-3 emulation to experiment with Wireless Mesh Network Routing: Lessons learned José Núñez-Martínez Research Engineer Centre Tecnologic de Telecomunicacions de Catalunya 25/03/2011 Goal of this talk Give the implementation details of porting the implementation of a routing protocol to a real WMN testbed by means of ns-3 emulation framework Initial results on the the performance evaluation of the ns-3 emulation framework in a real testbed 2 Outline • • • • • Testbed Setup Ns-3 WMR Main changes in the routing protocol Performance Evaluation Conclusions 3 Outline • • • • • Testbed Setup Ns-3 WMR Implications in the routing protocol Performance Evaluation Conclusions 4 Wireless Mesh Node • Motherboard: • Portwell Mini-ITX 1.6Ghz processor • Storage: • 80Gb PATA hard disk. • Wireless Interfaces • up to four mini-PCI CM9 atheros wireless • 54Mbps • 5Ghz band pseudo ad-hoc mode, one antenna • 3G Femtocell connected through Ethernet iface via Switch • OS • Linux Fedora Core 2.6.32 • Madwifi 0.9.4 5 Wireless Mesh Testbed • Deployed in the first floor of the CTTC building • An approximate area of 1200 square meters • 12 WiFi nodes acting as Wireless Mesh Routers • Static and non-power constrained • Backbone wireless mesh network • Using 1 WiFi interface and 1 Ethernet to connect Femtocells • Wifi Mesh initially set up to single radio single channel • Network control via Ethernet LAN Controller for remote management purposes 6 Wireless Mesh Tesbed Deployment 7 Testbed Routing Configuration • Flows directed to a Femtocell • Add static routes to packets directed to the Femtocell connected by Ethernet Interface • Backpressure to route packets to another Femtocell not directly connected by Ethernet Interface • Flows coming from a Femtocell • Static Default route added to reach the WMR directly connected via Ethernet Interface • Static Default route of the GW in the mesh to reach Core Network • Flows originated at the WMR • Generate them within ns-3 8 Outline • • • • • Testbed Setup Ns-3 WMR Implications in the routing protocol Performance Evaluation of ns3 Conclusions 9 Ns-3 WMR configuration • EmuNetDevice associated to each interface • associated to ath0 Ptr<EmuNetDevice> device = CreateObject<EmuNetDevice> (); device->SetAttribute ("Address", Mac48AddressValue ("00:0b:6b:81:ce:2a"); device->SetAttribute ("DeviceName", StringValue (deviceName)); • Static Routing and Backpressure Routing • Static routing more priority than backpressure routing and removed routes associated in static routing to use backpressure routing list.Add (staticRouting, 10); // static routing list.Add (backpressure, 0); //dynamic backpressure routing staticRouting->RemoveRoute (1); //so that backpressure would be used to route within the WMN 10 Ns-3 WMR configuration • To disable ARP in the testbed, fix static ARP entries in the node interfaces • Create ARP cache Ptr<ArpCache> arp = CreateObject<ArpCache> (); arp->SetAliveTimeout (Seconds(3600*24*365)); • Add ARP cache entry Mac48Address macAddr = Mac48Address("00:0b:6b:81:ce:2a"); Ipv4Address ipAddr = Ipv4Address("10.3.40.193"); ArpCache::Entry * entry = arp->Add(ipAddr); entry->MarkWaitReply(0); entry->MarkAlive(macAddr); • Associate Arp Cache to the IP interface ipIface->SetAttribute("ArpCache", PointerValue(arp)); 11 Outline • • • • • Testbed Setup Ns-3 WMR Implications in the routing protocol Ns-3 Emulation Performance Evaluation Conclusions 12 Dynamic Backpressure Routing protocol Implementation • EMU_MODE/SIMU_MODE • depending on the mode there are some changes in the routing protocol module backpressure.Set("Mode", EnumValue(EMU_MODE)); • Due to the particularities of dynamic backpressure routing there are some coding differences • Interaction with WiFi MAC Queues • Routing Protocol require some adjustments in emulation mode 13 Transmission Opportunities in EMU_MODE • Recall that packets coming from upper//lower layers are not necessarily immediately forwarded • Instead of this they are stored waiting for transmission opportunities • In SIMU_MODE a callback from WiFi MAC layer is launched whenever there are free data slots in the WiFi MAC Layer • In this case the real host has to tell somehow to ns-3 whether there is a new transmission opportunity or not 14 Interaction between ns3 and madwifi driver 15 Interacion between NS-3 and Madwifi driver • Madwifi patched to trigger interruption • Create a file in /proc/sys/ • Patch madwifi driver to Write in /proc/sys/ file when the HW buffer is full • Another write event when HW buffer is not full • In the ns-3 dynamic backpressure routing module create a thread waiting for some write event on a file in /proc/sys/ • Use select() system call waiting for a write event • Continuous transmission opportunity in the routing module by default • When the thread is unblocked and previously was idle transmission opportunities are locked 16 Outline • • • • • Testbed Setup Ns-3 WMR Implications in the routing protocol Ns-3 Emulation Performance Evaluation Conclusions 17 NS-3 Mac Spoofing • Be careful with the selected MAC address to spoof • BSSID_MASK: mask to set up potential mac addresses of the VAPS associated to a WiFi card • Not every random mac address is appropriate at least for WiFi cards • In madWiFi higher bits of the mac address identify the VAP • With MAC addresses which do not satisfy BSSID_MASK the WiFi card discard data packets though some of them are able to be processed 18 NS-3 performance Processing • Linux host saturating a WiFi interface in 802.11a mode 4000pkts per second payload 1024bytes • Ns-3 WMR processing packets • EmuNetDevice RxQueueSize • Performance degradation due to queue drops in EmuNetDevice • Appropiate EmuNetDevice queue size 19 NS-3 performance Sending • Ns-3 WMR saturating WiFi interface • Performance at the receiver • UDP traffic 4000pkts per second during 30seconds 20 Outline • • • • • Testbed Setup Ns-3 WMR Implications in the routing protocol Ns-3 Emulation Performance Evaluation Conclusions 21 Conclusions • Implementation particularities of the routing protocol and ns3 WMR router configuration • Main issues with respect to ns-3 simulation are given by the interaction with the testbed • But essentials of the routing protocol do not change • HELLO messages, routing algorithm • Initial ns-3 Emulation Performance Evaluation is satisfactory but more tests are needed • Delays 22 Thanks for your kind attention! • Questions? José Núñez-Martínez Research Engineer Centre Tecnologic de Telecomunicacions de Catalunya jose.nunez@cttc.cat 23 Receiving and Transmitting • Ns-3 WMR receiving and transmitting 2000 packets second • Wifi card prioritizes packet reception (i.e., red flow) • Ns-3 WMR receiving and transmitting at a rate of 1000 packets per second 24