Converting Asus WL-500g Deluxe and TP-Link TL-WR1043ND to OpenFlow switches (Part 1)

In this guide I will install OpenWrt Backfire on these routers with OpenFlow package.

WARNING: you may brick your router if version is > 1.7!
See Version/Model table

Device: TP-Link TL-WR1043ND Ver: 1.6
FCC ID: TE7WR1043NX
CPU: Atheros AR9132
RAM: 32 MB
Flash: 8 MB
Network: 4 + 1 ports (10/100/1000 Mb/s)
IP address before: 192.168.1.1
IP address after: 192.168.1.2
Software before: TL-WR1043ND_v1_130428
Version: 3.13.13 Build 130428 Rel.58290n

Software after: OpenWrt Backfire
Version: 10.03.1 (r33081)

OpenFlow
Stanford reference implementation
Version: 1.0
Device: Asus WL-500g Deluxe
FCC ID: MSQWL500GD
CPU: Broadcom 5365
RAM: 32 MB
Flash: 4 MB
Network: 4 + 1 ports (10/100 Mb/s)
IP address: 192.168.1.1
Software before: WL-500gD English Firmware
Version: 1.9.6.0
Software after: OpenWrt Backfire
Version: 10.03.1 (r33081)
OpenFlow

Stanford reference implementation
Version: 1.0

Build system:
Fedora 19 (64 bit)

If you are not using Fedora 19, you should virtualize it:
Installing Fedora 19 (64 bit) in VirtualBox

Building OpenWrt with OpenFlow package

  1. Open a terminal (by clicking Activities, typing “terminal” and press Enter)
  2. Update Fedora
    $ sudo yum -y update

    Enter your password
    Press Enter

  3. Install the packages that necessary to build OpenWrt
     $ sudo yum -y install git subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker glibc glibc-devel glibc-static quilt sed sdcc intltool sharutils bison wget

    Note: All packages are necessary but some of them may has been already installed. And I am not wrong, you need subversion package because scripts use it.
    Enter your password
    Press Enter

  4. Download OpenWrt Backfire source from the OpenWrt Git repository:
    $ git clone git://git.openwrt.org/10.03/openwrt.git
  5. Get in the downloaded directory
    $ cd openwrt
  6. Update and install feeds
    $ ./scripts/feeds update -a
    $ ./scripts/feeds install -a
  7. Get out from openwrt directory
    $ cd ..
  8. Download the Stanford reference implementation of OpenFlow 1.0
    $ git clone git://gitosis.stanford.edu/openflow-openwrt

    If it doesn’t work here is a copy of it one my site: openflow-openwrt.tar.gz
    In this case you must extract it: $ tar -zxvf openflow-openwrt.tar.gz

  9. Get in the downloaded directory
    $ cd openflow-openwrt
  10. Move to the Broadcom branch
    $ git checkout -b openflow-1.0/brcm origin/openflow-1.0/brcm
  11. Link OpenFlow extension and configuration files in the OpenWrt directory
    $ cd ~/openwrt/package
    $ ln -s ~/openflow-openwrt/openflow-1.0/
    $ cd ..
    $ ln -s ~/openflow-openwrt/openflow-1.0/files
  12. Configure the build
    $ make menuconfig

    Select “Target System (…) —>”
    Select “Broadcom BCM947xx/953xx”
    Select “Target Profile (…) —>”
    Select “No WiFi”
    Select “Network —>”
    Check “openflow” package (to built-in <*>)
    Check “tc” package (to built-in <*>)
    Exit
    Select “Kernel modules —>”
    Select “Network Support —>”
    Check “kmod-tun” package (to built-in <*>)
    Exit
    Exit
    Select “Utilites —>”
    Select “Editors —>”
    Check “nano” package (to built-in <*>)
    Exit
    Exit
    Exit
    A dialog asks you here “Do you wish to save your new OpenWrt configuration?”
    Select Yes and Press Enter

  13. Make the toolchain for the target
    $ make tools/install toolchain/install
  14. Configure the Linux kernel
    $ make kernel_menuconfig

    Select Networking Support
    Select Networking options
    Select QoS and/or fair queueing
    Check Hierarchical Token Bucket (HTB) (to built-in <*>)
    Exit
    Exit
    Exit
    Exit
    Select Yes and Press Enter

  15. Build the OpenWrt image
    $ make
  16. Get out from openwrt directory
    $ cd ..
  17. Copy the created general firmware to here
    $ cp openwrt/bin/brcm47xx/openwrt-brcm47xx-squashfs.trx .

    This will be the firmware for Asus WL-500g Deluxe.

  18. Enter to openwrt directory again
    $ cd openwrt
  19. Clean everything
    $ make clean tools/clean toolchain/clean

    Note: a toolchain/clean should be enough here (but I don’t want to meet OpenWrt bugs)

  20. Get out from openwrt directory
    $ cd ..
  21. Get in the openflow directory
    $ cd openflow-openwrt
  22. Move to the TP-Link branch
    $ git checkout -b openflow-1.0/tplink origin/openflow-1.0/tplink
  23. Get to the openwrt directory
    $ cd ~/openwrt
  24. Configure the build
    $ make menuconfig

    Select “Reset to defaults”
    Select “Target System (…) —>”
    Select “Atheros AR71xx/AR7240/AR913x”
    Select “Target Profile (…) —>”
    Select “TP-LINK TL-WR1043ND v1”
    Note: From Backfire version of OpenWrt the Wifi module is automatically built in this platform, so we must clear it later from selection. DO NOT select “Default Profile (no WiFi)” here!
    Select “Network —>”
    Check “openflow” package (to built-in <*>)
    Check “tc” package (to built-in <*>)
    Uncheck “wpad-mini” package
    Exit
    Select “Kernel modules —>”
    Select “Network Support —>”
    Check “kmod-tun” package (to built-in <*>)
    Exit
    Select “Wireless Drivers”
    Uncheck “kmod-ath9k”
    Exit
    Exit
    Select “Utilites —>”
    Select “Editors —>”
    Check “nano” package (to built-in <*>)
    Exit
    Exit
    Exit
    A dialog asks you here “Do you wish to save your new OpenWrt configuration?”
    Select Yes and Press Enter

  25. Make the toolchain for the target
    $ make tools/install toolchain/install

    Note: If you have not cleaned tools than tools/install is not necessary.

  26. Configure the Linux kernel
    $ make kernel_menuconfig

    Select Networking Support
    Select Networking options
    Select QoS and/or fair queueing
    Check Hierarchical Token Bucket (HTB) (to built-in <*>)
    Exit
    Exit
    Exit
    Exit
    Select Yes and Press Enter

  27. Build the OpenWrt image
    $ make
  28. Get out from openwrt directory
    $ cd ..
  29. Copy the created general firmware to here
    $ cp openwrt/bin/ar71xx/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-factory.bin .

    This will be the firmware for TP-Link TL-WR1043ND.

  30. You can safely remove the created directories:
    $ rm -rf ~/openwrt ~/openflow-openwrt

Congratulation! You have built the OpenFlow capable OpenWrt firmwares for these devices.

Jump to: Converting Asus WL-500g Deluxe and TP-Link TL-WR1043ND to OpenFlow switches (Part 2)

Leave a Reply

Your email address will not be published. Required fields are marked *