diff --git a/daemon/face/internal-client-face.cpp b/daemon/face/internal-client-face.cpp
new file mode 100644
index 0000000..510b087
--- /dev/null
+++ b/daemon/face/internal-client-face.cpp
@@ -0,0 +1,99 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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 "internal-client-face.hpp"
+#include "internal-face.hpp"
+#include "core/global-io.hpp"
+
+#include <ndn-cxx/management/nfd-local-control-header.hpp>
+
+namespace nfd {
+
+void
+InternalClientFace::Transport::receive(const Block& block)
+{
+  if (m_receiveCallback) {
+    m_receiveCallback(block);
+  }
+}
+
+void
+InternalClientFace::Transport::close()
+{
+}
+
+void
+InternalClientFace::Transport::send(const Block& wire)
+{
+  onSendBlock(wire);
+}
+
+void
+InternalClientFace::Transport::send(const Block& header, const Block& payload)
+{
+  ndn::EncodingBuffer encoder(header.size() + payload.size(), header.size() + payload.size());
+  encoder.appendByteArray(header.wire(), header.size());
+  encoder.appendByteArray(payload.wire(), payload.size());
+
+  this->send(encoder.block());
+}
+
+void
+InternalClientFace::Transport::pause()
+{
+}
+
+void
+InternalClientFace::Transport::resume()
+{
+}
+
+InternalClientFace::InternalClientFace(const shared_ptr<InternalFace>& face,
+                                       const shared_ptr<InternalClientFace::Transport>& transport,
+                                       ndn::KeyChain& keyChain)
+  : ndn::Face(transport, getGlobalIoService(), keyChain)
+  , m_face(face)
+  , m_transport(transport)
+{
+  construct();
+}
+
+void
+InternalClientFace::construct()
+{
+  m_face->onSendInterest.connect(bind(&InternalClientFace::receive<Interest>, this, _1));
+  m_face->onSendData.connect(bind(&InternalClientFace::receive<Data>, this, _1));
+  m_transport->onSendBlock.connect(bind(&InternalFace::receive, m_face, _1));
+}
+
+shared_ptr<InternalClientFace>
+makeInternalClientFace(const shared_ptr<InternalFace>& face,
+                       ndn::KeyChain& keyChain)
+{
+  auto transport = make_shared<InternalClientFace::Transport>();
+  return shared_ptr<InternalClientFace>(new InternalClientFace(face, transport, keyChain));
+}
+
+} // namespace nfd
diff --git a/daemon/face/internal-client-face.hpp b/daemon/face/internal-client-face.hpp
new file mode 100644
index 0000000..8eb3c46
--- /dev/null
+++ b/daemon/face/internal-client-face.hpp
@@ -0,0 +1,118 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#ifndef NFD_DAEMON_FACE_INTERNAL_CLIENT_FACE_HPP
+#define NFD_DAEMON_FACE_INTERNAL_CLIENT_FACE_HPP
+
+#include "common.hpp"
+
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/transport/transport.hpp>
+
+namespace nfd {
+
+class InternalFace;
+class InternalClientFace;
+
+shared_ptr<InternalClientFace>
+makeInternalClientFace(const shared_ptr<InternalFace>& face, ndn::KeyChain& keyChain);
+
+/** \brief a client face that is connected to NFD InternalFace
+ */
+class InternalClientFace : public ndn::Face
+{
+public:
+  template<typename Packet>
+  void
+  receive(const Packet& packet);
+
+private:
+  class Transport : public ndn::Transport
+  {
+  public:
+    signal::Signal<Transport, Block> onSendBlock;
+
+    void
+    receive(const Block& block);
+
+    virtual void
+    close() DECL_OVERRIDE;
+
+    virtual void
+    send(const Block& wire) DECL_OVERRIDE;
+
+    virtual void
+    send(const Block& header, const Block& payload) DECL_OVERRIDE;
+
+    virtual void
+    pause() DECL_OVERRIDE;
+
+    virtual void
+    resume() DECL_OVERRIDE;
+  };
+
+private:
+  InternalClientFace(const shared_ptr<InternalFace>& face,
+                     const shared_ptr<InternalClientFace::Transport>& transport,
+                     ndn::KeyChain& keyChain);
+
+  void
+  construct();
+
+  friend shared_ptr<InternalClientFace>
+  makeInternalClientFace(const shared_ptr<InternalFace>& face,
+                         ndn::KeyChain& keyChain);
+
+private:
+  shared_ptr<InternalFace> m_face;
+  shared_ptr<InternalClientFace::Transport> m_transport;
+};
+
+template<typename Packet>
+void
+InternalClientFace::receive(const Packet& packet)
+{
+  if (!packet.getLocalControlHeader().empty(ndn::nfd::LocalControlHeader::ENCODE_ALL)) {
+
+    Block header = packet.getLocalControlHeader()
+                         .wireEncode(packet, ndn::nfd::LocalControlHeader::ENCODE_ALL);
+    Block payload = packet.wireEncode();
+
+    ndn::EncodingBuffer encoder(header.size() + payload.size(),
+                                header.size() + payload.size());
+    encoder.appendByteArray(header.wire(), header.size());
+    encoder.appendByteArray(payload.wire(), payload.size());
+
+    m_transport->receive(encoder.block());
+  }
+  else {
+    m_transport->receive(packet.wireEncode());
+  }
+}
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_INTERNAL_CLIENT_FACE_HPP
diff --git a/daemon/face/internal-face.cpp b/daemon/face/internal-face.cpp
new file mode 100644
index 0000000..c5ab2ca
--- /dev/null
+++ b/daemon/face/internal-face.cpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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 "internal-face.hpp"
+
+namespace nfd {
+
+InternalFace::InternalFace()
+  : Face(FaceUri("internal://"), FaceUri("internal://"), true)
+{
+}
+
+void
+InternalFace::sendInterest(const Interest& interest)
+{
+  this->emitSignal(onSendInterest, interest);
+}
+
+void
+InternalFace::sendData(const Data& data)
+{
+  this->emitSignal(onSendData, data);
+}
+
+void
+InternalFace::close()
+{
+}
+
+void
+InternalFace::receive(const Block& blockFromClient)
+{
+  const Block& payLoad = ndn::nfd::LocalControlHeader::getPayload(blockFromClient);
+  if (payLoad.type() == ndn::tlv::Interest) {
+    receiveInterest(*extractPacketFromBlock<Interest>(blockFromClient, payLoad));
+  }
+  else if (payLoad.type() == ndn::tlv::Data) {
+    receiveData(*extractPacketFromBlock<Data>(blockFromClient, payLoad));
+  }
+}
+
+void
+InternalFace::receiveInterest(const Interest& interest)
+{
+  this->emitSignal(onReceiveInterest, interest);
+}
+
+void
+InternalFace::receiveData(const Data& data)
+{
+  this->emitSignal(onReceiveData, data);
+}
+
+template<typename Packet>
+shared_ptr<Packet>
+InternalFace::extractPacketFromBlock(const Block& blockFromClient, const Block& payLoad)
+{
+  auto packet = make_shared<Packet>(payLoad);
+  if (&payLoad != &blockFromClient) {
+    packet->getLocalControlHeader().wireDecode(blockFromClient);
+  }
+  return packet;
+}
+
+template shared_ptr<Interest>
+InternalFace::extractPacketFromBlock<Interest>(const Block& blockFromClient, const Block& payLoad);
+
+template shared_ptr<Data>
+InternalFace::extractPacketFromBlock<Data>(const Block& blockFromClient, const Block& payLoad);
+
+} // namespace nfd
diff --git a/daemon/face/internal-face.hpp b/daemon/face/internal-face.hpp
new file mode 100644
index 0000000..1014fca
--- /dev/null
+++ b/daemon/face/internal-face.hpp
@@ -0,0 +1,102 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  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/>.
+ */
+
+#ifndef NFD_DAEMON_FACE_INTERNAL_FACE_HPP
+#define NFD_DAEMON_FACE_INTERNAL_FACE_HPP
+
+#include "face.hpp"
+
+namespace nfd {
+
+/**
+ * @brief represents a face for internal use in NFD.
+ */
+class InternalFace : public Face
+{
+public:
+
+  InternalFace();
+
+  virtual void
+  sendInterest(const Interest& interest) DECL_OVERRIDE;
+
+  virtual void
+  sendData(const Data& data) DECL_OVERRIDE;
+
+  virtual void
+  close() DECL_OVERRIDE;
+
+  /**
+   * @brief receive a block from a client face
+   *
+   * step1. extracte the packet payload from the received block.
+   * step2. check the type (either Interest or Data) through the payload.
+   * step3. call receiveInterest / receiveData respectively according to the type.
+   *
+   * @param blockFromClient the block from a client face
+   */
+  void
+  receive(const Block& blockFromClient);
+
+  /**
+   * @brief receive an Interest from a client face
+   *
+   * emit the onReceiveInterest signal.
+   *
+   * @param interest the received Interest packet
+   */
+  void
+  receiveInterest(const Interest& interest);
+
+  /**
+   * @brief receive a Data from a client face
+   *
+   * emit the onReceiveData signal.
+   *
+   * @param data the received Data packet
+   */
+  void
+  receiveData(const Data& data);
+
+  /**
+   * @brief compose the whole packet from the received block after payload is extracted
+   *
+   * construct a packet from the extracted payload, and then decode the localControlHeader if the
+   * received block holds more information than the payload.
+   *
+   * @tparam Packet the type of packet, Interest or Data
+   * @param blockFromClient the received block
+   * @param payLoad the extracted payload
+   *
+   * @return a complete packet
+   */
+  template<typename Packet>
+  static shared_ptr<Packet>
+  extractPacketFromBlock(const Block& blockFromClient, const Block& payLoad);
+};
+
+} // namespace nfd
+
+#endif // NFD_DAEMON_FACE_INTERNAL_FACE_HPP
diff --git a/daemon/mgmt/internal-face.cpp b/daemon/mgmt/internal-face.cpp
deleted file mode 100644
index 7569fb9..0000000
--- a/daemon/mgmt/internal-face.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  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 "internal-face.hpp"
-#include "core/logger.hpp"
-#include "core/global-io.hpp"
-
-namespace nfd {
-
-NFD_LOG_INIT("InternalFace");
-
-InternalFace::InternalFace()
-  : Face(FaceUri("internal://"), FaceUri("internal://"), true)
-{
-}
-
-void
-InternalFace::sendInterest(const Interest& interest)
-{
-  this->emitSignal(onSendInterest, interest);
-
-  // Invoke .processInterest a bit later,
-  // to avoid potential problems in forwarding pipelines.
-  getGlobalIoService().post(bind(&InternalFace::processInterest,
-                                 this, interest.shared_from_this()));
-}
-
-void
-InternalFace::processInterest(const shared_ptr<const Interest>& interest)
-{
-  if (m_interestFilters.size() == 0)
-    {
-      NFD_LOG_DEBUG("no Interest filters to match against");
-      return;
-    }
-
-  const Name& interestName(interest->getName());
-  NFD_LOG_DEBUG("received Interest: " << interestName);
-
-  std::map<Name, OnInterest>::const_iterator filter =
-    m_interestFilters.lower_bound(interestName);
-
-  // lower_bound gives us the first Name that is
-  // an exact match OR ordered after interestName.
-  //
-  // If we reach the end of the map, then we need
-  // only check if the before-end element is a match.
-  //
-  // If we match an element, then the current
-  // position or the previous element are potential
-  // matches.
-  //
-  // If we hit begin, the element is either an exact
-  // match or there is no matching prefix in the map.
-
-
-  if (filter == m_interestFilters.end() && filter != m_interestFilters.begin())
-    {
-      // We hit the end, check if the previous element
-      // is a match
-      --filter;
-      if (filter->first.isPrefixOf(interestName))
-        {
-          NFD_LOG_DEBUG("found Interest filter for " << filter->first << " (before end match)");
-          filter->second(interestName, *interest);
-        }
-      else
-        {
-          NFD_LOG_DEBUG("no Interest filter found for " << interestName << " (before end)");
-        }
-    }
-  else if (filter->first == interestName)
-    {
-      NFD_LOG_DEBUG("found Interest filter for " << filter->first << " (exact match)");
-      filter->second(interestName, *interest);
-    }
-  else if (filter != m_interestFilters.begin())
-    {
-      // the element we found is canonically
-      // ordered after interestName.
-      // Check the previous element.
-      --filter;
-      if (filter->first.isPrefixOf(interestName))
-        {
-          NFD_LOG_DEBUG("found Interest filter for " << filter->first << " (previous match)");
-          filter->second(interestName, *interest);
-        }
-      else
-        {
-          NFD_LOG_DEBUG("no Interest filter found for " << interestName << " (previous)");
-        }
-    }
-  else
-    {
-      NFD_LOG_DEBUG("no Interest filter found for " << interestName << " (begin)");
-    }
-  //Drop Interest
-}
-
-void
-InternalFace::sendData(const Data& data)
-{
-  this->emitSignal(onSendData, data);
-}
-
-void
-InternalFace::close()
-{
-  BOOST_THROW_EXCEPTION(Error("Internal face cannot be closed"));
-}
-
-void
-InternalFace::setInterestFilter(const Name& filter,
-                                OnInterest onInterest)
-{
-  NFD_LOG_INFO("registering callback for " << filter);
-  m_interestFilters[filter] = onInterest;
-}
-
-void
-InternalFace::put(const Data& data)
-{
-  this->emitSignal(onReceiveData, data);
-}
-
-InternalFace::~InternalFace()
-{
-
-}
-
-} // namespace nfd
diff --git a/daemon/mgmt/internal-face.hpp b/daemon/mgmt/internal-face.hpp
deleted file mode 100644
index c35676f..0000000
--- a/daemon/mgmt/internal-face.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014,  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/>.
- */
-
-#ifndef NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
-#define NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
-
-#include "face/face.hpp"
-#include "app-face.hpp"
-
-#include "command-validator.hpp"
-
-namespace nfd {
-
-class InternalFace : public Face, public AppFace
-{
-public:
-  /**
-   * \brief InternalFace-related error
-   */
-  class Error : public Face::Error
-  {
-  public:
-    explicit
-    Error(const std::string& what)
-      : Face::Error(what)
-    {
-    }
-  };
-
-  InternalFace();
-
-  CommandValidator&
-  getValidator();
-
-  virtual
-  ~InternalFace();
-
-  // Overridden Face methods for forwarder
-
-  virtual void
-  sendInterest(const Interest& interest);
-
-  virtual void
-  sendData(const Data& data);
-
-  virtual void
-  close();
-
-  // Methods implementing AppFace interface. Do not invoke from forwarder.
-
-  virtual void
-  setInterestFilter(const Name& filter,
-                    OnInterest onInterest);
-
-  virtual void
-  put(const Data& data);
-
-private:
-  void
-  processInterest(const shared_ptr<const Interest>& interest);
-
-private:
-  std::map<Name, OnInterest> m_interestFilters;
-  CommandValidator m_validator;
-};
-
-inline CommandValidator&
-InternalFace::getValidator()
-{
-  return m_validator;
-}
-
-
-} // namespace nfd
-
-#endif // NFD_DAEMON_MGMT_INTERNAL_FACE_HPP
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index 1041643..66ab514 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -31,7 +31,8 @@
 #include "core/config-file.hpp"
 #include "fw/forwarder.hpp"
 #include "face/null-face.hpp"
-#include "mgmt/internal-face.hpp"
+#include "face/internal-face.hpp"
+#include "face/internal-client-face.hpp"
 // #include "mgmt/fib-manager.hpp"
 // #include "mgmt/face-manager.hpp"
 // #include "mgmt/strategy-choice-manager.hpp"
@@ -47,14 +48,14 @@
 
 Nfd::Nfd(const std::string& configFile, ndn::KeyChain& keyChain)
   : m_configFile(configFile)
-  // , m_keyChain(keyChain)
+  , m_keyChain(keyChain)
   , m_networkMonitor(getGlobalIoService())
 {
 }
 
 Nfd::Nfd(const ConfigSection& config, ndn::KeyChain& keyChain)
   : m_configSection(config)
-  // , m_keyChain(keyChain)
+  , m_keyChain(keyChain)
   , m_networkMonitor(getGlobalIoService())
 {
 }
@@ -128,6 +129,8 @@
 Nfd::initializeManagement()
 {
   m_internalFace = make_shared<InternalFace>();
+  m_forwarder->getFaceTable().addReserved(m_internalFace, FACEID_INTERNAL_FACE);
+  m_internalClientFace = makeInternalClientFace(m_internalFace, m_keyChain);
 
   // m_fibManager.reset(new FibManager(m_forwarder->getFib(),
   //                                   bind(&Forwarder::getFace, m_forwarder.get(), _1),
@@ -150,7 +153,7 @@
                                    m_forwarder->getMeasurements());
   tablesConfig.setConfigFile(config);
 
-  m_internalFace->getValidator().setConfigFile(config);
+  // m_internalFace->getValidator().setConfigFile(config);
 
   m_forwarder->getFaceTable().addReserved(m_internalFace, FACEID_INTERNAL_FACE);
 
@@ -193,7 +196,7 @@
 
   tablesConfig.setConfigFile(config);
 
-  m_internalFace->getValidator().setConfigFile(config);
+  // m_internalFace->getValidator().setConfigFile(config);
   // m_faceManager->setConfigFile(config);
 
   if (!m_configFile.empty()) {
diff --git a/daemon/nfd.hpp b/daemon/nfd.hpp
index acd3096..1240835 100644
--- a/daemon/nfd.hpp
+++ b/daemon/nfd.hpp
@@ -41,6 +41,7 @@
 class FaceManager;
 class StrategyChoiceManager;
 class StatusServer;
+class InternalClientFace;
 
 /**
  * \brief Class representing NFD instance
@@ -97,14 +98,14 @@
 
   unique_ptr<Forwarder> m_forwarder;
 
+  ndn::KeyChain&                    m_keyChain;
   shared_ptr<InternalFace>          m_internalFace;
+  shared_ptr<InternalClientFace>    m_internalClientFace;
   // unique_ptr<FibManager>            m_fibManager;
   // unique_ptr<FaceManager>           m_faceManager;
   // unique_ptr<StrategyChoiceManager> m_strategyChoiceManager;
   // unique_ptr<StatusServer>          m_statusServer;
 
-  // ndn::KeyChain&                    m_keyChain;
-
   ndn::util::NetworkMonitor         m_networkMonitor;
   scheduler::ScopedEventId          m_reloadConfigEvent;
 };
