diff --git a/nfd.conf.sample.in b/nfd.conf.sample.in
index eb0de12..dafc88a 100644
--- a/nfd.conf.sample.in
+++ b/nfd.conf.sample.in
@@ -287,4 +287,15 @@
   ;   ;   file-name keys/ndn-testbed.ndncert
   ;   ; }
   ; }
+
+  remote_register
+  {
+    cost 15 ; forwarding cost of prefix registered on remote router
+    timeout 10000 ; timeout (in milliseconds) of remote prefix registration command
+    retry 0 ; maximum number of retries for each remote prefix registration command
+
+    refresh_interval 300 ; interval (in seconds) before refreshing the registration
+    ; This setting should be less than face_system.udp.idle_time,
+    ; so that the face is kept alive on the remote router.
+  }
 }
diff --git a/rib/remote-registrator.cpp b/rib/remote-registrator.cpp
new file mode 100644
index 0000000..2a5a12d
--- /dev/null
+++ b/rib/remote-registrator.cpp
@@ -0,0 +1,423 @@
+/* -*- 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/>.
+ */
+
+#include "remote-registrator.hpp"
+#include "core/logger.hpp"
+#include "core/scheduler.hpp"
+
+namespace nfd {
+namespace rib {
+
+NFD_LOG_INIT("RemoteRegistrator");
+
+using ndn::nfd::ControlParameters;
+using ndn::nfd::CommandOptions;
+
+
+const Name RemoteRegistrator::RM_LOCAL_PREFIX = "/localhost";
+const Name RemoteRegistrator::RM_HUB_PREFIX = "/localhop/nfd";
+const name::Component RemoteRegistrator::RM_IGNORE_COMMPONENT("rib");
+
+RemoteRegistrator::RemoteRegistrator(ndn::nfd::Controller& controller,
+                                     ndn::KeyChain& keyChain,
+                                     Rib& rib)
+  : m_nfdController(controller)
+  , m_keyChain(keyChain)
+  , m_rib(rib)
+  , m_refreshInterval(time::seconds(25))
+  , m_hasConnectedHub(false)
+  , m_nRetries(0)
+{
+}
+
+RemoteRegistrator::~RemoteRegistrator()
+{
+  // cancel all periodically refresh events.
+  for (auto&& entry : m_regEntries)
+    {
+      scheduler::cancel(entry.second);
+    }
+}
+
+void
+RemoteRegistrator::loadConfig(const ConfigSection& configSection)
+{
+  size_t cost = 15, timeout = 10000;
+  size_t retry = 0;
+  size_t interval = 0;
+  const size_t intervalDef = 25, intervalMax = 600;
+
+  NFD_LOG_INFO("Load remote_register section in rib section");
+  for (auto&& i : configSection)
+    {
+      if (i.first == "cost")
+        {
+          cost = i.second.get_value<size_t>();
+        }
+      else if (i.first == "timeout")
+        {
+          timeout = i.second.get_value<size_t>();
+        }
+      else if (i.first == "retry")
+        {
+          retry = i.second.get_value<size_t>();
+        }
+      else if (i.first == "refresh_interval")
+        {
+          interval = i.second.get_value<size_t>();
+        }
+      else
+        {
+          throw ConfigFile::Error("Unrecognized option \"" + i.first +
+                                  "\" in \"remote-registrator\" section");
+        }
+    }
+
+   m_controlParameters
+     .setCost(cost)
+     .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT)// set origin to client.
+     .setFaceId(0);// the remote hub will take the input face as the faceId.
+
+   m_commandOptions
+     .setPrefix(RM_HUB_PREFIX)
+     .setTimeout(time::milliseconds(timeout));
+
+   m_nRetries = retry;
+
+   if (interval == 0)
+     {
+       interval = intervalDef;
+     }
+
+   interval = std::min(interval, intervalMax);
+
+   m_refreshInterval = time::seconds(interval);
+}
+
+void
+RemoteRegistrator::registerPrefix(const Name& prefix)
+{
+  if (RM_LOCAL_PREFIX.isPrefixOf(prefix))
+    {
+      NFD_LOG_INFO("local registration only for " << prefix);
+      return;
+    }
+
+  bool isHubPrefix = prefix == RM_HUB_PREFIX;
+
+  if (isHubPrefix)
+    {
+      NFD_LOG_INFO("this is a prefix registered by some hub: " << prefix);
+
+      m_hasConnectedHub = true;
+
+      redoRegistration();
+      return;
+    }
+
+  if (!m_hasConnectedHub)
+    {
+      NFD_LOG_INFO("no hub connected when registering " << prefix);
+      return;
+    }
+
+  std::pair<Name, size_t> identity = findIdentityForRegistration(prefix);
+
+  if (0 == identity.second)
+    {
+      NFD_LOG_INFO("no proper identity found for registering " << prefix);
+      return;
+    }
+
+  Name prefixForRegistration;
+  if (identity.first.size() == identity.second)
+    {
+      prefixForRegistration = identity.first;
+    }
+  else
+    {
+      prefixForRegistration = identity.first.getPrefix(-1);
+    }
+
+  if (m_regEntries.find(prefixForRegistration) != m_regEntries.end())
+    {
+      NFD_LOG_INFO("registration already in process for " << prefix);
+      return;
+    }
+
+  // make copies of m_controlParameters and m_commandOptions to
+  // avoid unreasonable overwriting during concurrent registration
+  // and unregistration.
+  ControlParameters parameters = m_controlParameters;
+  CommandOptions    options    = m_commandOptions;
+
+  startRegistration(parameters.setName(prefixForRegistration),
+                    options.setSigningIdentity(identity.first),
+                    m_nRetries);
+}
+
+void
+RemoteRegistrator::unregisterPrefix(const Name& prefix)
+{
+  if (prefix == RM_HUB_PREFIX)
+    {
+      NFD_LOG_INFO("disconnected to hub with prefix: " << prefix);
+
+      // for phase 1: suppose there is at most one hub connected.
+      // if the hub prefix has been unregistered locally, there may
+      // be no connected hub.
+      m_hasConnectedHub = false;
+
+      clearRefreshEvents();
+      return;
+    }
+
+  if (!m_hasConnectedHub)
+    {
+      NFD_LOG_INFO("no hub connected when unregistering " << prefix);
+      return;
+    }
+
+  std::pair<Name, size_t> identity = findIdentityForRegistration(prefix);
+
+  if (0 == identity.second)
+    {
+      NFD_LOG_INFO("no proper identity found for unregistering " << prefix);
+      return;
+    }
+
+  Name prefixForRegistration;
+  if (identity.first.size() == identity.second)
+    {
+      prefixForRegistration = identity.first;
+    }
+  else
+    {
+      prefixForRegistration = identity.first.getPrefix(-1);
+    }
+
+  RegisteredEntryIt iRegEntry = m_regEntries.find(prefixForRegistration);
+  if (m_regEntries.end() == iRegEntry)
+    {
+      NFD_LOG_INFO("no existing entry found when unregistering " << prefix);
+      return;
+    }
+
+  for (auto&& entry : m_rib)
+    {
+      if (prefixForRegistration.isPrefixOf(entry.first) &&
+          findIdentityForRegistration(entry.first) == identity)
+        {
+          NFD_LOG_INFO("this identity should be kept for other rib entry: "
+                       << entry.first);
+          return;
+        }
+    }
+
+  scheduler::cancel(iRegEntry->second);
+  m_regEntries.erase(iRegEntry);
+
+  // make copies of m_controlParameters and m_commandOptions to
+  // avoid unreasonable overwriting during concurrent registration
+  // and unregistration.
+  ControlParameters parameters = m_controlParameters;
+  CommandOptions    options    = m_commandOptions;
+
+  startUnregistration(parameters.setName(prefixForRegistration).unsetCost(),
+                      options.setSigningIdentity(identity.first),
+                      m_nRetries);
+}
+
+std::pair<Name, size_t>
+RemoteRegistrator::findIdentityForRegistration(const Name& prefix)
+{
+  std::pair<Name, size_t> candidateIdentity;
+  std::vector<Name> identities;
+  bool isPrefix = false;
+  size_t maxLength = 0, curLength = 0;
+
+  // get all identies from the key-cahin except the default one.
+  m_keyChain.getAllIdentities(identities, false);
+
+  // get the default identity.
+  identities.push_back(m_keyChain.getDefaultIdentity());
+
+  // longest prefix matching to all indenties.
+  for (auto&& i : identities)
+    {
+      if (!i.empty() && RM_IGNORE_COMMPONENT == i.at(-1))
+        {
+          isPrefix = i.getPrefix(-1).isPrefixOf(prefix);
+          curLength = i.size() - 1;
+        }
+      else
+        {
+          isPrefix = i.isPrefixOf(prefix);
+          curLength = i.size();
+        }
+
+      if (isPrefix && curLength > maxLength)
+        {
+          candidateIdentity.first = i;
+          maxLength = curLength;
+        }
+    }
+
+  candidateIdentity.second = maxLength;
+
+  return candidateIdentity;
+}
+
+void
+RemoteRegistrator::startRegistration(const ControlParameters& parameters,
+                                     const CommandOptions& options,
+                                     int nRetries)
+{
+  NFD_LOG_INFO("start register " << parameters.getName());
+
+  m_nfdController.start<ndn::nfd::RibRegisterCommand>(
+     parameters,
+     bind(&RemoteRegistrator::onRegSuccess,
+          this, parameters, options),
+     bind(&RemoteRegistrator::onRegFailure,
+          this, _1, _2, parameters, options, nRetries),
+     options);
+}
+
+void
+RemoteRegistrator::startUnregistration(const ControlParameters& parameters,
+                                       const CommandOptions& options,
+                                       int nRetries)
+{
+  NFD_LOG_INFO("start unregister " << parameters.getName());
+
+  m_nfdController.start<ndn::nfd::RibUnregisterCommand>(
+     parameters,
+     bind(&RemoteRegistrator::onUnregSuccess,
+          this, parameters, options),
+     bind(&RemoteRegistrator::onUnregFailure,
+          this, _1, _2, parameters, options, nRetries),
+     options);
+}
+
+void
+RemoteRegistrator::onRegSuccess(const ControlParameters& parameters,
+                                const CommandOptions& options)
+{
+  NFD_LOG_INFO("success to register " << parameters.getName());
+
+  RegisteredEntryIt iRegEntry = m_regEntries.find(parameters.getName());
+
+  if (m_regEntries.end() != iRegEntry)
+    {
+      NFD_LOG_DEBUG("Existing Entry: (" << iRegEntry->first
+                                        << ", " << iRegEntry->second
+                                        << ")");
+
+      scheduler::cancel(iRegEntry->second);
+      iRegEntry->second = scheduler::schedule(
+                            m_refreshInterval,
+                            bind(&RemoteRegistrator::startRegistration,
+                                 this, parameters, options, m_nRetries));
+    }
+  else
+    {
+      NFD_LOG_DEBUG("New Entry");
+      m_regEntries.insert(RegisteredEntry(
+                              parameters.getName(),
+                              scheduler::schedule(
+                                m_refreshInterval,
+                                bind(&RemoteRegistrator::startRegistration,
+                                     this, parameters, options, m_nRetries))));
+    }
+}
+
+void
+RemoteRegistrator::onRegFailure(uint32_t code, const std::string& reason,
+                                const ControlParameters& parameters,
+                                const CommandOptions& options,
+                                int nRetries)
+{
+  NFD_LOG_INFO("fail to unregister " << parameters.getName()
+                                     << "\n\t reason:" << reason
+                                     << "\n\t remain retries:" << nRetries);
+
+  if (nRetries > 0)
+    {
+      startRegistration(parameters, options, nRetries - 1);
+    }
+}
+
+void
+RemoteRegistrator::onUnregSuccess(const ControlParameters& parameters,
+                                  const CommandOptions& options)
+{
+  NFD_LOG_INFO("success to unregister " << parameters.getName());
+}
+
+void
+RemoteRegistrator::onUnregFailure(uint32_t code, const std::string& reason,
+                                  const ControlParameters& parameters,
+                                  const CommandOptions& options,
+                                  int nRetries)
+{
+  NFD_LOG_INFO("fail to unregister " << parameters.getName()
+                                     << "\n\t reason:" << reason
+                                     << "\n\t remain retries:" << nRetries);
+
+  if (nRetries > 0)
+    {
+      startUnregistration(parameters, options, nRetries - 1);
+    }
+}
+
+void
+RemoteRegistrator::redoRegistration()
+{
+  NFD_LOG_INFO("redo " << m_regEntries.size()
+                       << " registration when new Hub connection is built.");
+
+  for (auto&& entry : m_regEntries)
+    {
+      // make copies to avoid unreasonable overwrite.
+      ControlParameters parameters = m_controlParameters;
+      CommandOptions    options    = m_commandOptions;
+      startRegistration(parameters.setName(entry.first),
+                        options.setSigningIdentity(entry.first),
+                        m_nRetries);
+    }
+}
+
+void
+RemoteRegistrator::clearRefreshEvents()
+{
+  for (auto&& entry : m_regEntries)
+    {
+      scheduler::cancel(entry.second);
+    }
+}
+
+} // namespace rib
+} // namespace nfd
diff --git a/rib/remote-registrator.hpp b/rib/remote-registrator.hpp
new file mode 100644
index 0000000..41be218
--- /dev/null
+++ b/rib/remote-registrator.hpp
@@ -0,0 +1,235 @@
+/* -*- 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_RIB_REMOTE_REGISTRATOR_HPP
+#define NFD_RIB_REMOTE_REGISTRATOR_HPP
+
+#include "rib.hpp"
+#include "core/config-file.hpp"
+#include "rib-status-publisher.hpp"
+
+#include <unordered_map>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/management/nfd-controller.hpp>
+#include <ndn-cxx/management/nfd-control-command.hpp>
+#include <ndn-cxx/management/nfd-control-parameters.hpp>
+#include <ndn-cxx/management/nfd-command-options.hpp>
+
+namespace nfd {
+namespace rib {
+
+/**
+ * @brief define the RemoteRegistrator class, which handles
+ *        the registration/unregistration to remote hub(s).
+ */
+class RemoteRegistrator : noncopyable
+{
+public:
+  class Error : public std::runtime_error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : std::runtime_error(what)
+    {
+    }
+  };
+
+  RemoteRegistrator(ndn::nfd::Controller& controller,
+                    ndn::KeyChain& keyChain,
+                    Rib& rib);
+
+  ~RemoteRegistrator();
+
+  /**
+   * @brief load the "remote_register" section from config file
+   *
+   * @param configSection the sub section in "rib" section.
+   */
+  void
+  loadConfig(const ConfigSection& configSection);
+
+  /**
+   * @brief register a prefix to remote hub(s).
+   *
+   * For the input prefix, we find the longest identity
+   * in the key-chain that can sign it, and then
+   * register this identity to remote hub(s).
+   *
+   * @param prefix the prefix being registered in local RIB.
+   */
+  void
+  registerPrefix(const Name& prefix);
+
+  /**
+   * @brief unregister a prefix from remote hub(s).
+   *
+   * For the input prefix, if the longest identity can sign it
+   * is already registered remotely, that identity should be
+   * unregistered from remote hub(s).
+   *
+   * @param prefix the prefix being unregistered in local RIB.
+   */
+  void
+  unregisterPrefix(const Name& prefix);
+
+private:
+  /**
+   * @brief find the most proper identity that can sign the
+   *        registration/unregistration command for the input prefix.
+   *
+   * @return the identity and the length of the longest match to the
+   *         input prefix.
+   *
+   * @retval { ignored, 0 } no matching identity
+   */
+  std::pair<Name, size_t>
+  findIdentityForRegistration(const Name& prefix);
+
+  /**
+   * @brief make and send the remote registration command.
+   *
+   * @param nRetries remaining number of retries.
+   */
+  void
+  startRegistration(const ndn::nfd::ControlParameters& parameters,
+                    const ndn::nfd::CommandOptions& options,
+                    int nRetries);
+
+  /**
+   * @brief make and send the remote unregistration command.
+   *
+   * @param nRetries remaining number of retries.
+   */
+  void
+  startUnregistration(const ndn::nfd::ControlParameters& parameters,
+                      const ndn::nfd::CommandOptions& options,
+                      int nRetries);
+  /**
+   * @brief refresh the remotely registered entry if registration
+   *        successes by re-sending the registration command.
+   *
+   * The interval of sending refresh command is defined in the
+   * "remote_register" section of the config file.
+   *
+   * @param parameters the same paremeters from startRegistration.
+   * @param options the same options as in startRegistration.
+   */
+  void
+  onRegSuccess(const ndn::nfd::ControlParameters& parameters,
+               const ndn::nfd::CommandOptions& options);
+
+  /**
+   * @brief retry to send registration command if registration fails.
+   *
+   * the number of retries is defined in the "remote_register"
+   * section of the config file.
+   *
+   * @param code error code.
+   * @param reason error reason in string.
+   * @param parameters the same paremeters from startRegistration.
+   * @param options the same options from startRegistration.
+   * @param nRetries remaining number of retries.
+   */
+  void
+  onRegFailure(uint32_t code, const std::string& reason,
+               const ndn::nfd::ControlParameters& parameters,
+               const ndn::nfd::CommandOptions& options,
+               int nRetries);
+
+  void
+  onUnregSuccess(const ndn::nfd::ControlParameters& parameters,
+                 const ndn::nfd::CommandOptions& options);
+
+  /**
+   * @brief retry to send unregistration command if registration fails.
+   *
+   * the number of retries is defined in the "remote_register"
+   * section of the config file.
+   *
+   * @param code error code.
+   * @param reason error reason in string.
+   * @param parameters the same paremeters as in startRegistration.
+   * @param options the same options as in startRegistration.
+   * @param nRetries remaining number of retries.
+   */
+  void
+  onUnregFailure(uint32_t code, const std::string& reason,
+                 const ndn::nfd::ControlParameters& parameters,
+                 const ndn::nfd::CommandOptions& options,
+                 int nRetries);
+
+  /**
+   * @brief re-register all prefixes
+   *
+   * This is called when a HUB connection is established.
+   */
+  void
+  redoRegistration();
+
+  /**
+   * @brief clear all refresh events
+   *
+   * This is called when all HUB connections are lost.
+   */
+  void
+  clearRefreshEvents();
+
+
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+  /**
+   * When a locally registered prefix triggles remote
+   * registration, we actually register the longest
+   * identity that can sign this prefix to remote hub(s).
+   *
+   * Thus, the remotely reigstered prefix does not equal
+   * to Route Name. So it needs seperate sotrage instead
+   * of storing within the RIB.
+   */
+  typedef std::unordered_map<Name, EventId> RegisteredList;
+  typedef RegisteredList::iterator RegisteredEntryIt;
+  typedef RegisteredList::value_type RegisteredEntry;
+  RegisteredList m_regEntries;
+
+private:
+  ndn::nfd::Controller& m_nfdController;
+  ndn::KeyChain& m_keyChain;
+  Rib& m_rib;
+
+  ndn::nfd::ControlParameters m_controlParameters;
+  ndn::nfd::CommandOptions m_commandOptions;
+  time::seconds m_refreshInterval;
+  bool m_hasConnectedHub;
+  int m_nRetries;
+
+  static const Name RM_LOCAL_PREFIX; // /localhost
+  static const Name RM_HUB_PREFIX; // /localhop/nfd
+  static const name::Component RM_IGNORE_COMMPONENT; // rib
+};
+
+} // namespace rib
+} // namespace nfd
+
+#endif // NFD_RIB_REMOTE_REGISTRATOR_HPP
diff --git a/rib/rib-manager.cpp b/rib/rib-manager.cpp
index e0661ac..e7ea3e9 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -80,6 +80,7 @@
   , m_localhopValidator(m_face)
   , m_faceMonitor(m_face)
   , m_isLocalhopEnabled(false)
+  , m_remoteRegistrator(m_nfdController, m_keyChain, m_managedRib)
   , m_ribStatusPublisher(m_managedRib, face, LIST_COMMAND_PREFIX, m_keyChain)
   , m_lastTransactionId(0)
   , m_signedVerbDispatch(SIGNED_COMMAND_VERBS,
@@ -153,6 +154,21 @@
           m_localhopValidator.load(i->second, filename);
           m_isLocalhopEnabled = true;
         }
+      else if (i->first == "remote_register")
+        {
+          m_remoteRegistrator.loadConfig(i->second);
+
+          // register callback to the RIB.
+          // do remote registration after an entry is inserted into the RIB.
+          // do remote unregistration after an entry is erased from the RIB.
+          m_managedRib.afterInsertEntry += [this] (const Name& prefix) {
+            m_remoteRegistrator.registerPrefix(prefix);
+          };
+
+          m_managedRib.afterEraseEntry += [this] (const Name& prefix) {
+            m_remoteRegistrator.unregisterPrefix(prefix);
+          };
+        }
       else
         throw Error("Unrecognized rib property: " + i->first);
     }
diff --git a/rib/rib-manager.hpp b/rib/rib-manager.hpp
index 1ca86cf..181d210 100644
--- a/rib/rib-manager.hpp
+++ b/rib/rib-manager.hpp
@@ -29,6 +29,7 @@
 #include "rib.hpp"
 #include "core/config-file.hpp"
 #include "rib-status-publisher.hpp"
+#include "remote-registrator.hpp"
 
 #include <ndn-cxx/security/validator-config.hpp>
 #include <ndn-cxx/management/nfd-face-monitor.hpp>
@@ -239,6 +240,7 @@
   ndn::ValidatorConfig m_localhopValidator;
   ndn::nfd::FaceMonitor m_faceMonitor;
   bool m_isLocalhopEnabled;
+  RemoteRegistrator m_remoteRegistrator;
 
   RibStatusPublisher m_ribStatusPublisher;
 
diff --git a/rib/rib.cpp b/rib/rib.cpp
index 0d33f24..02df45e 100644
--- a/rib/rib.cpp
+++ b/rib/rib.cpp
@@ -67,11 +67,6 @@
 {
 }
 
-
-Rib::~Rib()
-{
-}
-
 Rib::const_iterator
 Rib::find(const Name& prefix) const
 {
@@ -193,6 +188,9 @@
       m_faceMap[face.faceId].push_back(entry);
 
       createFibUpdatesForNewRibEntry(*entry, face);
+
+      // do something after inserting an entry
+      afterInsertEntry(prefix);
     }
 }
 
@@ -385,6 +383,9 @@
 
   m_rib.erase(it);
 
+  // do something after erasing an entry.
+  afterEraseEntry(entry->getName());
+
   return nextIt;
 }
 
diff --git a/rib/rib.hpp b/rib/rib.hpp
index c555d21..ed9ca4e 100644
--- a/rib/rib.hpp
+++ b/rib/rib.hpp
@@ -29,7 +29,6 @@
 #include "rib-entry.hpp"
 #include "fib-update.hpp"
 #include "common.hpp"
-#include "rib-entry.hpp"
 #include <ndn-cxx/management/nfd-control-command.hpp>
 
 namespace nfd {
@@ -50,8 +49,6 @@
 
   Rib();
 
-  ~Rib();
-
   const_iterator
   find(const Name& prefix) const;
 
@@ -139,6 +136,10 @@
   void
   removeInheritedFacesFromEntry(RibEntry& entry, const Rib::FaceSet& facesToRemove);
 
+public:
+  ndn::util::EventEmitter<Name> afterInsertEntry;
+  ndn::util::EventEmitter<Name> afterEraseEntry;
+
 private:
   RibTable m_rib;
   FaceLookupTable m_faceMap;
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
new file mode 100644
index 0000000..c668f54
--- /dev/null
+++ b/tests/identity-management-fixture.cpp
@@ -0,0 +1,53 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2014 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "identity-management-fixture.hpp"
+
+namespace nfd {
+namespace tests {
+
+IdentityManagementFixture::IdentityManagementFixture()
+  : m_keyChain("sqlite3", "file")
+{
+}
+
+IdentityManagementFixture::~IdentityManagementFixture()
+{
+  for (auto&& id : m_identities) {
+    m_keyChain.deleteIdentity(id);
+  }
+}
+
+bool
+IdentityManagementFixture::addIdentity(const ndn::Name& identity, const ndn::KeyParams& params)
+{
+  try {
+    m_keyChain.createIdentity(identity, params);
+    m_identities.push_back(identity);
+    return true;
+  }
+  catch (std::runtime_error&) {
+    return false;
+  }
+}
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/identity-management-fixture.hpp b/tests/identity-management-fixture.hpp
new file mode 100644
index 0000000..265c3bc
--- /dev/null
+++ b/tests/identity-management-fixture.hpp
@@ -0,0 +1,56 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2014 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library 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 Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "tests/test-common.hpp"
+#include <ndn-cxx/security/key-chain.hpp>
+#include <vector>
+
+#include "boost-test.hpp"
+
+namespace nfd {
+namespace tests {
+
+/**
+ * @brief IdentityManagementFixture is a test suite level fixture.
+ *
+ * Test cases in the suite can use this fixture to create identities.
+ * Identities added via addIdentity method are automatically deleted
+ * during test teardown.
+ */
+class IdentityManagementFixture : public nfd::tests::BaseFixture
+{
+public:
+  IdentityManagementFixture();
+
+  ~IdentityManagementFixture();
+
+  // @brief add identity, return true if succeed.
+  bool
+  addIdentity(const ndn::Name& identity,
+              const ndn::KeyParams& params = ndn::KeyChain::DEFAULT_KEY_PARAMS);
+
+protected:
+  ndn::KeyChain m_keyChain;
+  std::vector<ndn::Name> m_identities;
+};
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/rib/remote-registrator.cpp b/tests/rib/remote-registrator.cpp
new file mode 100644
index 0000000..e0b4d3a
--- /dev/null
+++ b/tests/rib/remote-registrator.cpp
@@ -0,0 +1,459 @@
+/* -*- 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/>.
+ */
+
+#include "rib/remote-registrator.hpp"
+
+#include "tests/limited-io.hpp"
+#include "tests/identity-management-fixture.hpp"
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+namespace nfd {
+namespace rib {
+namespace tests {
+
+class RemoteRegistratorFixture : public nfd::tests::IdentityManagementFixture
+{
+public:
+  RemoteRegistratorFixture()
+    : face(ndn::util::makeDummyClientFace())
+    , controller(make_shared<ndn::nfd::Controller>(std::ref(*face), m_keyChain))
+    , remoteRegistrator(make_shared<RemoteRegistrator>(std::ref(*controller),
+                                                       m_keyChain,
+                                                       rib))
+    , COMMAND_PREFIX("/localhop/nfd/rib")
+    , REGISTER_VERB("register")
+    , UNREGISTER_VERB("unregister")
+  {
+    readConfig();
+
+    registerCallback();
+
+    face->processEvents(time::milliseconds(1));
+    face->sentInterests.clear();
+  }
+
+  void
+  readConfig()
+  {
+    ConfigFile config;
+    config.addSectionHandler("remote_register",
+                             bind(&RemoteRegistrator::loadConfig, remoteRegistrator, _1));
+
+    const std::string CONFIG_STRING =
+    "remote_register\n"
+    "{\n"
+    "  cost 15\n"
+    "  timeout 10000\n"
+    "  retry 2\n"
+    "  refresh_interval 5\n"
+    "}";
+
+    config.parse(CONFIG_STRING, true, "test-remote-register");
+  }
+
+  void
+  registerCallback()
+  {
+    rib.afterInsertEntry += [this] (const Name& prefix) {
+      remoteRegistrator->registerPrefix(prefix);
+    };
+
+    rib.afterEraseEntry += [this] (const Name& prefix) {
+      remoteRegistrator->unregisterPrefix(prefix);
+    };
+  }
+
+  void
+  insertEntryWithIdentity(Name identity,
+                          name::Component appName = DEFAULT_APP_NAME,
+                          uint64_t faceId = 0)
+  {
+    BOOST_CHECK_EQUAL(addIdentity(identity), true);
+
+    FaceEntry faceEntry;
+    faceEntry.faceId = faceId;
+
+    rib.insert(identity.append(appName), faceEntry);
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  insertEntryWithoutIdentity(Name identity,
+                             name::Component appName = DEFAULT_APP_NAME,
+                             uint64_t faceId = 0)
+  {
+    FaceEntry faceEntry;
+    faceEntry.faceId = faceId;
+
+    rib.insert(identity.append(appName), faceEntry);
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  eraseEntryWithIdentity(Name identity,
+                         name::Component appName = DEFAULT_APP_NAME,
+                         uint64_t faceId = 0)
+  {
+    BOOST_CHECK_EQUAL(addIdentity(identity), true);
+
+    FaceEntry faceEntry;
+    faceEntry.faceId = faceId;
+
+    rib.erase(identity.append(appName), faceEntry);
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  eraseEntryWithoutIdentity(Name identity,
+                            name::Component appName = DEFAULT_APP_NAME,
+                            uint64_t faceId = 0)
+  {
+    FaceEntry faceEntry;
+    faceEntry.faceId = faceId;
+
+    rib.erase(identity.append(appName), faceEntry);
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  eraseFace(uint64_t faceId)
+  {
+    rib.erase(faceId);
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  connectToHub()
+  {
+    rib.insert(Name("/localhop/nfd"), FaceEntry());
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  disconnectToHub()
+  {
+    rib.erase(Name("/localhop/nfd"), FaceEntry());
+
+    face->processEvents(time::milliseconds(1));
+  }
+
+  void
+  extractParameters(Interest& interest, Name::Component& verb,
+                    ndn::nfd::ControlParameters& extractedParameters)
+  {
+    const Name& name = interest.getName();
+    verb = name[COMMAND_PREFIX.size()];
+    const Name::Component& parameterComponent = name[COMMAND_PREFIX.size() + 1];
+
+    Block rawParameters = parameterComponent.blockFromValue();
+    extractedParameters.wireDecode(rawParameters);
+  }
+
+public:
+  Rib rib;
+  shared_ptr<ndn::util::DummyClientFace> face;
+  shared_ptr<ndn::nfd::Controller> controller;
+  shared_ptr<RemoteRegistrator> remoteRegistrator;
+
+  const Name COMMAND_PREFIX;
+  const name::Component REGISTER_VERB;
+  const name::Component UNREGISTER_VERB;
+
+  static const name::Component DEFAULT_APP_NAME;
+};
+
+const name::Component RemoteRegistratorFixture::DEFAULT_APP_NAME("app");
+
+BOOST_FIXTURE_TEST_SUITE(RemoteRegistrator, RemoteRegistratorFixture)
+
+BOOST_FIXTURE_TEST_CASE(AutoTest, RemoteRegistratorFixture)
+{
+  BOOST_REQUIRE_EQUAL(1, 1);
+}
+
+BOOST_FIXTURE_TEST_CASE(RegisterWithoutConnection, RemoteRegistratorFixture)
+{
+  insertEntryWithIdentity("/remote/register");
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(RegisterWithoutIdentity, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  insertEntryWithoutIdentity("/remote/register");
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(RegisterWithHubPrefix, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(RegisterWithLocalPrefix, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  insertEntryWithIdentity("/localhost/prefix");
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(RegisterBasic, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identity("/remote/register");
+  insertEntryWithIdentity(identity);
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
+
+  Interest& request = face->sentInterests[0];
+
+  ndn::nfd::ControlParameters extractedParameters;
+  Name::Component verb;
+  extractParameters(request, verb, extractedParameters);
+
+  BOOST_CHECK_EQUAL(verb, REGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters.getName(), identity);
+}
+
+BOOST_FIXTURE_TEST_CASE(RegisterAdvanced, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identity("/remote/register");
+  Name identityAddRib("/remote/register/rib");
+  insertEntryWithIdentity(identityAddRib);
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
+
+  Interest& request = face->sentInterests[0];
+
+  ndn::nfd::ControlParameters extractedParameters;
+  Name::Component verb;
+  extractParameters(request, verb, extractedParameters);
+
+  BOOST_CHECK_EQUAL(verb, REGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters.getName(), identity);
+}
+
+BOOST_FIXTURE_TEST_CASE(UnregisterWithoutInsert, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  eraseEntryWithIdentity("/remote/register");
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(UnregisterWithoutConnection, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  disconnectToHub();
+
+  Name indentity("/remote/register");
+  remoteRegistrator->m_regEntries.insert(
+            nfd::rib::RemoteRegistrator::RegisteredEntry(indentity, EventId()));
+
+  eraseEntryWithIdentity(indentity);
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
+}
+
+BOOST_FIXTURE_TEST_CASE(UnregisterWithoutSuccessfullRegistration,
+                        RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identity("/remote/register");
+
+  insertEntryWithIdentity(identity);
+
+  eraseEntryWithIdentity(identity);
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 1);
+
+  Interest& request = face->sentInterests[0];
+
+  ndn::nfd::ControlParameters extractedParameters;
+  Name::Component verb;
+  extractParameters(request, verb, extractedParameters);
+
+  BOOST_CHECK_EQUAL(verb, REGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters.getName(), identity);
+}
+
+BOOST_FIXTURE_TEST_CASE(UnregisterBasic, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identity("/remote/register");
+
+  insertEntryWithIdentity(identity);
+
+  EventId event;
+
+  remoteRegistrator->m_regEntries.insert(
+          nfd::rib::RemoteRegistrator::RegisteredEntry(identity, event));
+
+  eraseEntryWithIdentity(identity);
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 2);
+
+  Interest& request = face->sentInterests[1];
+
+  ndn::nfd::ControlParameters extractedParameters;
+  Name::Component verb;
+  extractParameters(request, verb, extractedParameters);
+
+  BOOST_CHECK_EQUAL(verb, UNREGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters.getName(), identity);
+}
+
+BOOST_FIXTURE_TEST_CASE(UnregisterAdvanced, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identityShort("/remote/register");
+  Name identityLong("/remote/register/long");
+
+  EventId eventShort;
+  EventId eventLong;
+
+  insertEntryWithIdentity(identityShort, name::Component("appA"));
+
+  remoteRegistrator->m_regEntries.insert(
+          nfd::rib::RemoteRegistrator::RegisteredEntry(identityShort,
+                                                       eventShort));
+
+  insertEntryWithIdentity(identityShort, name::Component("appB"));
+
+  insertEntryWithIdentity(identityLong);
+
+  remoteRegistrator->m_regEntries.insert(
+          nfd::rib::RemoteRegistrator::RegisteredEntry(identityLong,
+                                                       eventLong));
+
+  // two registration commands are generated for identityShort and identityLong
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 2);
+
+  eraseEntryWithIdentity(identityShort, name::Component("appA"));
+
+  // no unregistration command is generated as appB also exists
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 2);
+
+  eraseEntryWithIdentity(identityShort, name::Component("appB"));
+
+  // one unregistration command is generated for identityShort
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 3);
+
+  Interest& request = face->sentInterests[2];
+
+  ndn::nfd::ControlParameters extractedParameters;
+  Name::Component verb;
+  extractParameters(request, verb, extractedParameters);
+
+  BOOST_CHECK_EQUAL(verb, UNREGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters.getName(), identityShort);
+}
+
+BOOST_FIXTURE_TEST_CASE(EraseFace, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identity("/remote/register");
+  uint64_t faceId = 517;
+
+  insertEntryWithIdentity(identity, DEFAULT_APP_NAME, faceId);
+
+  EventId event;
+
+  remoteRegistrator->m_regEntries.insert(
+          nfd::rib::RemoteRegistrator::RegisteredEntry(identity, event));
+
+  eraseFace(faceId);
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 2);
+
+  Interest& request = face->sentInterests[1];
+
+  ndn::nfd::ControlParameters extractedParameters;
+  Name::Component verb;
+  extractParameters(request, verb, extractedParameters);
+
+  BOOST_CHECK_EQUAL(verb, UNREGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters.getName(), identity);
+}
+
+BOOST_FIXTURE_TEST_CASE(RebuildConnection, RemoteRegistratorFixture)
+{
+  connectToHub();
+
+  Name identity("/remote/register");
+
+  insertEntryWithIdentity(identity);
+
+  EventId event;
+
+  remoteRegistrator->m_regEntries.insert(
+          nfd::rib::RemoteRegistrator::RegisteredEntry(identity, event));
+
+  disconnectToHub();
+
+  connectToHub();
+
+  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 2);
+
+  Interest& request1 = face->sentInterests[0];
+  Interest& request2 = face->sentInterests[1];
+
+  ndn::nfd::ControlParameters extractedParameters1, extractedParameters2;
+  Name::Component verb1, verb2;
+  extractParameters(request1, verb1, extractedParameters1);
+  extractParameters(request2, verb2, extractedParameters2);
+
+  BOOST_CHECK_EQUAL(verb1, REGISTER_VERB);
+  BOOST_CHECK_EQUAL(verb2, REGISTER_VERB);
+  BOOST_CHECK_EQUAL(extractedParameters1.getName(),
+                    extractedParameters2.getName());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace rib
+} // namespace nfd
