diff --git a/tests/daemon/fw/link-forwarding.t.cpp b/tests/daemon/fw/link-forwarding.t.cpp
new file mode 100644
index 0000000..864d598
--- /dev/null
+++ b/tests/daemon/fw/link-forwarding.t.cpp
@@ -0,0 +1,202 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2017,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "fw/best-route-strategy2.hpp"
+
+#include "topology-tester.hpp"
+
+namespace nfd {
+namespace fw {
+namespace tests {
+
+using namespace nfd::tests;
+
+BOOST_AUTO_TEST_SUITE(Fw)
+BOOST_AUTO_TEST_SUITE(TestLinkForwarding)
+
+/**
+ *      /arizona/cs/avenir
+ *              |
+ *              v
+ *      /arizona/cs/hobo
+ *      |              |
+ *      v              v
+ *  /telia/terabits    /ucsd/caida/click
+ *        |                 |
+ *        v                 v
+ *  /net/ndnsim        /ucla/cs/spurs
+ *   (serverP)              |
+ *                          v
+ *                     /net/ndnsim
+ *                      (serverQ)
+ */
+class NdnsimTeliaUclaTopologyFixture : public UnitTestTimeFixture
+{
+public:
+  NdnsimTeliaUclaTopologyFixture()
+  {
+    topo.enablePcap();
+
+    nodeA = topo.addForwarder("avenir");
+    nodeH = topo.addForwarder("hobo");
+    nodeT = topo.addForwarder("terabits");
+    nodeP = topo.addForwarder("serverP");
+    nodeC = topo.addForwarder("click");
+    nodeS = topo.addForwarder("spurs");
+    nodeQ = topo.addForwarder("serverQ");
+    for (TopologyNode node : {nodeA, nodeH, nodeT, nodeP, nodeC, nodeS, nodeQ}) {
+      topo.setStrategy<BestRouteStrategy2>(node);
+    }
+
+    topo.getForwarder(nodeA).getNetworkRegionTable().insert("/arizona/cs/avenir");
+    topo.getForwarder(nodeH).getNetworkRegionTable().insert("/arizona/cs/hobo");
+    topo.getForwarder(nodeT).getNetworkRegionTable().insert("/telia/terabits/router");
+    topo.getForwarder(nodeP).getNetworkRegionTable().insert("/telia/terabits/serverP");
+    topo.getForwarder(nodeC).getNetworkRegionTable().insert("/ucsd/caida/click");
+    topo.getForwarder(nodeS).getNetworkRegionTable().insert("/ucla/cs/spurs");
+    topo.getForwarder(nodeQ).getNetworkRegionTable().insert("/ucla/cs/serverQ");
+
+    linkAH = topo.addLink("AH", time::milliseconds(10), {nodeA, nodeH});
+    linkHT = topo.addLink("HT", time::milliseconds(10), {nodeH, nodeT});
+    linkTP = topo.addLink("TP", time::milliseconds(10), {nodeT, nodeP});
+    linkHC = topo.addLink("HC", time::milliseconds(10), {nodeH, nodeC});
+    linkCS = topo.addLink("CS", time::milliseconds(10), {nodeC, nodeS});
+    linkSQ = topo.addLink("SQ", time::milliseconds(10), {nodeS, nodeQ});
+    consumerA = topo.addAppFace("avenir", nodeA);
+    producerP = topo.addAppFace("ndnsimP", nodeP, "/net/ndnsim");
+    producerQ = topo.addAppFace("ndnsimQ", nodeQ, "/net/ndnsim");
+
+    topo.addEchoProducer(producerP->getClientFace());
+    topo.addEchoProducer(producerQ->getClientFace());
+
+    topo.registerPrefix(nodeA, linkAH->getFace(nodeA), "/", 10);
+    topo.registerPrefix(nodeH, linkHT->getFace(nodeH), "/telia", 10);
+    topo.registerPrefix(nodeT, linkTP->getFace(nodeT), "/net/ndnsim", 10);
+    topo.registerPrefix(nodeH, linkHC->getFace(nodeH), "/ucla", 20);
+    topo.registerPrefix(nodeC, linkCS->getFace(nodeC), "/ucla", 10);
+    topo.registerPrefix(nodeS, linkSQ->getFace(nodeS), "/net/ndnsim", 10);
+
+    linkObject = makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}});
+  }
+
+  /** \brief express an Interest with Link object from consumerA
+   */
+  void
+  consumerExpressInterest(int seq)
+  {
+    auto interest = makeInterest(Name("/net/ndnsim").appendNumber(seq));
+    interest->setLink(linkObject->wireEncode());
+    consumerA->getClientFace().expressInterest(*interest, nullptr, nullptr, nullptr);
+  }
+
+public:
+  TopologyTester topo;
+  TopologyNode nodeA, nodeH, nodeT, nodeP, nodeC, nodeS, nodeQ;
+  shared_ptr<TopologyLink> linkAH, linkHT, linkTP, linkHC, linkCS, linkSQ;
+  shared_ptr<TopologyAppLink> consumerA, producerP, producerQ;
+  shared_ptr<Link> linkObject;
+};
+
+BOOST_FIXTURE_TEST_SUITE(NdnsimTeliaUclaTopology, NdnsimTeliaUclaTopologyFixture)
+
+BOOST_AUTO_TEST_CASE(FetchTelia)
+{
+  this->consumerExpressInterest(1);
+  this->advanceClocks(time::milliseconds(11), 20);
+
+  // A forwards Interest according to default route, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
+  const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestAH.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestAH.hasSelectedDelegation(), false);
+
+  // H prefers T, and sets SelectedDelegation
+  BOOST_CHECK_EQUAL(linkHT->getFace(nodeH).getCounters().nOutInterests, 1);
+  const Interest& interestHT = topo.getPcap(linkHT->getFace(nodeH)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestHT.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestHT.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestHT.getSelectedDelegation(), "/telia/terabits");
+
+  // T forwards to P, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkTP->getFace(nodeT).getCounters().nOutInterests, 1);
+  const Interest& interestTP = topo.getPcap(linkTP->getFace(nodeT)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestTP.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestTP.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestTP.getSelectedDelegation(), "/telia/terabits");
+
+  // Data is served by P and reaches A
+  BOOST_CHECK_EQUAL(producerP->getForwarderFace().getCounters().nInData, 1);
+  BOOST_CHECK_EQUAL(consumerA->getForwarderFace().getCounters().nOutData, 1);
+}
+
+BOOST_AUTO_TEST_CASE(FetchUcla)
+{
+  // disconnect H-T and delete FIB entry
+  linkHT->fail();
+  topo.getForwarder(nodeH).getFib().erase("/telia");
+
+  this->consumerExpressInterest(1);
+  this->advanceClocks(time::milliseconds(11), 20);
+
+  // A forwards Interest according to default route, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
+  const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestAH.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestAH.hasSelectedDelegation(), false);
+
+  // H forwards to C, and sets SelectedDelegation
+  BOOST_CHECK_EQUAL(linkHC->getFace(nodeH).getCounters().nOutInterests, 1);
+  const Interest& interestHC = topo.getPcap(linkHC->getFace(nodeH)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestHC.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestHC.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestHC.getSelectedDelegation(), "/ucla/cs");
+
+  // C forwards to S, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkCS->getFace(nodeC).getCounters().nOutInterests, 1);
+  const Interest& interestCS = topo.getPcap(linkCS->getFace(nodeC)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestCS.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestCS.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestCS.getSelectedDelegation(), "/ucla/cs");
+
+  // S forwards to Q, no change to Link and SelectedDelegation
+  BOOST_CHECK_EQUAL(linkSQ->getFace(nodeS).getCounters().nOutInterests, 1);
+  const Interest& interestSQ = topo.getPcap(linkSQ->getFace(nodeS)).sentInterests.at(0);
+  BOOST_CHECK_EQUAL(interestSQ.hasLink(), true);
+  BOOST_CHECK_EQUAL(interestSQ.hasSelectedDelegation(), true);
+  BOOST_CHECK_EQUAL(interestSQ.getSelectedDelegation(), "/ucla/cs");
+
+  // Data is served by Q and reaches A
+  BOOST_CHECK_EQUAL(producerQ->getForwarderFace().getCounters().nInData, 1);
+  BOOST_CHECK_EQUAL(consumerA->getForwarderFace().getCounters().nOutData, 1);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // NdnsimTeliaUclaTopology
+
+BOOST_AUTO_TEST_SUITE_END() // TestLinkForwarding
+BOOST_AUTO_TEST_SUITE_END() // Fw
+
+} // namespace tests
+} // namespace fw
+} // namespace nfd
diff --git a/tests/daemon/fw/strategy.t.cpp b/tests/daemon/fw/strategy.t.cpp
index 72d43b4..11f3f38 100644
--- a/tests/daemon/fw/strategy.t.cpp
+++ b/tests/daemon/fw/strategy.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -100,147 +100,7 @@
   BOOST_CHECK((strategy.removedFaces == std::vector<FaceId>{id2, id1}));
 }
 
-class LookupFibFixture : public BaseFixture
-{
-protected:
-  class TestStrategy : public DummyStrategy
-  {
-  public:
-    explicit
-    TestStrategy(Forwarder& forwarder)
-      : DummyStrategy(forwarder)
-    {
-    }
-
-    const fib::Entry&
-    lookupFib(const pit::Entry& pitEntry) const
-    {
-      return this->Strategy::lookupFib(pitEntry);
-    }
-  };
-
-  LookupFibFixture()
-    : strategy(forwarder)
-    , fib(forwarder.getFib())
-    , pit(forwarder.getPit())
-    , nrt(forwarder.getNetworkRegionTable())
-    , inFace(make_shared<DummyFace>())
-    , outFace(make_shared<DummyFace>())
-    , link(makeLink("/net/ndnsim", {{10, "/telia/terabits"}, {20, "/ucla/cs"}}))
-  {
-    forwarder.addFace(inFace);
-    forwarder.addFace(outFace);
-  }
-
-  const fib::Entry&
-  lookupFib(Interest& interest)
-  {
-    shared_ptr<pit::Entry> pitEntry = pit.insert(interest).first;
-    pitEntry->insertOrUpdateInRecord(*inFace, interest);
-    return strategy.lookupFib(*pitEntry);
-  }
-
-protected:
-  Forwarder forwarder;
-  TestStrategy strategy;
-  Fib& fib;
-  Pit& pit;
-  NetworkRegionTable& nrt;
-
-  shared_ptr<Face> inFace;
-  shared_ptr<Face> outFace;
-  shared_ptr<Link> link;
-};
-
-BOOST_FIXTURE_TEST_SUITE(LookupFib, LookupFibFixture)
-
-BOOST_AUTO_TEST_CASE(NoLink)
-{
-  fib.insert("/net/ndnsim").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/net/ndnsim");
-  BOOST_CHECK_EQUAL(interest->hasSelectedDelegation(), false);
-}
-
-BOOST_AUTO_TEST_CASE(ConsumerRegion)
-{
-  nrt.insert("/arizona/cs/avenir");
-  fib.insert("/").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/");
-  BOOST_CHECK_EQUAL(interest->hasSelectedDelegation(), false);
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeFirstDelegation)
-{
-  nrt.insert("/arizona/cs/hobo");
-  fib.insert("/telia").first->addNextHop(*outFace, 20);
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/telia");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/telia/terabits");
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeSecondDelegation)
-{
-  nrt.insert("/arizona/cs/hobo");
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/ucla");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_CASE(DefaultFreeHasSelectedDelegation)
-{
-  nrt.insert("/ucsd/caida/click");
-  fib.insert("/telia").first->addNextHop(*outFace, 10);
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  interest->setSelectedDelegation("/ucla/cs");
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/ucla");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_CASE(ProducerRegion)
-{
-  nrt.insert("/ucla/cs/spurs");
-  fib.insert("/").first->addNextHop(*outFace, 10);
-  fib.insert("/ucla").first->addNextHop(*outFace, 10);
-  fib.insert("/net/ndnsim").first->addNextHop(*outFace, 10);
-
-  auto interest = makeInterest("/net/ndnsim/www/index.html");
-  interest->setLink(link->wireEncode());
-  interest->setSelectedDelegation("/ucla/cs");
-  const fib::Entry& fibEntry = this->lookupFib(*interest);
-
-  BOOST_CHECK_EQUAL(fibEntry.getPrefix(), "/net/ndnsim");
-  BOOST_REQUIRE_EQUAL(interest->hasSelectedDelegation(), true);
-  BOOST_CHECK_EQUAL(interest->getSelectedDelegation(), "/ucla/cs");
-}
-
-BOOST_AUTO_TEST_SUITE_END() // LookupFib
+// LookupFib is tested in Fw/TestLinkForwarding test suite.
 
 BOOST_AUTO_TEST_SUITE_END() // TestStrategy
 BOOST_AUTO_TEST_SUITE_END() // Fw
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 5742592..ad68447 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -114,6 +114,37 @@
   m_clientTransport->connectToForwarder(m_forwarderTransport);
 }
 
+class TopologyPcapLinkService : public GenericLinkService
+                              , public TopologyPcap
+{
+private:
+  ///\todo #3941 call GenericLinkServiceCounters constructor in TopologyPcapLinkService constructor
+
+  void
+  doSendInterest(const Interest& interest) override
+  {
+    this->sentInterests.push_back(interest);
+    this->sentInterests.back().setTag(std::make_shared<TopologyPcapTimestamp>(time::steady_clock::now()));
+    this->GenericLinkService::doSendInterest(interest);
+  }
+
+  void
+  doSendData(const Data& data) override
+  {
+    this->sentData.push_back(data);
+    this->sentData.back().setTag(std::make_shared<TopologyPcapTimestamp>(time::steady_clock::now()));
+    this->GenericLinkService::doSendData(data);
+  }
+
+  void
+  doSendNack(const lp::Nack& nack) override
+  {
+    this->sentNacks.push_back(nack);
+    this->sentNacks.back().setTag(std::make_shared<TopologyPcapTimestamp>(time::steady_clock::now()));
+    this->GenericLinkService::doSendNack(nack);
+  }
+};
+
 TopologyNode
 TopologyTester::addForwarder(const std::string& label)
 {
@@ -139,7 +170,8 @@
     Forwarder& forwarder = this->getForwarder(i);
     FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/" + label);
 
-    auto service = make_unique<GenericLinkService>();
+    unique_ptr<GenericLinkService> service = m_wantPcap ? make_unique<TopologyPcapLinkService>() :
+                                                          make_unique<GenericLinkService>();
     auto transport = make_unique<InternalForwarderTransport>(localUri, remoteUri,
                      ndn::nfd::FACE_SCOPE_NON_LOCAL, linkType);
     auto face = make_shared<Face>(std::move(service), std::move(transport));
@@ -159,7 +191,8 @@
   FaceUri localUri("topology://" + m_forwarderLabels.at(i) + "/local/" + label);
   FaceUri remoteUri("topology://" + m_forwarderLabels.at(i) + "/app/" + label);
 
-  auto service = make_unique<GenericLinkService>();
+  unique_ptr<GenericLinkService> service = m_wantPcap ? make_unique<TopologyPcapLinkService>() :
+                                                        make_unique<GenericLinkService>();
   auto transport = make_unique<InternalForwarderTransport>(localUri, remoteUri,
                    ndn::nfd::FACE_SCOPE_LOCAL, ndn::nfd::LINK_TYPE_POINT_TO_POINT);
   auto face = make_shared<Face>(std::move(service), std::move(transport));
@@ -180,6 +213,18 @@
 }
 
 void
+TopologyTester::enablePcap(bool isEnabled)
+{
+  m_wantPcap = isEnabled;
+}
+
+TopologyPcap&
+TopologyTester::getPcap(const Face& face)
+{
+  return dynamic_cast<TopologyPcapLinkService&>(*face.getLinkService());
+}
+
+void
 TopologyTester::registerPrefix(TopologyNode i, const Face& face, const Name& prefix, uint64_t cost)
 {
   Forwarder& forwarder = this->getForwarder(i);
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index ec122b6..9f97413 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+ * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -157,6 +157,20 @@
   shared_ptr<ndn::Face> m_client;
 };
 
+/** \brief captured packets on a face
+ */
+class TopologyPcap : noncopyable
+{
+public:
+  std::vector<Interest> sentInterests;
+  std::vector<Data> sentData;
+  std::vector<lp::Nack> sentNacks;
+};
+
+/** \brief captured packet timestamp tag
+ */
+using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::TimePoint, 0>;
+
 /** \brief builds a topology for forwarding tests
  */
 class TopologyTester : noncopyable
@@ -209,6 +223,17 @@
   shared_ptr<TopologyAppLink>
   addAppFace(const std::string& label, TopologyNode i, const Name& prefix, uint64_t cost = 0);
 
+  /** \brief enables packet capture on every forwarder face
+   */
+  void
+  enablePcap(bool isEnabled = true);
+
+  /** \return captured packets on a forwarder face
+   *  \pre enablePcap(true) is in effect when the face was created
+   */
+  TopologyPcap&
+  getPcap(const Face& face);
+
   /** \brief registers a prefix on a forwarder face
    */
   void
@@ -227,6 +252,7 @@
                       const time::nanoseconds& interval, size_t n);
 
 private:
+  bool m_wantPcap = false;
   std::vector<unique_ptr<Forwarder>> m_forwarders;
   std::vector<std::string> m_forwarderLabels;
   std::vector<shared_ptr<TopologyLink>> m_links;
