diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index 39ca5c2..1a88229 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-module.cpp
@@ -1,5 +1,5 @@
 /* -*- 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,
@@ -53,7 +53,8 @@
     .setTitle("create a face")
     .addArg("remote", ArgValueType::FACE_URI, Required::YES, Positional::YES)
     .addArg("persistency", ArgValueType::FACE_PERSISTENCY, Required::NO, Positional::YES)
-    .addArg("local", ArgValueType::FACE_URI, Required::NO, Positional::NO);
+    .addArg("local", ArgValueType::FACE_URI, Required::NO, Positional::NO)
+    .addArg("reliability", ArgValueType::BOOLEAN, Required::NO, Positional::NO);
   parser.addCommand(defFaceCreate, &FaceModule::create);
 
   CommandDefinition defFaceDestroy("face", "destroy");
@@ -151,6 +152,8 @@
   auto remoteUri = ctx.args.get<FaceUri>("remote");
   auto localUri = ctx.args.getOptional<FaceUri>("local");
   auto persistency = ctx.args.get<FacePersistency>("persistency", FacePersistency::FACE_PERSISTENCY_PERSISTENT);
+  auto lpReliability = ctx.args.getTribool("reliability");
+
   FaceUri canonicalRemote;
   ndn::optional<FaceUri> canonicalLocal;
 
@@ -166,9 +169,17 @@
             << ia("local") << resp.getLocalUri()
             << ia("remote") << resp.getUri()
             << ia("persistency") << resp.getFacePersistency()
+            << ia("reliability") << (resp.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED) ? "on" : "off")
             << '\n';
   };
 
+  auto updateFace = [&printPositiveResult] (ControlParameters respParams, ControlParameters resp) {
+    // faces/update response does not have FaceUris, copy from faces/create response
+    resp.setLocalUri(respParams.getLocalUri())
+        .setUri(respParams.getUri());
+    printPositiveResult("face-updated", resp);
+  };
+
   auto handle409 = [&] (const ControlResponse& resp) {
     ControlParameters respParams(resp.getBody());
     if (respParams.getUri() != canonicalRemote.toString()) {
@@ -178,19 +189,39 @@
 
     if (persistencyLessThan(respParams.getFacePersistency(), persistency)) {
       // need to upgrade persistency
+      ControlParameters params;
+      params.setFaceId(respParams.getFaceId()).setFacePersistency(persistency);
+      if (!boost::logic::indeterminate(lpReliability)) {
+        params.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, lpReliability);
+      }
       ctx.controller.start<ndn::nfd::FaceUpdateCommand>(
-          ControlParameters().setFaceId(respParams.getFaceId()).setFacePersistency(persistency),
-          [respParams, &printPositiveResult] (ControlParameters resp2) {
-            // faces/update response does not have FaceUris, copy from faces/create response
-            resp2.setLocalUri(respParams.getLocalUri())
-                 .setUri(respParams.getUri());
-            printPositiveResult("face-updated", resp2);
-          },
+          params,
+          bind(updateFace, respParams, _1),
           ctx.makeCommandFailureHandler("upgrading face persistency"),
           ctx.makeCommandOptions());
     }
+    else if (lpReliability && !respParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)) {
+      // enable reliability
+      ControlParameters params;
+      params.setFaceId(respParams.getFaceId()).setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, true);
+      ctx.controller.start<ndn::nfd::FaceUpdateCommand>(
+          params,
+          bind(updateFace, respParams, _1),
+          ctx.makeCommandFailureHandler("enabling reliability"),
+          ctx.makeCommandOptions());
+    }
+    else if (!lpReliability && respParams.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)) {
+      // disable reliability
+      ControlParameters params;
+      params.setFaceId(respParams.getFaceId()).setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, false);
+      ctx.controller.start<ndn::nfd::FaceUpdateCommand>(
+          params,
+          bind(updateFace, respParams, _1),
+          ctx.makeCommandFailureHandler("disabling reliability"),
+          ctx.makeCommandOptions());
+    }
     else {
-      // don't downgrade persistency
+      // don't do anything
       printPositiveResult("face-exists", respParams);
     }
     return true;
@@ -203,6 +234,9 @@
       params.setLocalUri(canonicalLocal->toString());
     }
     params.setFacePersistency(persistency);
+    if (!boost::logic::indeterminate(lpReliability)) {
+      params.setFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED, lpReliability);
+    }
 
     ctx.controller.start<ndn::nfd::FaceCreateCommand>(
       params,
@@ -275,7 +309,9 @@
       ctx.out << ia("id") << face.getFaceId()
               << ia("local") << face.getLocalUri()
               << ia("remote") << face.getRemoteUri()
-              << ia("persistency") << face.getFacePersistency() << '\n';
+              << ia("persistency") << face.getFacePersistency()
+              << ia("reliability") << (resp.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED) ? "on" : "off")
+              << '\n';
     },
     ctx.makeCommandFailureHandler("destroying face"),
     ctx.makeCommandOptions());
@@ -332,6 +368,9 @@
     if (item.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)) {
       os << "<localFieldsEnabled/>";
     }
+    if (item.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)) {
+      os << "<lpReliabilityEnabled/>";
+    }
     os << "</flags>";
   }
 
@@ -400,6 +439,9 @@
   if (item.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)) {
     os << flagSep << "local-fields";
   }
+  if (item.getFlagBit(ndn::nfd::BIT_LP_RELIABILITY_ENABLED)) {
+    os << flagSep << "lp-reliability";
+  }
   os << '}';
 
   os << ia.end();
