diff --git a/src/net/detail/network-monitor-impl-noop.hpp b/src/net/detail/network-monitor-impl-noop.hpp
index f0c5fb0..919d231 100644
--- a/src/net/detail/network-monitor-impl-noop.hpp
+++ b/src/net/detail/network-monitor-impl-noop.hpp
@@ -29,27 +29,26 @@
 namespace ndn {
 namespace net {
 
-class NetworkMonitor::Impl
+class NetworkMonitorImplNoop : public NetworkMonitorImpl
 {
 public:
-  Impl(NetworkMonitor& nm, boost::asio::io_service& io)
-  {
-  }
+  explicit
+  NetworkMonitorImplNoop(boost::asio::io_service& io) = default;
 
   uint32_t
-  getCapabilities() const
+  getCapabilities() const final
   {
     return NetworkMonitor::CAP_NONE;
   }
 
-  shared_ptr<NetworkInterface>
-  getNetworkInterface(const std::string&) const
+  shared_ptr<const NetworkInterface>
+  getNetworkInterface(const std::string&) const final
   {
     return {};
   }
 
-  std::vector<shared_ptr<NetworkInterface>>
-  listNetworkInterfaces() const
+  std::vector<shared_ptr<const NetworkInterface>>
+  listNetworkInterfaces() const final
   {
     return {};
   }
diff --git a/src/net/detail/network-monitor-impl-osx.cpp b/src/net/detail/network-monitor-impl-osx.cpp
index 97f3e7c..b2129b5 100644
--- a/src/net/detail/network-monitor-impl-osx.cpp
+++ b/src/net/detail/network-monitor-impl-osx.cpp
@@ -70,13 +70,12 @@
 
 NDN_LOG_INIT(ndn.NetworkMonitor);
 
-NetworkMonitor::Impl::Impl(NetworkMonitor& nm, boost::asio::io_service& io)
-  : m_nm(nm)
-  , m_scheduler(io)
+NetworkMonitorImplOsx::NetworkMonitorImplOsx(boost::asio::io_service& io)
+  : m_scheduler(io)
   , m_cfLoopEvent(m_scheduler)
   , m_context{0, this, nullptr, nullptr, nullptr}
   , m_scStore(SCDynamicStoreCreate(nullptr, CFSTR("net.named-data.ndn-cxx.NetworkMonitor"),
-                                   &Impl::onConfigChanged, &m_context))
+                                   &NetworkMonitorImplOsx::onConfigChanged, &m_context))
   , m_loopSource(SCDynamicStoreCreateRunLoopSource(nullptr, m_scStore.get(), 0))
   , m_nullUdpSocket(io, boost::asio::ip::udp::v4())
 
@@ -89,7 +88,7 @@
   //
   CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
                                   static_cast<void*>(this),
-                                  &Impl::afterNotificationCenterEvent,
+                                  &NetworkMonitorImplOsx::afterNotificationCenterEvent,
                                   CFSTR("com.apple.system.config.network_change"),
                                   nullptr, // object to observe
                                   CFNotificationSuspensionBehaviorDeliverImmediately);
@@ -116,7 +115,7 @@
   SCDynamicStoreSetNotificationKeys(m_scStore.get(), nullptr, patterns);
 }
 
-NetworkMonitor::Impl::~Impl()
+NetworkMonitorImplOsx::~NetworkMonitorImplOsx()
 {
   CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_loopSource.get(), kCFRunLoopDefaultMode);
 
@@ -124,22 +123,17 @@
                                           static_cast<void*>(this));
 }
 
-shared_ptr<NetworkInterface>
-NetworkMonitor::Impl::getNetworkInterface(const std::string& ifname) const
+shared_ptr<const NetworkInterface>
+NetworkMonitorImplOsx::getNetworkInterface(const std::string& ifname) const
 {
   auto it = m_interfaces.find(ifname);
-  if (it != m_interfaces.end()) {
-    return it->second;
-  }
-  else {
-    return nullptr;
-  }
+  return it == m_interfaces.end() ? nullptr : it->second;
 }
 
-std::vector<shared_ptr<NetworkInterface>>
-NetworkMonitor::Impl::listNetworkInterfaces() const
+std::vector<shared_ptr<const NetworkInterface>>
+NetworkMonitorImplOsx::listNetworkInterfaces() const
 {
-  std::vector<shared_ptr<NetworkInterface>> v;
+  std::vector<shared_ptr<const NetworkInterface>> v;
   v.reserve(m_interfaces.size());
 
   for (const auto& e : m_interfaces) {
@@ -149,24 +143,24 @@
 }
 
 void
-NetworkMonitor::Impl::afterNotificationCenterEvent(CFNotificationCenterRef center,
-                                                   void* observer,
-                                                   CFStringRef name,
-                                                   const void* object,
-                                                   CFDictionaryRef userInfo)
+NetworkMonitorImplOsx::afterNotificationCenterEvent(CFNotificationCenterRef center,
+                                                    void* observer,
+                                                    CFStringRef name,
+                                                    const void* object,
+                                                    CFDictionaryRef userInfo)
 {
-  static_cast<Impl*>(observer)->m_nm.onNetworkStateChanged();
+  static_cast<NetworkMonitorImplOsx*>(observer)->emitSignal(onNetworkStateChanged);
 }
 
 void
-NetworkMonitor::Impl::scheduleCfLoop()
+NetworkMonitorImplOsx::scheduleCfLoop()
 {
   // poll each second for new events
-  m_cfLoopEvent = m_scheduler.scheduleEvent(time::seconds(1), bind(&Impl::pollCfLoop, this));
+  m_cfLoopEvent = m_scheduler.scheduleEvent(time::seconds(1), [this] { pollCfLoop(); });
 }
 
 void
-NetworkMonitor::Impl::pollCfLoop()
+NetworkMonitorImplOsx::pollCfLoop()
 {
   // this should dispatch ready events and exit
   CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
@@ -175,10 +169,9 @@
 }
 
 void
-NetworkMonitor::Impl::addNewInterface(const std::string& ifName)
+NetworkMonitorImplOsx::addNewInterface(const std::string& ifName)
 {
-  shared_ptr<NetworkInterface> interface(new NetworkInterface);
-
+  shared_ptr<NetworkInterface> interface = makeNetworkInterface();
   interface->setName(ifName);
   interface->setState(getInterfaceState(interface->getName()));
   updateInterfaceInfo(*interface);
@@ -189,16 +182,16 @@
 
   NDN_LOG_DEBUG("adding interface " << interface->getName());
   m_interfaces.insert(make_pair(interface->getName(), interface));
-  m_nm.onInterfaceAdded(interface);
+  this->emitSignal(onInterfaceAdded, interface);
 }
 
 void
-NetworkMonitor::Impl::enumerateInterfaces()
+NetworkMonitorImplOsx::enumerateInterfaces()
 {
   for (const auto& ifName : getInterfaceNames()) {
     addNewInterface(ifName);
   }
-  m_nm.onEnumerationCompleted();
+  this->emitSignal(onEnumerationCompleted);
 }
 
 static std::string
@@ -209,18 +202,19 @@
     return cStr;
   }
 
-  size_t stringSize =  CFStringGetLength(cfString);
+  size_t stringSize = CFStringGetLength(cfString);
   char* buffer = new char[stringSize + 1];
   CFStringGetCString(cfString, buffer, sizeof(buffer), kCFStringEncodingASCII);
   std::string retval = buffer;
-  delete [] buffer;
+  delete[] buffer;
   return retval;
 }
 
 std::set<std::string>
-NetworkMonitor::Impl::getInterfaceNames()
+NetworkMonitorImplOsx::getInterfaceNames()
 {
-  CFReleaser<CFDictionaryRef> dict = (CFDictionaryRef)SCDynamicStoreCopyValue(m_scStore.get(), CFSTR("State:/Network/Interface"));
+  CFReleaser<CFDictionaryRef> dict =
+    (CFDictionaryRef)SCDynamicStoreCopyValue(m_scStore.get(), CFSTR("State:/Network/Interface"));
   CFArrayRef interfaces = (CFArrayRef)CFDictionaryGetValue(dict.get(), CFSTR("Interfaces"));
 
   std::set<std::string> ifNames;
@@ -233,11 +227,11 @@
 }
 
 InterfaceState
-NetworkMonitor::Impl::getInterfaceState(const std::string& ifName)
+NetworkMonitorImplOsx::getInterfaceState(const std::string& ifName)
 {
-  CFReleaser<CFStringRef> linkName = CFStringCreateWithCString(nullptr,
-                                                               ("State:/Network/Interface/" + ifName + "/Link").c_str(),
-                                                               kCFStringEncodingASCII);
+  CFReleaser<CFStringRef> linkName =
+    CFStringCreateWithCString(nullptr, ("State:/Network/Interface/" + ifName + "/Link").c_str(),
+                              kCFStringEncodingASCII);
 
   CFReleaser<CFDictionaryRef> dict = (CFDictionaryRef)SCDynamicStoreCopyValue(m_scStore.get(), linkName.get());
   if (dict.get() == nullptr) {
@@ -252,8 +246,22 @@
   return CFBooleanGetValue(isActive) ? InterfaceState::RUNNING : InterfaceState::DOWN;
 }
 
+template<typename AddressBytes>
+static uint8_t
+computePrefixLength(const AddressBytes& mask)
+{
+  uint8_t prefixLength = 0;
+  for (auto byte : mask) {
+    while (byte != 0) {
+      ++prefixLength;
+      byte <<= 1;
+    }
+  }
+  return prefixLength;
+}
+
 void
-NetworkMonitor::Impl::updateInterfaceInfo(NetworkInterface& netif)
+NetworkMonitorImplOsx::updateInterfaceInfo(NetworkInterface& netif)
 {
   ifaddrs* ifa_list = nullptr;
   if (::getifaddrs(&ifa_list) < 0) {
@@ -271,48 +279,38 @@
     if (ifa->ifa_addr == nullptr)
       continue;
 
-    NetworkAddress address;
+    namespace ip = boost::asio::ip;
+    AddressFamily addressFamily = AddressFamily::UNSPECIFIED;
+    ip::address ipAddr, broadcast;
+    uint8_t prefixLength = 0;
+
 
     switch (ifa->ifa_addr->sa_family) {
       case AF_INET: {
-        address.m_family = AddressFamily::V4;
+        addressFamily = AddressFamily::V4;
 
         const sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(ifa->ifa_addr);
-        boost::asio::ip::address_v4::bytes_type bytes;
+        ip::address_v4::bytes_type bytes;
         std::copy_n(reinterpret_cast<const unsigned char*>(&sin->sin_addr), bytes.size(), bytes.begin());
-        address.m_ip = boost::asio::ip::address_v4(bytes);
+        ipAddr = ip::address_v4(bytes);
 
         const sockaddr_in* sinMask = reinterpret_cast<sockaddr_in*>(ifa->ifa_netmask);
         std::copy_n(reinterpret_cast<const unsigned char*>(&sinMask->sin_addr), bytes.size(), bytes.begin());
-        uint8_t mask = 0;
-        for (auto byte : bytes) {
-          while (byte != 0) {
-            ++mask;
-            byte <<= 1;
-          }
-        }
-        address.m_prefixLength = mask;
+        prefixLength = computePrefixLength(bytes);
         break;
       }
 
       case AF_INET6: {
-        address.m_family = AddressFamily::V6;
+        addressFamily = AddressFamily::V6;
 
         const sockaddr_in6* sin6 = reinterpret_cast<sockaddr_in6*>(ifa->ifa_addr);
-        boost::asio::ip::address_v6::bytes_type bytes;
+        ip::address_v6::bytes_type bytes;
         std::copy_n(reinterpret_cast<const unsigned char*>(&sin6->sin6_addr), bytes.size(), bytes.begin());
-        address.m_ip = boost::asio::ip::address_v6(bytes);
+        ipAddr = ip::address_v6(bytes);
 
         const sockaddr_in6* sinMask = reinterpret_cast<sockaddr_in6*>(ifa->ifa_netmask);
         std::copy_n(reinterpret_cast<const unsigned char*>(&sinMask->sin6_addr), bytes.size(), bytes.begin());
-        uint8_t mask = 0;
-        for (auto byte : bytes) {
-          while (byte != 0) {
-            ++mask;
-            byte <<= 1;
-          }
-        }
-        address.m_prefixLength = mask;
+        prefixLength = computePrefixLength(bytes);
         break;
       }
 
@@ -339,24 +337,26 @@
 
     if (netif.canBroadcast() && ifa->ifa_broadaddr != nullptr) {
       const sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(ifa->ifa_broadaddr);
-      boost::asio::ip::address_v4::bytes_type bytes;
+      ip::address_v4::bytes_type bytes;
       std::copy_n(reinterpret_cast<const unsigned char*>(&sin->sin_addr), bytes.size(), bytes.begin());
-      address.m_broadcast = boost::asio::ip::address_v4(bytes);
-      NDN_LOG_TRACE(netif.getName() << ": set IPv4 broadcast address " << address.m_broadcast);
+      broadcast = ip::address_v4(bytes);
+      NDN_LOG_TRACE(netif.getName() << ": set IPv4 broadcast address " << broadcast);
     }
 
     if (netif.canBroadcast()) {
       netif.setEthernetBroadcastAddress(ethernet::getBroadcastAddress());
     }
 
-    netif.addNetworkAddress(address);
+    netif.addNetworkAddress(NetworkAddress(addressFamily, ipAddr, broadcast, prefixLength,
+                                           AddressScope::NOWHERE, 0));
+    ///\todo #3817 extract AddressScope from OS
   }
 
   ::freeifaddrs(ifa_list);
 }
 
 size_t
-NetworkMonitor::Impl::getInterfaceMtu(const std::string& ifName)
+NetworkMonitorImplOsx::getInterfaceMtu(const std::string& ifName)
 {
   ifreq ifr{};
   std::strncpy(ifr.ifr_name, ifName.c_str(), sizeof(ifr.ifr_name) - 1);
@@ -370,13 +370,13 @@
 }
 
 void
-NetworkMonitor::Impl::onConfigChanged(SCDynamicStoreRef m_scStore, CFArrayRef changedKeys, void* context)
+NetworkMonitorImplOsx::onConfigChanged(SCDynamicStoreRef m_scStore, CFArrayRef changedKeys, void* context)
 {
-  static_cast<Impl*>(context)->onConfigChanged(changedKeys);
+  static_cast<NetworkMonitorImplOsx*>(context)->onConfigChanged(changedKeys);
 }
 
 void
-NetworkMonitor::Impl::onConfigChanged(CFArrayRef changedKeys)
+NetworkMonitorImplOsx::onConfigChanged(CFArrayRef changedKeys)
 {
   size_t count = CFArrayGetCount(changedKeys);
   for (size_t i = 0; i != count; ++i) {
@@ -396,7 +396,7 @@
       NDN_LOG_DEBUG("removing interface " << ifName);
       shared_ptr<NetworkInterface> removedInterface = ifIt->second;
       m_interfaces.erase(ifIt);
-      m_nm.onInterfaceRemoved(removedInterface);
+      this->emitSignal(onInterfaceRemoved, removedInterface);
     };
 
     if (key.at(-1).toUri() == "Link") {
@@ -416,17 +416,17 @@
     }
 
     if (key.at(-1).toUri() == "IPv4" || key.at(-1).toUri() == "IPv6") {
-      NetworkInterface updatedInterface;
-      updatedInterface.setName(ifName);
-      updateInterfaceInfo(updatedInterface);
-      if (updatedInterface.getType() == InterfaceType::UNKNOWN) {
+      shared_ptr<NetworkInterface> updatedInterface = makeNetworkInterface();
+      updatedInterface->setName(ifName);
+      updateInterfaceInfo(*updatedInterface);
+      if (updatedInterface->getType() == InterfaceType::UNKNOWN) {
         // somehow, type of interface changed to unknown
         NDN_LOG_DEBUG("Removing " << ifName << " because it changed to unhandled interface type");
         removeInterface();
         return;
       }
 
-      const auto& newAddrs = updatedInterface.getNetworkAddresses();
+      const auto& newAddrs = updatedInterface->getNetworkAddresses();
       const auto& oldAddrs = netif.getNetworkAddresses();
 
       std::set<NetworkAddress> added;
diff --git a/src/net/detail/network-monitor-impl-osx.hpp b/src/net/detail/network-monitor-impl-osx.hpp
index 3aac23f..d1ce8f2 100644
--- a/src/net/detail/network-monitor-impl-osx.hpp
+++ b/src/net/detail/network-monitor-impl-osx.hpp
@@ -29,7 +29,6 @@
 #error "This file should not be compiled ..."
 #endif
 
-#include "../network-interface.hpp"
 #include "../../security/tpm/helper-osx.hpp"
 #include "../../util/scheduler.hpp"
 #include "../../util/scheduler-scoped-event-id.hpp"
@@ -42,25 +41,29 @@
 namespace ndn {
 namespace net {
 
-class NetworkMonitor::Impl
+class NetworkMonitorImplOsx : public NetworkMonitorImpl
 {
 public:
-  Impl(NetworkMonitor& nm, boost::asio::io_service& io);
+  using Error = NetworkMonitor::Error;
 
-  ~Impl();
+  NetworkMonitorImplOsx(boost::asio::io_service& io);
+
+  ~NetworkMonitorImplOsx();
 
   uint32_t
-  getCapabilities() const
+  getCapabilities() const final
   {
-    return NetworkMonitor::CAP_ENUM | NetworkMonitor::CAP_IF_ADD_REMOVE |
-      NetworkMonitor::CAP_STATE_CHANGE | NetworkMonitor::CAP_ADDR_ADD_REMOVE;
+    return NetworkMonitor::CAP_ENUM |
+           NetworkMonitor::CAP_IF_ADD_REMOVE |
+           NetworkMonitor::CAP_STATE_CHANGE |
+           NetworkMonitor::CAP_ADDR_ADD_REMOVE;
   }
 
-  shared_ptr<NetworkInterface>
-  getNetworkInterface(const std::string& ifname) const;
+  shared_ptr<const NetworkInterface>
+  getNetworkInterface(const std::string& ifname) const final;
 
-  std::vector<shared_ptr<NetworkInterface>>
-  listNetworkInterfaces() const;
+  std::vector<shared_ptr<const NetworkInterface>>
+  listNetworkInterfaces() const final;
 
   static void
   afterNotificationCenterEvent(CFNotificationCenterRef center,
@@ -101,8 +104,7 @@
   onConfigChanged(CFArrayRef changedKeys);
 
 private:
-  NetworkMonitor& m_nm;
-  std::map<std::string /*ifname*/, shared_ptr<NetworkInterface>> m_interfaces; ///< interface map
+  std::map<std::string, shared_ptr<NetworkInterface>> m_interfaces; ///< ifname => interface
 
   util::Scheduler m_scheduler;
   util::scheduler::ScopedEventId m_cfLoopEvent;
diff --git a/src/net/detail/network-monitor-impl-rtnl.cpp b/src/net/detail/network-monitor-impl-rtnl.cpp
index 1a05986..71274a1 100644
--- a/src/net/detail/network-monitor-impl-rtnl.cpp
+++ b/src/net/detail/network-monitor-impl-rtnl.cpp
@@ -40,9 +40,8 @@
 namespace ndn {
 namespace net {
 
-NetworkMonitor::Impl::Impl(NetworkMonitor& nm, boost::asio::io_service& io)
-  : m_nm(nm)
-  , m_socket(make_shared<boost::asio::posix::stream_descriptor>(io))
+NetworkMonitorImplRtnl::NetworkMonitorImplRtnl(boost::asio::io_service& io)
+  : m_socket(make_shared<boost::asio::posix::stream_descriptor>(io))
   , m_pid(0)
   , m_sequenceNo(static_cast<uint32_t>(time::system_clock::now().time_since_epoch().count()))
   , m_isEnumeratingLinks(false)
@@ -56,14 +55,14 @@
   m_isEnumeratingLinks = true;
 }
 
-NetworkMonitor::Impl::~Impl()
+NetworkMonitorImplRtnl::~NetworkMonitorImplRtnl()
 {
   boost::system::error_code error;
   m_socket->close(error);
 }
 
-shared_ptr<NetworkInterface>
-NetworkMonitor::Impl::getNetworkInterface(const std::string& ifname) const
+shared_ptr<const NetworkInterface>
+NetworkMonitorImplRtnl::getNetworkInterface(const std::string& ifname) const
 {
   for (const auto& e : m_interfaces) {
     if (e.second->getName() == ifname)
@@ -72,10 +71,10 @@
   return nullptr;
 }
 
-std::vector<shared_ptr<NetworkInterface>>
-NetworkMonitor::Impl::listNetworkInterfaces() const
+std::vector<shared_ptr<const NetworkInterface>>
+NetworkMonitorImplRtnl::listNetworkInterfaces() const
 {
-  std::vector<shared_ptr<NetworkInterface>> v;
+  std::vector<shared_ptr<const NetworkInterface>> v;
   v.reserve(m_interfaces.size());
 
   for (const auto& e : m_interfaces) {
@@ -85,13 +84,13 @@
 }
 
 bool
-NetworkMonitor::Impl::isEnumerating() const
+NetworkMonitorImplRtnl::isEnumerating() const
 {
   return m_isEnumeratingLinks || m_isEnumeratingAddresses;
 }
 
 void
-NetworkMonitor::Impl::initSocket()
+NetworkMonitorImplRtnl::initSocket()
 {
   NDN_LOG_TRACE("creating netlink socket");
 
@@ -129,7 +128,7 @@
 }
 
 void
-NetworkMonitor::Impl::sendDumpRequest(uint16_t nlmsgType)
+NetworkMonitorImplRtnl::sendDumpRequest(uint16_t nlmsgType)
 {
   auto request = make_shared<RtnlRequest>();
   request->nlh.nlmsg_len = sizeof(RtnlRequest);
@@ -217,14 +216,14 @@
 }
 
 void
-NetworkMonitor::Impl::asyncRead()
+NetworkMonitorImplRtnl::asyncRead()
 {
   m_socket->async_read_some(boost::asio::buffer(m_buffer),
-                            bind(&Impl::handleRead, this, _1, _2, m_socket));
+                            bind(&NetworkMonitorImplRtnl::handleRead, this, _1, _2, m_socket));
 }
 
 void
-NetworkMonitor::Impl::handleRead(const boost::system::error_code& error, size_t nBytesRead,
+NetworkMonitorImplRtnl::handleRead(const boost::system::error_code& error, size_t nBytesRead,
                                  const shared_ptr<boost::asio::posix::stream_descriptor>& socket)
 {
   if (!socket->is_open() ||
@@ -252,7 +251,7 @@
 }
 
 void
-NetworkMonitor::Impl::parseNetlinkMessage(const nlmsghdr* nlh, size_t len)
+NetworkMonitorImplRtnl::parseNetlinkMessage(const nlmsghdr* nlh, size_t len)
 {
   while (NLMSG_OK(nlh, len)) {
     NDN_LOG_TRACE("parsing " << (nlh->nlmsg_flags & NLM_F_MULTI ? "multi-part " : "") <<
@@ -275,21 +274,21 @@
       case RTM_DELLINK:
         parseLinkMessage(nlh, reinterpret_cast<const ifinfomsg*>(NLMSG_DATA(nlh)));
         if (!isEnumerating())
-          m_nm.onNetworkStateChanged(); // backward compat
+          this->emitSignal(onNetworkStateChanged); // backward compat
         break;
 
       case RTM_NEWADDR:
       case RTM_DELADDR:
         parseAddressMessage(nlh, reinterpret_cast<const ifaddrmsg*>(NLMSG_DATA(nlh)));
         if (!isEnumerating())
-          m_nm.onNetworkStateChanged(); // backward compat
+          this->emitSignal(onNetworkStateChanged); // backward compat
         break;
 
       case RTM_NEWROUTE:
       case RTM_DELROUTE:
         parseRouteMessage(nlh, reinterpret_cast<const rtmsg*>(NLMSG_DATA(nlh)));
         if (!isEnumerating())
-          m_nm.onNetworkStateChanged(); // backward compat
+          this->emitSignal(onNetworkStateChanged); // backward compat
         break;
 
       case NLMSG_ERROR: {
@@ -320,12 +319,12 @@
     m_isEnumeratingAddresses = false;
     // TODO: enumerate routes
     NDN_LOG_DEBUG("enumeration complete");
-    m_nm.onEnumerationCompleted();
+    this->emitSignal(onEnumerationCompleted);
   }
 }
 
 void
-NetworkMonitor::Impl::parseLinkMessage(const nlmsghdr* nlh, const ifinfomsg* ifi)
+NetworkMonitorImplRtnl::parseLinkMessage(const nlmsghdr* nlh, const ifinfomsg* ifi)
 {
   if (ifiTypeToInterfaceType(ifi->ifi_type) == InterfaceType::UNKNOWN) {
     NDN_LOG_DEBUG("unhandled interface type " << ifi->ifi_type);
@@ -344,14 +343,13 @@
     if (interface != nullptr) {
       NDN_LOG_DEBUG("removing interface " << interface->getName());
       m_interfaces.erase(it);
-      m_nm.onInterfaceRemoved(interface);
+      this->emitSignal(onInterfaceRemoved, interface);
     }
     return;
   }
 
   if (interface == nullptr) {
-    // cannot use make_shared because NetworkInterface constructor is private
-    interface.reset(new NetworkInterface);
+    interface = makeNetworkInterface();
     interface->setIndex(ifi->ifi_index);
   }
   interface->setType(ifiTypeToInterfaceType(ifi->ifi_type));
@@ -405,12 +403,12 @@
   if (it == m_interfaces.end()) {
     NDN_LOG_DEBUG("adding interface " << interface->getName());
     m_interfaces[interface->getIndex()] = interface;
-    m_nm.onInterfaceAdded(interface);
+    this->emitSignal(onInterfaceAdded, interface);
   }
 }
 
 void
-NetworkMonitor::Impl::parseAddressMessage(const nlmsghdr* nlh, const ifaddrmsg* ifa)
+NetworkMonitorImplRtnl::parseAddressMessage(const nlmsghdr* nlh, const ifaddrmsg* ifa)
 {
   auto it = m_interfaces.find(ifa->ifa_index);
   if (it == m_interfaces.end()) {
@@ -422,13 +420,8 @@
   BOOST_ASSERT(interface != nullptr);
 
   namespace ip = boost::asio::ip;
-
-  NetworkAddress address;
-  address.m_family = ifaFamilyToAddressFamily(ifa->ifa_family);
-  BOOST_ASSERT(address.m_family != AddressFamily::UNSPECIFIED);
-  address.m_prefixLength = ifa->ifa_prefixlen;
-  address.m_flags = ifa->ifa_flags; // will be overridden by IFA_FLAGS below, if the attribute is present
-  address.m_scope = ifaScopeToAddressScope(ifa->ifa_scope);
+  ip::address ipAddr, broadcast;
+  uint32_t flags = ifa->ifa_flags; // will be overridden by IFA_FLAGS if the attribute is present
 
   const rtattr* rta = reinterpret_cast<const rtattr*>(IFA_RTA(ifa));
   size_t rtaTotalLen = IFA_PAYLOAD(nlh);
@@ -442,7 +435,7 @@
         if (ifa->ifa_family == AF_INET && attrLen == sizeof(ip::address_v4::bytes_type)) {
           ip::address_v4::bytes_type bytes;
           std::copy_n(attrData, bytes.size(), bytes.begin());
-          address.m_ip = ip::address_v4(bytes);
+          ipAddr = ip::address_v4(bytes);
         }
         break;
 
@@ -450,7 +443,7 @@
         if (ifa->ifa_family == AF_INET6 && attrLen == sizeof(ip::address_v6::bytes_type)) {
           ip::address_v6::bytes_type bytes;
           std::copy_n(attrData, bytes.size(), bytes.begin());
-          address.m_ip = ip::address_v6(bytes);
+          ipAddr = ip::address_v6(bytes);
         }
         break;
 
@@ -458,14 +451,14 @@
         if (ifa->ifa_family == AF_INET && attrLen == sizeof(ip::address_v4::bytes_type)) {
           ip::address_v4::bytes_type bytes;
           std::copy_n(attrData, bytes.size(), bytes.begin());
-          address.m_broadcast = ip::address_v4(bytes);
+          broadcast = ip::address_v4(bytes);
         }
         break;
 
 #ifdef NDN_CXX_HAVE_IFA_FLAGS
       case IFA_FLAGS:
         if (attrLen == sizeof(uint32_t))
-          address.m_flags = *(reinterpret_cast<const uint32_t*>(attrData));
+          flags = *(reinterpret_cast<const uint32_t*>(attrData));
         break;
 #endif // NDN_CXX_HAVE_IFA_FLAGS
     }
@@ -473,6 +466,15 @@
     rta = RTA_NEXT(rta, rtaTotalLen);
   }
 
+  NetworkAddress address(
+    ifaFamilyToAddressFamily(ifa->ifa_family),
+    ipAddr,
+    broadcast,
+    ifa->ifa_prefixlen,
+    ifaScopeToAddressScope(ifa->ifa_scope),
+    flags);
+  BOOST_ASSERT(address.getFamily() != AddressFamily::UNSPECIFIED);
+
   if (nlh->nlmsg_type == RTM_NEWADDR)
     interface->addNetworkAddress(address);
   else if (nlh->nlmsg_type == RTM_DELADDR)
@@ -480,13 +482,13 @@
 }
 
 void
-NetworkMonitor::Impl::parseRouteMessage(const nlmsghdr* nlh, const rtmsg* rtm)
+NetworkMonitorImplRtnl::parseRouteMessage(const nlmsghdr* nlh, const rtmsg* rtm)
 {
   // TODO
 }
 
 void
-NetworkMonitor::Impl::updateInterfaceState(NetworkInterface& interface, uint8_t operState)
+NetworkMonitorImplRtnl::updateInterfaceState(NetworkInterface& interface, uint8_t operState)
 {
   if (operState == linux_if::OPER_STATE_UP) {
     interface.setState(InterfaceState::RUNNING);
diff --git a/src/net/detail/network-monitor-impl-rtnl.hpp b/src/net/detail/network-monitor-impl-rtnl.hpp
index d43abce..ce15dd5 100644
--- a/src/net/detail/network-monitor-impl-rtnl.hpp
+++ b/src/net/detail/network-monitor-impl-rtnl.hpp
@@ -44,17 +44,20 @@
 namespace ndn {
 namespace net {
 
-class NetworkMonitor::Impl
+class NetworkMonitorImplRtnl : public NetworkMonitorImpl
 {
 public:
+  using Error = NetworkMonitor::Error;
+
   /** \brief initialize netlink socket and start enumerating interfaces
    */
-  Impl(NetworkMonitor& nm, boost::asio::io_service& io);
+  explicit
+  NetworkMonitorImplRtnl(boost::asio::io_service& io);
 
-  ~Impl();
+  ~NetworkMonitorImplRtnl();
 
   uint32_t
-  getCapabilities() const
+  getCapabilities() const final
   {
     return NetworkMonitor::CAP_ENUM |
            NetworkMonitor::CAP_IF_ADD_REMOVE |
@@ -63,11 +66,11 @@
            NetworkMonitor::CAP_ADDR_ADD_REMOVE;
   }
 
-  shared_ptr<NetworkInterface>
-  getNetworkInterface(const std::string& ifname) const;
+  shared_ptr<const NetworkInterface>
+  getNetworkInterface(const std::string& ifname) const final;
 
-  std::vector<shared_ptr<NetworkInterface>>
-  listNetworkInterfaces() const;
+  std::vector<shared_ptr<const NetworkInterface>>
+  listNetworkInterfaces() const final;
 
 private:
   struct RtnlRequest
@@ -110,9 +113,8 @@
   updateInterfaceState(NetworkInterface& interface, uint8_t operState);
 
 private:
-  NetworkMonitor& m_nm;
-  std::map<int /*ifindex*/, shared_ptr<NetworkInterface>> m_interfaces; ///< interface map
-  std::array<uint8_t, 16384> m_buffer; ///< holds netlink messages received from the kernel
+  std::map<int, shared_ptr<NetworkInterface>> m_interfaces; ///< ifindex => interface
+  std::array<uint8_t, 16384> m_buffer; ///< netlink messages received from the kernel
   shared_ptr<boost::asio::posix::stream_descriptor> m_socket; ///< the netlink socket
   uint32_t m_pid; ///< our port ID (unicast address for netlink sockets)
   uint32_t m_sequenceNo; ///< sequence number of the last netlink request sent to the kernel
