Thread Border Router using Linux + KW as Host Controlled Device with Serial TAP for DHCPv6-PD

Document created by Juan Carlos Pacheco Employee on May 3, 2017Last modified by Juan Carlos Pacheco Employee on May 3, 2017
Version 3Show Document
  • View in full screen mode

High level description to enable a Linux + KW41Z Border Router. Similar to how it’s shown for the K64 solution in the Kinetis Thread Stack Application Development Guide.


  1. Configure the OpenWrt router to assign the IPv6 ULA prefix 2001:2002:2003::/48. On the LAN network, the router distributes addresses from range 2001:2002:2003::/60
  2. Plug an Ethernet cable between the OpenWrt router and the Linux box. Before creating the Thread network, the Linux box has a global address on its eth interface from range 2001:2002:2003::/60. After creating the Thread network, the BR configures on its Serial TAP interface an address from range 2001:2002:2003::/60. On its 6LoWPAN interface, the BR configures an address from range 2001:2002:2003:c::/64. This is achieved with DHCPv6 prefix delegation - the router is requested to assign a new prefix space to be used by the Thread network. The forth segment in the IPv6 range might be 2, 4, 8 or c, depending of the number of DHCP-PD requests made to the router. After 4 attempts, the router will not lease any other prefixes for some time. In order to force that, you'd require to restart the odhcpd deamon in the OpenWrt router with the following command: /etc/init.d/odhcpd restart .
  3. Join the router eligible device, which configures an address in 2001:2002:2003::1/60. We then ping the "Internet" (the LAN interface on the OpenWrt router) and it works.


“fslthr0” interface must be bridged with an uplink interface connected to an OpenWrt DHCPv6-PD enabled router; it will act identically as the K64F solution.



  • Linux PC (Ubuntu)
  • OpenWrt AP/Router with DHCPv6-PD support (OpenWrt version used in this guide: OpenWrt Chaos Calmer 15.05.1)
    • For reference, hardware used on this guide: TP-Link Model TL-WR741ND 150Mbps Wireless N Router
    • OpenWRT firmware supports multiple hardware available at
  • 1 FRDM-KW41Z (Host Controlled Device, connected to Linux)
  • 1 FRDM-KW41Z (Router Eligible Device or any joiner device)
  • Thread version (from SDK builder at


Host Controlled Device firmware, enable the following macros:

  • THR_SERIAL_TUN_ROUTER        /source/config.h
  • THR_SERIAL_TAP_ROUTER         /app/common/app_serial_tun.h
  • SERIAL_TAP_ROUTER                  /base/ip_media_if/ip_if_serial_tun.c

 Note: There are plans to remove the THR_SERIAL_TUN_ROUTER define and leave only the TAP mode.


OpenWRT router

  • Configure IPv6 ULA-Prefix:

 OpenWrt configuration

  • Disable multicast_snooping on the OpenWrt router:

root@OpenWrt:~# echo 0 > /sys/devices/virtual/net/br-lan/bridge/multicast_snooping

Note: There are plans implement MLD for Thread, so disabling multicast_snooping will no longer be required.



  • Copy HSDK folder
  • Create fslthr0 TAP interface:

…/host_sdk/hsdk/demo#   sudo bash

  • Modify “Thread_KW_Tun” demo to enable the SERIAL_TAP macro

…/host_sdk/hsdk/demo#   nano Thread_KW_Tun.c

#define SERIAL_TAP 0   modify to:  #define SERIAL_TAP  1 

      Note: This will be the default configuration in the upcoming releases.

  • Bridge the interfaces; assuming eth1 is the interface connected directly to OpenWrt:

# brctl addbr br0

# brctl addif br0 eth1

# brctl addif br0 fslthr0

# ifconfig br0 up

  • Disable multicast_snooping, a mechanism that will sometimes filter devices not responding to MLD (the Thread BR does not yet implement MLD)

# echo 0 | tee /sys/devices/virtual/net/br0/bridge/multicast_snooping

      Note: There are plans implement MLD for Thread, so disabling multicast_snooping will no longer be required. 


  • Note: (Optional) Addresses on the bridged interfaces are lost and need to be reconfigured on the actual bridge. In this example, after bridging eth3 (interface to OpenWrt router), you’d have to run # dhclient br0 to get an IPv4 address on br0 for SSH to the router. There's a note here  about this.


  • Build C demos

…/host_sdk/hsdk/demo#   make

  • Run Thread_KW_Tun demo

…/host_sdk/hsdk/demo#   sudo ./bin/Thread_KW_Tun /dev/ttyACM0 fslthr0


nwk interfaces


kw_tun app


Joiner FRDM-KW41Z (shell)

  • Join the Thread network
  • Verify IP addresses
  • Ping Eth LAN interface on OpenWrt router to verify “Internet” connectivity 


joiner shell




5 people found this helpful