diff --git a/tests/daemon/face/ethernet-factory.t.cpp b/tests/daemon/face/ethernet-factory.t.cpp
index 0ee4562..d09c7df 100644
--- a/tests/daemon/face/ethernet-factory.t.cpp
+++ b/tests/daemon/face/ethernet-factory.t.cpp
@@ -39,11 +39,6 @@
                              , public FaceSystemFactoryFixture<EthernetFactory>
 {
 protected:
-  EthernetFactoryFixture()
-  {
-    this->copyRealNetifsToNetmon();
-  }
-
   std::set<std::string>
   listUrisOfAvailableNetifs() const
   {
@@ -59,17 +54,37 @@
     return listFacesByScheme("ether", linkType);
   }
 
-  size_t
-  countEtherMcastFaces(ndn::nfd::LinkType linkType = ndn::nfd::LINK_TYPE_MULTI_ACCESS) const
+  shared_ptr<ndn::net::NetworkInterface>
+  makeFakeNetif()
   {
-    return listEtherMcastFaces(linkType).size();
+    static int counter = 0;
+    ++counter;
+
+    auto netif = netmon->makeNetworkInterface();
+    netif->setIndex(1000 + counter);
+    netif->setName("ethdummy" + std::to_string(counter));
+    netif->setType(ndn::net::InterfaceType::ETHERNET);
+    netif->setFlags(IFF_MULTICAST | IFF_UP);
+    netif->setState(ndn::net::InterfaceState::RUNNING);
+    netif->setMtu(1500);
+    netif->setEthernetAddress(ethernet::Address{0x00, 0x00, 0x5e, 0x00, 0x53, 0x5e});
+    return netif;
+  }
+};
+
+class EthernetFactoryFixtureWithRealNetifs : public EthernetFactoryFixture
+{
+protected:
+  EthernetFactoryFixtureWithRealNetifs()
+  {
+    copyRealNetifsToNetmon();
   }
 };
 
 BOOST_AUTO_TEST_SUITE(Face)
-BOOST_FIXTURE_TEST_SUITE(TestEthernetFactory, EthernetFactoryFixture)
+BOOST_AUTO_TEST_SUITE(TestEthernetFactory)
 
-BOOST_AUTO_TEST_SUITE(ProcessConfig)
+BOOST_FIXTURE_TEST_SUITE(ProcessConfig, EthernetFactoryFixtureWithRealNetifs)
 
 BOOST_AUTO_TEST_CASE(Defaults)
 {
@@ -79,9 +94,6 @@
     face_system
     {
       ether
-      {
-        mcast no
-      }
     }
   )CONFIG";
 
@@ -92,10 +104,10 @@
   auto channels = factory.getChannels();
   BOOST_CHECK(std::all_of(channels.begin(), channels.end(),
                           [] (const auto& ch) { return ch->isListening(); }));
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), netifs.size());
 }
 
-BOOST_AUTO_TEST_CASE(DisableListen)
+BOOST_AUTO_TEST_CASE(DisableListenAndMcast)
 {
   SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
 
@@ -118,13 +130,11 @@
   auto channels = factory.getChannels();
   BOOST_CHECK(std::none_of(channels.begin(), channels.end(),
                            [] (const auto& ch) { return ch->isListening(); }));
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(McastNormal)
 {
-  SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
-
   const std::string CONFIG = R"CONFIG(
     face_system
     {
@@ -148,8 +158,9 @@
   parseConfig(CONFIG, true);
   parseConfig(CONFIG, false);
 
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), netifs.size());
-  for (const auto& face : this->listEtherMcastFaces()) {
+  auto etherMcastFaces = this->listEtherMcastFaces();
+  BOOST_CHECK_EQUAL(etherMcastFaces.size(), netifs.size());
+  for (const auto* face : etherMcastFaces) {
     BOOST_REQUIRE(face->getChannel().lock());
     // not universal, but for Ethernet, local URI of a mcast face matches URI of the associated channel
     BOOST_CHECK_EQUAL(face->getLocalUri(), face->getChannel().lock()->getUri());
@@ -180,17 +191,17 @@
   )CONFIG";
 
   parseConfig(CONFIG_WITHOUT_MCAST, false);
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
 
   SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
 
   parseConfig(CONFIG_WITH_MCAST, false);
   g_io.poll();
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), netifs.size());
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), netifs.size());
 
   parseConfig(CONFIG_WITHOUT_MCAST, false);
   g_io.poll();
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(McastAdHoc)
@@ -203,15 +214,14 @@
       ether
       {
         listen no
-        mcast yes
         mcast_ad_hoc yes
       }
     }
   )CONFIG";
 
   parseConfig(CONFIG, false);
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(ndn::nfd::LINK_TYPE_MULTI_ACCESS), 0);
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(ndn::nfd::LINK_TYPE_AD_HOC), netifs.size());
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces(ndn::nfd::LINK_TYPE_MULTI_ACCESS).size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces(ndn::nfd::LINK_TYPE_AD_HOC).size(), netifs.size());
 }
 
 BOOST_AUTO_TEST_CASE(ChangeMcastGroup)
@@ -238,6 +248,7 @@
   )CONFIG";
 
   parseConfig(CONFIG1, false);
+  g_io.poll();
   auto etherMcastFaces = this->listEtherMcastFaces();
   BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), netifs.size());
   BOOST_CHECK_EQUAL(etherMcastFaces.front()->getRemoteUri(),
@@ -317,7 +328,7 @@
   parseConfig(CONFIG, true);
   parseConfig(CONFIG, false);
 
-  BOOST_CHECK_EQUAL(this->countEtherMcastFaces(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
 }
 
 BOOST_AUTO_TEST_CASE(BadListen)
@@ -432,7 +443,7 @@
 
 BOOST_AUTO_TEST_SUITE_END() // ProcessConfig
 
-BOOST_AUTO_TEST_CASE(GetChannels)
+BOOST_FIXTURE_TEST_CASE(GetChannels, EthernetFactoryFixtureWithRealNetifs)
 {
   BOOST_CHECK_EQUAL(factory.getChannels().empty(), true);
 
@@ -442,22 +453,23 @@
   checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()});
 }
 
-BOOST_AUTO_TEST_CASE(CreateChannel)
+BOOST_FIXTURE_TEST_CASE(CreateChannel, EthernetFactoryFixtureWithRealNetifs)
 {
   SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
 
   auto channel1 = factory.createChannel(netifs.front(), 1_min);
   auto channel1a = factory.createChannel(netifs.front(), 5_min);
   BOOST_CHECK_EQUAL(channel1, channel1a);
-  BOOST_CHECK_EQUAL(channel1->getUri().toString(), "dev://" + netifs.front()->getName());
+  checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()});
 
   SKIP_IF_ETHERNET_NETIF_COUNT_LT(2);
 
   auto channel2 = factory.createChannel(netifs.back(), 1_min);
   BOOST_CHECK_NE(channel1, channel2);
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 2);
 }
 
-BOOST_AUTO_TEST_CASE(CreateFace)
+BOOST_FIXTURE_TEST_CASE(CreateFace, EthernetFactoryFixtureWithRealNetifs)
 {
   createFace(factory,
              FaceUri("ether://[00:00:5e:00:53:5e]"),
@@ -505,7 +517,7 @@
              {CreateFaceExpectedResult::SUCCESS, 0, ""});
 }
 
-BOOST_AUTO_TEST_CASE(UnsupportedCreateFace)
+BOOST_FIXTURE_TEST_CASE(CreateFaceInvalidRequest, EthernetFactoryFixture)
 {
   createFace(factory,
              FaceUri("ether://[00:00:5e:00:53:5e]"),
@@ -541,8 +553,119 @@
              {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, {}, true, false, false},
              {CreateFaceExpectedResult::FAILURE, 406,
               "Local fields can only be enabled on faces with local scope"});
+
+  createFace(factory,
+             FaceUri("ether://[00:00:5e:00:53:5e]"),
+             FaceUri("dev://eth0"),
+             {ndn::nfd::FACE_PERSISTENCY_PERSISTENT, {}, {}, 42, false, false, false},
+             {CreateFaceExpectedResult::FAILURE, 406,
+              "Override MTU cannot be less than 64"});
 }
 
+BOOST_FIXTURE_TEST_SUITE(OnInterfaceAdded, EthernetFactoryFixture)
+
+BOOST_AUTO_TEST_CASE(EligibleForChannelAndMcast)
+{
+  parseConfig(R"CONFIG(
+    face_system
+    {
+      ether
+    }
+  )CONFIG", false);
+  g_io.poll();
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+
+  // Add a fake interface that satisfies both unicast and multicast criteria.
+  netmon->addInterface(this->makeFakeNetif());
+  // The channel fails to listen because the interface is fake.
+  // However, it's not removed from the channel list (issue #4400).
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 1);
+  // Multicast face creation fails because the interface is fake.
+  // This test is to ensure that the factory handles failures gracefully.
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+
+  SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
+
+  // Now add a real interface: both channel and multicast face should be created successfully.
+  netmon->addInterface(const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()));
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 2);
+  auto etherMcastFaces = this->listEtherMcastFaces();
+  BOOST_REQUIRE_EQUAL(etherMcastFaces.size(), 1);
+  BOOST_CHECK_EQUAL(etherMcastFaces.front()->getLocalUri(), FaceUri::fromDev(netifs.front()->getName()));
+}
+
+BOOST_AUTO_TEST_CASE(EligibleForChannelOnly)
+{
+  SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
+
+  parseConfig(R"CONFIG(
+    face_system
+    {
+      ether
+      {
+        listen no
+      }
+    }
+  )CONFIG", false);
+  g_io.poll();
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+
+  // Add an interface that satisfies only the unicast criteria.
+  auto netif = const_pointer_cast<ndn::net::NetworkInterface>(netifs.front());
+  netif->setFlags(netif->getFlags() & ~IFF_MULTICAST);
+  netmon->addInterface(netif);
+  checkChannelListEqual(factory, {FaceUri::fromDev(netifs.front()->getName()).toString()});
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(Ineligible)
+{
+  parseConfig(R"CONFIG(
+    face_system
+    {
+      ether
+    }
+  )CONFIG", false);
+  g_io.poll();
+
+  // netif is down
+  auto netif = this->makeFakeNetif();
+  netif->setFlags(netif->getFlags() & ~IFF_UP);
+  netmon->addInterface(netif);
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+
+  // incompatible netif type
+  netif = this->makeFakeNetif();
+  netif->setType(ndn::net::InterfaceType::LOOPBACK);
+  netmon->addInterface(netif);
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+
+  // invalid Ethernet address
+  netif = this->makeFakeNetif();
+  netif->setEthernetAddress(ethernet::Address{});
+  netmon->addInterface(netif);
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(Disabled)
+{
+  SKIP_IF_ETHERNET_NETIF_COUNT_LT(1);
+
+  parseConfig("", false);
+  g_io.poll();
+
+  netmon->addInterface(const_pointer_cast<ndn::net::NetworkInterface>(netifs.front()));
+  BOOST_CHECK_EQUAL(factory.getChannels().size(), 0);
+  BOOST_CHECK_EQUAL(this->listEtherMcastFaces().size(), 0);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // OnInterfaceAdded
+
 BOOST_AUTO_TEST_SUITE_END() // TestEthernetFactory
 BOOST_AUTO_TEST_SUITE_END() // Face
 
