diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index c1cb438..8d08013 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -97,9 +97,9 @@
   {
   public:
     FieldValidator()
+      : m_required(CONTROL_PARAMETER_UBOUND)
+      , m_optional(CONTROL_PARAMETER_UBOUND)
     {
-      m_required.resize(CONTROL_PARAMETER_UBOUND);
-      m_optional.resize(CONTROL_PARAMETER_UBOUND);
     }
 
     /** \brief declare a required field
@@ -401,6 +401,123 @@
   }
 };
 
+
+enum {
+  // route origin
+  ROUTE_ORIGIN_APP    = 0,
+  ROUTE_ORIGIN_NLSR   = 128,
+  ROUTE_ORIGIN_STATIC = 255,
+
+  // route inheritance flags
+  ROUTE_FLAG_CHILD_INHERIT = 1,
+  ROUTE_FLAG_CAPTURE       = 2
+};
+
+
+/** \brief represents a rib/register command
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#Register-a-route
+ */
+class RibRegisterCommand : public ControlCommand
+{
+public:
+  RibRegisterCommand()
+    : ControlCommand("rib", "register")
+  {
+    m_requestValidator
+      .required(CONTROL_PARAMETER_NAME)
+      .optional(CONTROL_PARAMETER_FACE_ID)
+      .optional(CONTROL_PARAMETER_ORIGIN)
+      .optional(CONTROL_PARAMETER_COST)
+      .optional(CONTROL_PARAMETER_FLAGS)
+      .optional(CONTROL_PARAMETER_EXPIRATION_PERIOD);
+    m_responseValidator
+      .required(CONTROL_PARAMETER_NAME)
+      .required(CONTROL_PARAMETER_FACE_ID)
+      .required(CONTROL_PARAMETER_ORIGIN)
+      .required(CONTROL_PARAMETER_COST)
+      .required(CONTROL_PARAMETER_FLAGS)
+      .required(CONTROL_PARAMETER_EXPIRATION_PERIOD);
+  }
+
+  virtual void
+  applyDefaultsToRequest(ControlParameters& parameters) const
+  {
+    if (!parameters.hasFaceId()) {
+      parameters.setFaceId(0);
+    }
+    if (!parameters.hasOrigin()) {
+      parameters.setOrigin(ROUTE_ORIGIN_APP);
+    }
+    if (!parameters.hasCost()) {
+      parameters.setCost(0);
+    }
+    if (!parameters.hasFlags()) {
+      parameters.setFlags(ROUTE_FLAG_CHILD_INHERIT);
+    }
+    if (!parameters.hasExpirationPeriod()) {
+      if (parameters.getFaceId() == 0) {
+        parameters.setExpirationPeriod(time::milliseconds::max());
+      }
+      else {
+        parameters.setExpirationPeriod(time::hours(1));
+      }
+    }
+  }
+
+  virtual void
+  validateResponse(const ControlParameters& parameters) const
+  {
+    this->ControlCommand::validateResponse(parameters);
+
+    if (parameters.getFaceId() == 0) {
+      throw ArgumentError("FaceId must not be zero");
+    }
+  }
+};
+
+
+/** \brief represents a rib/unregister command
+ *  \sa http://redmine.named-data.net/projects/nfd/wiki/RibMgmt#Unregister-a-route
+ */
+class RibUnregisterCommand : public ControlCommand
+{
+public:
+  RibUnregisterCommand()
+    : ControlCommand("rib", "unregister")
+  {
+    m_requestValidator
+      .required(CONTROL_PARAMETER_NAME)
+      .optional(CONTROL_PARAMETER_FACE_ID)
+      .optional(CONTROL_PARAMETER_ORIGIN);
+    m_responseValidator
+      .required(CONTROL_PARAMETER_NAME)
+      .required(CONTROL_PARAMETER_FACE_ID)
+      .required(CONTROL_PARAMETER_ORIGIN);
+  }
+
+  virtual void
+  applyDefaultsToRequest(ControlParameters& parameters) const
+  {
+    if (!parameters.hasFaceId()) {
+      parameters.setFaceId(0);
+    }
+    if (!parameters.hasOrigin()) {
+      parameters.setOrigin(ROUTE_ORIGIN_APP);
+    }
+  }
+
+  virtual void
+  validateResponse(const ControlParameters& parameters) const
+  {
+    this->ControlCommand::validateResponse(parameters);
+
+    if (parameters.getFaceId() == 0) {
+      throw ArgumentError("FaceId must not be zero");
+    }
+  }
+};
+
+
 } // namespace nfd
 } // namespace ndn
 
diff --git a/src/management/nfd-control-parameters.hpp b/src/management/nfd-control-parameters.hpp
index 0eff8ae..f0aa1b5 100644
--- a/src/management/nfd-control-parameters.hpp
+++ b/src/management/nfd-control-parameters.hpp
@@ -18,8 +18,11 @@
   CONTROL_PARAMETER_FACE_ID,
   CONTROL_PARAMETER_URI,
   CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE,
+  CONTROL_PARAMETER_ORIGIN,
   CONTROL_PARAMETER_COST,
+  CONTROL_PARAMETER_FLAGS,
   CONTROL_PARAMETER_STRATEGY,
+  CONTROL_PARAMETER_EXPIRATION_PERIOD,
   CONTROL_PARAMETER_UBOUND
 };
 
@@ -28,8 +31,11 @@
   "FaceId",
   "Uri",
   "LocalControlFeature",
+  "Origin",
   "Cost",
+  "Flags",
   "Strategy",
+  "ExpirationPeriod",
 };
 
 enum LocalControlFeature {
@@ -76,6 +82,7 @@
   wireDecode(const Block& wire);
 
 public: // getters & setters
+
   bool
   hasName() const
   {
@@ -197,6 +204,36 @@
   }
 
   bool
+  hasOrigin() const
+  {
+    return m_hasFields[CONTROL_PARAMETER_ORIGIN];
+  }
+
+  uint64_t
+  getOrigin() const
+  {
+    BOOST_ASSERT(this->hasOrigin());
+    return m_origin;
+  }
+
+  ControlParameters&
+  setOrigin(uint64_t origin)
+  {
+    m_wire.reset();
+    m_origin = origin;
+    m_hasFields[CONTROL_PARAMETER_ORIGIN] = true;
+    return *this;
+  }
+
+  ControlParameters&
+  unsetOrigin()
+  {
+    m_wire.reset();
+    m_hasFields[CONTROL_PARAMETER_ORIGIN] = false;
+    return *this;
+  }
+
+  bool
   hasCost() const
   {
     return m_hasFields[CONTROL_PARAMETER_COST];
@@ -227,6 +264,36 @@
   }
 
   bool
+  hasFlags() const
+  {
+    return m_hasFields[CONTROL_PARAMETER_FLAGS];
+  }
+
+  uint64_t
+  getFlags() const
+  {
+    BOOST_ASSERT(this->hasFlags());
+    return m_flags;
+  }
+
+  ControlParameters&
+  setFlags(uint64_t flags)
+  {
+    m_wire.reset();
+    m_flags = flags;
+    m_hasFields[CONTROL_PARAMETER_FLAGS] = true;
+    return *this;
+  }
+
+  ControlParameters&
+  unsetFlags()
+  {
+    m_wire.reset();
+    m_hasFields[CONTROL_PARAMETER_FLAGS] = false;
+    return *this;
+  }
+
+  bool
   hasStrategy() const
   {
     return m_hasFields[CONTROL_PARAMETER_STRATEGY];
@@ -256,6 +323,36 @@
     return *this;
   }
 
+  bool
+  hasExpirationPeriod() const
+  {
+    return m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD];
+  }
+
+  const time::milliseconds&
+  getExpirationPeriod() const
+  {
+    BOOST_ASSERT(this->hasExpirationPeriod());
+    return m_expirationPeriod;
+  }
+
+  ControlParameters&
+  setExpirationPeriod(const time::milliseconds& expirationPeriod)
+  {
+    m_wire.reset();
+    m_expirationPeriod = expirationPeriod;
+    m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = true;
+    return *this;
+  }
+
+  ControlParameters&
+  unsetExpirationPeriod()
+  {
+    m_wire.reset();
+    m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = false;
+    return *this;
+  }
+
   const std::vector<bool>&
   getPresentFields() const
   {
@@ -269,8 +366,11 @@
   uint64_t            m_faceId;
   std::string         m_uri;
   LocalControlFeature m_localControlFeature;
+  uint64_t            m_origin;
   uint64_t            m_cost;
+  uint64_t            m_flags;
   Name                m_strategy;
+  time::milliseconds  m_expirationPeriod;
 
 private:
   mutable Block m_wire;
@@ -283,12 +383,22 @@
 {
   size_t totalLength = 0;
 
+  if (this->hasExpirationPeriod()) {
+    totalLength += prependNonNegativeIntegerBlock(encoder,
+                   tlv::nfd::ExpirationPeriod, m_expirationPeriod.count());
+  }
   if (this->hasStrategy()) {
     totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy);
   }
+  if (this->hasFlags()) {
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Flags, m_flags);
+  }
   if (this->hasCost()) {
     totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Cost, m_cost);
   }
+  if (this->hasOrigin()) {
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Origin, m_origin);
+  }
   if (this->hasLocalControlFeature()) {
     totalLength += prependNonNegativeIntegerBlock(encoder,
                    tlv::nfd::LocalControlFeature, m_localControlFeature);
@@ -362,12 +472,24 @@
     m_localControlFeature = static_cast<LocalControlFeature>(readNonNegativeInteger(*val));
   }
 
+  val = m_wire.find(tlv::nfd::Origin);
+  m_hasFields[CONTROL_PARAMETER_ORIGIN] = val != m_wire.elements_end();
+  if (this->hasOrigin()) {
+    m_origin = static_cast<uint64_t>(readNonNegativeInteger(*val));
+  }
+
   val = m_wire.find(tlv::nfd::Cost);
   m_hasFields[CONTROL_PARAMETER_COST] = val != m_wire.elements_end();
   if (this->hasCost()) {
     m_cost = static_cast<uint64_t>(readNonNegativeInteger(*val));
   }
 
+  val = m_wire.find(tlv::nfd::Flags);
+  m_hasFields[CONTROL_PARAMETER_FLAGS] = val != m_wire.elements_end();
+  if (this->hasFlags()) {
+    m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
+  }
+
   val = m_wire.find(tlv::nfd::Strategy);
   m_hasFields[CONTROL_PARAMETER_STRATEGY] = val != m_wire.elements_end();
   if (this->hasStrategy()) {
@@ -379,6 +501,12 @@
       m_strategy.wireDecode(*val->elements_begin());
     }
   }
+
+  val = m_wire.find(tlv::nfd::ExpirationPeriod);
+  m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = val != m_wire.elements_end();
+  if (this->hasExpirationPeriod()) {
+    m_expirationPeriod = time::milliseconds(readNonNegativeInteger(*val));
+  }
 }
 
 inline std::ostream&
@@ -402,14 +530,26 @@
     os << "LocalControlFeature: " << parameters.getLocalControlFeature() << ", ";
   }
 
+  if (parameters.hasOrigin()) {
+    os << "Origin: " << parameters.getOrigin() << ", ";
+  }
+
   if (parameters.hasCost()) {
     os << "Cost: " << parameters.getCost() << ", ";
   }
 
+  if (parameters.hasFlags()) {
+    os << "Flags: " << parameters.getFlags() << ", ";
+  }
+
   if (parameters.hasStrategy()) {
     os << "Strategy: " << parameters.getStrategy() << ", ";
   }
 
+  if (parameters.hasExpirationPeriod()) {
+    os << "ExpirationPeriod: " << parameters.getExpirationPeriod() << ", ";
+  }
+
   os << ")";
   return os;
 }
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index 823169a..1b46c76 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -38,7 +38,7 @@
         const CommandSucceedCallback& onSuccess,
         const CommandFailCallback& onFailure);
 
-public: // selfreg
+public: // selfreg using FIB Management commands
   virtual void
   selfRegisterPrefix(const Name& prefixToRegister,
                      const SuccessCallback& onSuccess,
diff --git a/src/management/nrd-controller.cpp b/src/management/nrd-controller.cpp
index 66156d2..bf99148 100644
--- a/src/management/nrd-controller.cpp
+++ b/src/management/nrd-controller.cpp
@@ -4,21 +4,19 @@
  * See COPYING for copyright and distribution information.
  */
 
-#include "common.hpp"
-#include "../face.hpp"
-
-// NRD
 #include "nrd-controller.hpp"
 #include "nrd-prefix-reg-options.hpp"
-
-// NFD
-#include "nfd-control-response.hpp"
+#include "nfd-control-response.hpp" // used in deprecated function only
 
 namespace ndn {
 namespace nrd {
 
+using nfd::ControlParameters;
+using nfd::RibRegisterCommand;
+using nfd::RibUnregisterCommand;
+
 Controller::Controller(Face& face)
-  : m_face(face)
+  : nfd::Controller(face)
 {
 }
 
@@ -27,12 +25,12 @@
                                const SuccessCallback& onSuccess,
                                const FailCallback&    onFail)
 {
-  startCommand("register",
-               PrefixRegOptions()
-                 .setName(prefixToRegister)
-                 .setFaceId(0) // self-registration
-                 .setCost(0),
-               bind(onSuccess), onFail);
+  ControlParameters parameters;
+  parameters.setName(prefixToRegister);
+
+  this->start<RibRegisterCommand>(parameters,
+                                  bind(onSuccess),
+                                  bind(onFail, _2));
 }
 
 void
@@ -40,11 +38,12 @@
                                  const SuccessCallback& onSuccess,
                                  const FailCallback&    onFail)
 {
-  startCommand("unregister",
-               PrefixRegOptions()
-                 .setName(prefixToRegister)
-                 .setFaceId(0), // self-registration
-               bind(onSuccess), onFail);
+  ControlParameters parameters;
+  parameters.setName(prefixToRegister);
+
+  this->start<RibUnregisterCommand>(parameters,
+                                    bind(onSuccess),
+                                    bind(onFail, _2));
 }
 
 void
diff --git a/src/management/nrd-controller.hpp b/src/management/nrd-controller.hpp
index de64325..5b24378 100644
--- a/src/management/nrd-controller.hpp
+++ b/src/management/nrd-controller.hpp
@@ -7,24 +7,24 @@
 #ifndef NDN_MANAGEMENT_NRD_CONTROLLER_HPP
 #define NDN_MANAGEMENT_NRD_CONTROLLER_HPP
 
-#include "controller.hpp"
-#include "../util/command-interest-generator.hpp"
+#include "nfd-controller.hpp"
 
 namespace ndn {
 namespace nrd {
 
+/// \deprecated
 class PrefixRegOptions;
 
-class Controller : public ndn::Controller
+class Controller : public nfd::Controller
 {
 public:
+  /// \deprecated
   typedef function<void(const PrefixRegOptions&)> CommandSucceedCallback;
 
-  /**
-   * @brief Construct ndnd::Control object
-   */
+  explicit
   Controller(Face& face);
 
+public: // selfreg using RIB Management commands
   virtual void
   selfRegisterPrefix(const Name& prefixToRegister,
                      const SuccessCallback& onSuccess,
@@ -35,27 +35,33 @@
                        const SuccessCallback& onSuccess,
                        const FailCallback&    onFail);
 
+public:
+  /// \deprecated .start<RibRegisterCommand>
   void
   registerPrefix(const PrefixRegOptions& options,
                  const CommandSucceedCallback& onSuccess,
                  const FailCallback& onFail);
 
+  /// \deprecated .start<RibUnregisterCommand>
   void
   unregisterPrefix(const PrefixRegOptions& options,
                  const CommandSucceedCallback& onSuccess,
                  const FailCallback&    onFail);
 
+  /// \deprecated
   void
   advertisePrefix(const PrefixRegOptions& options,
                   const CommandSucceedCallback& onSuccess,
                   const FailCallback& onFail);
 
+  /// \deprecated
   void
   withdrawPrefix(const PrefixRegOptions& options,
                  const CommandSucceedCallback& onSuccess,
                  const FailCallback& onFail);
 
 protected:
+  /// \deprecated
   void
   startCommand(const std::string& command,
                const PrefixRegOptions& options,
@@ -63,14 +69,11 @@
                const FailCallback& onFailure);
 
 private:
+  /// \deprecated
   void
   processCommandResponse(Data& data,
                          const CommandSucceedCallback& onSuccess,
                          const FailCallback& onFail);
-
-protected:
-  Face& m_face;
-  CommandInterestGenerator m_commandInterestGenerator;
 };
 
 } // namespace nrd
diff --git a/src/management/nrd-prefix-reg-options.hpp b/src/management/nrd-prefix-reg-options.hpp
index 2c37c4a..ea8ca4d 100644
--- a/src/management/nrd-prefix-reg-options.hpp
+++ b/src/management/nrd-prefix-reg-options.hpp
@@ -23,6 +23,7 @@
  * @brief Abstraction for prefix registration options for NRD Prefix registration protocol
  *
  * @see http://redmine.named-data.net/projects/nrd/wiki/NRD_Prefix_Registration_protocol
+ * @deprecated use NFD RIB Management
  */
 class PrefixRegOptions {
 public:
