diff --git a/src/dhcp_configuration.cpp b/src/dhcp_configuration.cpp
index 41c364b..d421111 100644
--- a/src/dhcp_configuration.cpp
+++ b/src/dhcp_configuration.cpp
@@ -66,7 +66,7 @@
     auto name = ConfigIntf::sendHostNameEnabled(value);
 
     manager.writeToConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return name;
 }
@@ -80,7 +80,7 @@
 
     auto name = ConfigIntf::hostNameEnabled(value);
     manager.writeToConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return name;
 }
@@ -94,7 +94,7 @@
 
     auto ntp = ConfigIntf::ntpEnabled(value);
     manager.writeToConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return ntp;
 }
@@ -108,7 +108,7 @@
 
     auto dns = ConfigIntf::dnsEnabled(value);
     manager.writeToConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return dns;
 }
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index 67dd16b..e836268 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -95,22 +95,6 @@
     EthernetInterfaceIntf::dhcp6(dhcpVal.v6);
     EthernetInterfaceIntf::ipv6AcceptRA(getIPv6AcceptRA(config));
     EthernetInterfaceIntf::nicEnabled(enabled);
-    {
-        const auto& gws = manager.getRouteTable().getDefaultGateway();
-        auto it = gws.find(ifIdx);
-        if (it != gws.end())
-        {
-            EthernetInterfaceIntf::defaultGateway(std::to_string(it->second));
-        }
-    }
-    {
-        const auto& gws = manager.getRouteTable().getDefaultGateway6();
-        auto it = gws.find(ifIdx);
-        if (it != gws.end())
-        {
-            EthernetInterfaceIntf::defaultGateway6(std::to_string(it->second));
-        }
-    }
 
     EthernetInterfaceIntf::ntpServers(
         config.map.getValueStrings("Network", "NTP"));
@@ -194,15 +178,6 @@
     }
 }
 
-void EthernetInterface::createIPAddressObjects()
-{
-    addrs.clear();
-    for (const auto& addr : system::getAddresses({.ifidx = ifIdx}))
-    {
-        manager.addAddress(addr);
-    }
-}
-
 void EthernetInterface::addStaticNeigh(const NeighborInfo& info)
 {
     if (!info.mac || !info.addr)
@@ -225,15 +200,6 @@
     }
 }
 
-void EthernetInterface::createStaticNeighborObjects()
-{
-    staticNeighbors.clear();
-    for (const auto& neighbor : system::getNeighbors({.ifidx = ifIdx}))
-    {
-        manager.addNeighbor(neighbor);
-    }
-}
-
 ObjectPath EthernetInterface::ip(IP::Protocol protType, std::string ipaddress,
                                  uint8_t prefixLength, std::string)
 {
@@ -281,7 +247,7 @@
                                     ifaddr, IP::AddressOrigin::Static));
 
     writeConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return it->second->getObjPath();
 }
@@ -324,7 +290,7 @@
                                    lladdr, Neighbor::State::Permanent));
 
     writeConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return it->second->getObjPath();
 }
@@ -334,7 +300,7 @@
     if (ipv6AcceptRA() != EthernetInterfaceIntf::ipv6AcceptRA(value))
     {
         writeConfigurationFile();
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
     return value;
 }
@@ -344,7 +310,7 @@
     if (dhcp4() != EthernetInterfaceIntf::dhcp4(value))
     {
         writeConfigurationFile();
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
     return value;
 }
@@ -354,7 +320,7 @@
     if (dhcp6() != EthernetInterfaceIntf::dhcp6(value))
     {
         writeConfigurationFile();
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
     return value;
 }
@@ -376,7 +342,7 @@
     if (old4 != new4 || old6 != new6 || oldra != newra)
     {
         writeConfigurationFile();
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
     return value;
 }
@@ -394,27 +360,6 @@
     return ipv6AcceptRA() ? DHCPConf::v6stateless : DHCPConf::none;
 }
 
-bool EthernetInterface::linkUp() const
-{
-    if (ifIdx == 0)
-    {
-        return EthernetInterfaceIntf::linkUp();
-    }
-    return system::intfIsRunning(interfaceName());
-}
-
-size_t EthernetInterface::mtu() const
-{
-    if (ifIdx == 0)
-    {
-        return EthernetInterfaceIntf::mtu();
-    }
-    const auto ifname = interfaceName();
-    return ignoreError("GetMTU", ifname, std::nullopt,
-                       [&] { return system::getMTU(ifname); })
-        .value_or(EthernetInterfaceIntf::mtu());
-}
-
 size_t EthernetInterface::mtu(size_t value)
 {
     const size_t old = EthernetInterfaceIntf::mtu();
@@ -445,7 +390,7 @@
         manager.addReloadPreHook(
             [ifname = interfaceName()]() { system::setNICUp(ifname, false); });
     }
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return value;
 }
@@ -472,7 +417,7 @@
         EthernetInterfaceIntf::staticNameServers(value);
 
         writeConfigurationFile();
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
     catch (const InternalFailure& e)
     {
@@ -613,7 +558,7 @@
     config.writeFile(config::pathForIntfDev(manager.getConfDir(), intfName));
 
     writeConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return ret;
 }
@@ -625,7 +570,7 @@
         EthernetInterfaceIntf::staticNTPServers(value);
 
         writeConfigurationFile();
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
     catch (InternalFailure& e)
     {
@@ -742,18 +687,15 @@
     {
         auto& dhcp = config.map["DHCP"].emplace_back();
         dhcp["ClientIdentifier"].emplace_back("mac");
-        if (manager.getDHCPConf())
-        {
-            const auto& conf = *manager.getDHCPConf();
-            auto dns_enabled = conf.dnsEnabled() ? "true" : "false";
-            dhcp["UseDNS"].emplace_back(dns_enabled);
-            dhcp["UseDomains"].emplace_back(dns_enabled);
-            dhcp["UseNTP"].emplace_back(conf.ntpEnabled() ? "true" : "false");
-            dhcp["UseHostname"].emplace_back(conf.hostNameEnabled() ? "true"
-                                                                    : "false");
-            dhcp["SendHostname"].emplace_back(
-                conf.sendHostNameEnabled() ? "true" : "false");
-        }
+        const auto& conf = manager.getDHCPConf();
+        auto dns_enabled = conf.dnsEnabled() ? "true" : "false";
+        dhcp["UseDNS"].emplace_back(dns_enabled);
+        dhcp["UseDomains"].emplace_back(dns_enabled);
+        dhcp["UseNTP"].emplace_back(conf.ntpEnabled() ? "true" : "false");
+        dhcp["UseHostname"].emplace_back(conf.hostNameEnabled() ? "true"
+                                                                : "false");
+        dhcp["SendHostname"].emplace_back(conf.sendHostNameEnabled() ? "true"
+                                                                     : "false");
     }
     auto path = config::pathForIntfConf(manager.getConfDir(), interfaceName());
     config.writeFile(path);
@@ -811,7 +753,7 @@
             // The MAC and LLADDRs will only update if the NIC is already down
             system::setNICUp(interface, false);
         });
-        manager.reloadConfigsNoRefresh();
+        manager.reloadConfigs();
     }
 
 #ifdef HAVE_UBOOT_ENV
@@ -839,7 +781,7 @@
     addrs.clear();
 
     writeConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 }
 
 std::string EthernetInterface::defaultGateway(std::string gateway)
@@ -866,7 +808,7 @@
     EthernetInterfaceIntf::defaultGateway(gateway);
 
     writeConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return gateway;
 }
@@ -895,7 +837,7 @@
     EthernetInterfaceIntf::defaultGateway6(gateway);
 
     writeConfigurationFile();
-    manager.reloadConfigsNoRefresh();
+    manager.reloadConfigs();
 
     return gateway;
 }
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index a2fb409..f29efa2 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -124,16 +124,6 @@
      */
     ObjectPath neighbor(std::string ipAddress, std::string macAddress) override;
 
-    /* @brief creates the dbus object(IPaddres) given in the address list.
-     * @param[in] addrs - address list for which dbus objects needs
-     *                    to create.
-     */
-    void createIPAddressObjects();
-
-    /* @brief creates the dbus object(Neighbor) given in the neighbor list.
-     */
-    void createStaticNeighborObjects();
-
     /** Set value of DHCPEnabled */
     DHCPConf dhcpEnabled() const override;
     DHCPConf dhcpEnabled(DHCPConf value) override;
@@ -155,12 +145,6 @@
         return std::visit([&](auto v) { return dhcpIsEnabled(v); }, addr);
     }
 
-    /** Retrieve Link State */
-    bool linkUp() const override;
-
-    /** Retrieve MTU Size */
-    size_t mtu() const override;
-
     /** Set size of MTU */
     size_t mtu(size_t value) override;
 
diff --git a/src/ipaddress.cpp b/src/ipaddress.cpp
index b3ca3db..560129d 100644
--- a/src/ipaddress.cpp
+++ b/src/ipaddress.cpp
@@ -111,7 +111,7 @@
     }
 
     parent.writeConfigurationFile();
-    parent.manager.reloadConfigsNoRefresh();
+    parent.manager.reloadConfigs();
 }
 
 } // namespace network
diff --git a/src/neighbor.cpp b/src/neighbor.cpp
index 58334b2..0f5140e 100644
--- a/src/neighbor.cpp
+++ b/src/neighbor.cpp
@@ -57,7 +57,7 @@
     }
 
     parent.writeConfigurationFile();
-    parent.manager.reloadConfigsNoRefresh();
+    parent.manager.reloadConfigs();
 }
 
 using sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed;
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 2634e11..99bedaa 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -33,7 +33,6 @@
 namespace network
 {
 
-extern std::unique_ptr<Timer> refreshObjectTimer;
 extern std::unique_ptr<Timer> reloadTimer;
 using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
@@ -46,10 +45,9 @@
     "PropertiesChanged',arg0='org.freedesktop.network1.Link',";
 
 Manager::Manager(sdbusplus::bus_t& bus, const char* objPath,
-                 const fs::path& confDir) :
-    details::VLANCreateIface(bus, objPath,
-                             details::VLANCreateIface::action::defer_emit),
-    bus(bus), objectPath(objPath),
+                 const std::filesystem::path& confDir) :
+    ManagerIface(bus, objPath, ManagerIface::action::defer_emit),
+    bus(bus), objPath(std::string(objPath)), confDir(confDir),
     systemdNetworkdEnabledMatch(
         bus, enabledMatch, [&](sdbusplus::message_t& m) {
             std::string intf;
@@ -82,7 +80,6 @@
             }
         })
 {
-    setConfDir(confDir);
     std::vector<
         std::tuple<int32_t, std::string, sdbusplus::message::object_path>>
         links;
@@ -112,25 +109,29 @@
         rsp.read(val);
         handleAdminState(std::get<std::string>(val), ifidx);
     }
-}
 
-void Manager::setConfDir(const fs::path& dir)
-{
-    confDir = dir;
-
-    if (!fs::exists(confDir))
-    {
-        if (!fs::create_directories(confDir))
-        {
-            log<level::ERR>("Unable to create the network conf dir",
-                            entry("DIR=%s", confDir.c_str()));
-            elog<InternalFailure>();
-        }
-    }
+    std::filesystem::create_directories(confDir);
+    systemConf = std::make_unique<phosphor::network::SystemConfiguration>(
+        bus, (this->objPath / "config").str);
+    dhcpConf = std::make_unique<phosphor::network::dhcp::Configuration>(
+        bus, (this->objPath / "dhcp").str, *this);
 }
 
 void Manager::createInterface(const UndiscoveredInfo& info, bool enabled)
 {
+    if (auto it = interfacesByIdx.find(info.intf.idx);
+        it != interfacesByIdx.end())
+    {
+        it->second->updateInfo(info.intf);
+        if (info.intf.name && *info.intf.name != it->second->interfaceName())
+        {
+            fmt::print(stderr, "Interface name change detected {} -> {}\n",
+                       it->second->interfaceName(), *info.intf.name);
+            fflush(stderr);
+            std::abort();
+        }
+        return;
+    }
     if (!info.intf.name)
     {
         auto msg = fmt::format("Can't create interface without name: {}",
@@ -138,12 +139,25 @@
         log<level::ERR>(msg.c_str(), entry("IFIDX=%u", info.intf.idx));
         return;
     }
-    removeInterface(info.intf);
     config::Parser config(config::pathForIntfConf(confDir, *info.intf.name));
     auto intf = std::make_unique<EthernetInterface>(
-        bus, *this, info.intf, objectPath, config, true, enabled);
-    intf->createIPAddressObjects();
-    intf->createStaticNeighborObjects();
+        bus, *this, info.intf, objPath.str, config, true, enabled);
+    if (info.defgw4)
+    {
+        intf->EthernetInterface::defaultGateway(std::to_string(*info.defgw4));
+    }
+    if (info.defgw6)
+    {
+        intf->EthernetInterface::defaultGateway6(std::to_string(*info.defgw6));
+    }
+    for (const auto& [_, addr] : info.addrs)
+    {
+        intf->addAddr(addr);
+    }
+    for (const auto& [_, neigh] : info.staticNeighs)
+    {
+        intf->addStaticNeigh(neigh);
+    }
     intf->loadNameServers(config);
     intf->loadNTPServers(config);
     auto ptr = intf.get();
@@ -407,39 +421,6 @@
     }
 }
 
-void Manager::createInterfaces()
-{
-    // clear all the interfaces first
-    interfaces.clear();
-    interfacesByIdx.clear();
-    for (auto& info : system::getInterfaces())
-    {
-        addInterface(info);
-    }
-}
-
-void Manager::createChildObjects()
-{
-    routeTable.refresh();
-
-    // creates the ethernet interface dbus object.
-    createInterfaces();
-
-    systemConf.reset(nullptr);
-    dhcpConf.reset(nullptr);
-
-    fs::path objPath = objectPath;
-    objPath /= "config";
-
-    // create the system conf object.
-    systemConf = std::make_unique<phosphor::network::SystemConfiguration>(
-        bus, objPath.string());
-    // create the dhcp conf object.
-    objPath /= "dhcp";
-    dhcpConf = std::make_unique<phosphor::network::dhcp::Configuration>(
-        bus, objPath.string(), *this);
-}
-
 ObjectPath Manager::vlan(std::string interfaceName, uint32_t id)
 {
     if (id == 0 || id >= 4095)
@@ -462,14 +443,12 @@
 
 void Manager::reset()
 {
-    if (fs::is_directory(confDir))
+    for (const auto& dirent : std::filesystem::directory_iterator(confDir))
     {
-        for (const auto& file : fs::directory_iterator(confDir))
-        {
-            fs::remove(file.path());
-        }
+        std::error_code ec;
+        std::filesystem::remove(dirent.path(), ec);
     }
-    log<level::INFO>("Network Factory Reset queued.");
+    log<level::INFO>("Network data purged.");
 }
 
 // Need to merge the below function with the code which writes the
@@ -517,16 +496,9 @@
 
 #endif
 
-void Manager::reloadConfigsNoRefresh()
-{
-    reloadTimer->restartOnce(reloadTimeout);
-}
-
 void Manager::reloadConfigs()
 {
-    reloadConfigsNoRefresh();
-    // Ensure that the next refresh happens after reconfiguration
-    refreshObjectTimer->setRemaining(reloadTimeout + refreshTimeout);
+    reloadTimer->restartOnce(reloadTimeout);
 }
 
 void Manager::doReloadConfigs()
@@ -556,11 +528,6 @@
                         entry("ERR=%s", ex.what()));
         elog<InternalFailure>();
     }
-    // Ensure reconfiguration has enough time
-    if (refreshObjectTimer->isEnabled())
-    {
-        refreshObjectTimer->setRemaining(refreshTimeout);
-    }
 }
 
 void Manager::handleAdminState(std::string_view state, unsigned ifidx)
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index 74e4fb1..3f7a050 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -11,6 +11,7 @@
 #include <memory>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/bus/match.hpp>
+#include <sdbusplus/message/native_types.hpp>
 #include <string>
 #include <string_view>
 #include <vector>
@@ -21,26 +22,14 @@
 namespace network
 {
 
-using SystemConfPtr = std::unique_ptr<SystemConfiguration>;
-using DHCPConfPtr = std::unique_ptr<dhcp::Configuration>;
-
-namespace fs = std::filesystem;
-namespace details
-{
-
-template <typename T, typename U>
-using ServerObject = typename sdbusplus::server::object_t<T, U>;
-
-using VLANCreateIface = details::ServerObject<
+using ManagerIface = sdbusplus::server::object_t<
     sdbusplus::xyz::openbmc_project::Network::VLAN::server::Create,
     sdbusplus::xyz::openbmc_project::Common::server::FactoryReset>;
 
-} // namespace details
-
 /** @class Manager
  *  @brief OpenBMC network manager implementation.
  */
-class Manager : public details::VLANCreateIface
+class Manager : public ManagerIface
 {
   public:
     Manager(const Manager&) = delete;
@@ -55,7 +44,7 @@
      *  @param[in] confDir - Network Configuration directory path.
      */
     Manager(sdbusplus::bus_t& bus, const char* objPath,
-            const fs::path& confDir);
+            const std::filesystem::path& confDir);
 
     ObjectPath vlan(std::string interfaceName, uint32_t id) override;
 
@@ -79,24 +68,9 @@
     void addDefGw(unsigned ifidx, InAddrAny addr);
     void removeDefGw(unsigned ifidx, InAddrAny addr);
 
-    /** @brief Fetch the interface and the ipaddress details
-     *         from the system and create the ethernet interraces
-     *         dbus object.
-     */
-    virtual void createInterfaces();
-
-    /** @brief create child interface object and the system conf object.
-     */
-    void createChildObjects();
-
-    /** @brief sets the network conf directory.
-     *  @param[in] dirName - Absolute path of the directory.
-     */
-    void setConfDir(const fs::path& dir);
-
     /** @brief gets the network conf directory.
      */
-    inline const fs::path& getConfDir() const
+    inline const auto& getConfDir() const
     {
         return confDir;
     }
@@ -104,17 +78,17 @@
     /** @brief gets the system conf object.
      *
      */
-    inline const SystemConfPtr& getSystemConf()
+    inline auto& getSystemConf()
     {
-        return systemConf;
+        return *systemConf;
     }
 
     /** @brief gets the dhcp conf object.
      *
      */
-    inline const DHCPConfPtr& getDHCPConf()
+    inline auto& getDHCPConf()
     {
-        return dhcpConf;
+        return *dhcpConf;
     }
 
     /** @brief This function gets the MAC address from the VPD and
@@ -134,7 +108,6 @@
     /** @brief Arms a timer to tell systemd-network to reload all of the network
      * configurations
      */
-    virtual void reloadConfigsNoRefresh();
     virtual void reloadConfigs();
 
     /** @brief Tell systemd-network to reload all of the network configurations
@@ -146,15 +119,6 @@
     string_umap<std::unique_ptr<EthernetInterface>> interfaces;
     std::unordered_map<unsigned, EthernetInterface*> interfacesByIdx;
 
-    /** @brief Get the routing table owned by the manager
-     *
-     * @return Routing table reference.
-     */
-    inline const auto& getRouteTable() const
-    {
-        return routeTable;
-    }
-
     /** @brief Adds a hook that runs immediately prior to reloading
      *
      *  @param[in] hook - The hook to execute before reloading
@@ -172,19 +136,16 @@
     void reset() override;
 
     /** @brief Path of Object. */
-    std::string objectPath;
+    sdbusplus::message::object_path objPath;
 
     /** @brief pointer to system conf object. */
-    SystemConfPtr systemConf = nullptr;
+    std::unique_ptr<SystemConfiguration> systemConf = nullptr;
 
     /** @brief pointer to dhcp conf object. */
-    DHCPConfPtr dhcpConf = nullptr;
+    std::unique_ptr<dhcp::Configuration> dhcpConf = nullptr;
 
     /** @brief Network Configuration directory. */
-    fs::path confDir;
-
-    /** @brief The routing table */
-    route::Table routeTable;
+    std::filesystem::path confDir;
 
     /** @brief Map of interface info for undiscovered interfaces */
     struct UndiscoveredInfo
diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp
index ffd97df..15bc59f 100644
--- a/src/network_manager_main.cpp
+++ b/src/network_manager_main.cpp
@@ -52,7 +52,6 @@
 {
 
 std::unique_ptr<Manager> manager = nullptr;
-std::unique_ptr<Timer> refreshObjectTimer = nullptr;
 std::unique_ptr<Timer> reloadTimer = nullptr;
 
 #ifdef SYNC_MAC_FROM_INVENTORY
@@ -239,17 +238,6 @@
 
 #endif
 
-/** @brief refresh the network objects. */
-void refreshObjects()
-{
-    if (manager)
-    {
-        log<level::INFO>("Refreshing the objects.");
-        manager->createChildObjects();
-        log<level::INFO>("Refreshing complete.");
-    }
-}
-
 void reloadNetworkd()
 {
     if (manager)
@@ -262,8 +250,6 @@
 
 void initializeTimers(sdeventplus::Event& event)
 {
-    refreshObjectTimer =
-        std::make_unique<Timer>(event, std::bind(refreshObjects));
     reloadTimer = std::make_unique<Timer>(event, std::bind(reloadNetworkd));
 }
 
@@ -301,11 +287,6 @@
     watchEthernetInterface(bus, configJson);
 #endif
 
-    // Trigger the initial object scan
-    // This is intentionally deferred, to ensure that systemd-networkd is
-    // fully configured.
-    refreshObjectTimer->restartOnce(refreshTimeout);
-
     return event.loop();
 }
 
diff --git a/src/rtnetlink_server.cpp b/src/rtnetlink_server.cpp
index ffa123e..a4266b7 100644
--- a/src/rtnetlink_server.cpp
+++ b/src/rtnetlink_server.cpp
@@ -7,20 +7,11 @@
 #include <linux/netlink.h>
 #include <linux/rtnetlink.h>
 
-#include <memory>
 #include <phosphor-logging/log.hpp>
 #include <stdplus/fd/create.hpp>
 #include <stdplus/fd/ops.hpp>
-#include <string_view>
 
-namespace phosphor
-{
-namespace network
-{
-
-extern std::unique_ptr<Timer> refreshObjectTimer;
-
-namespace netlink
+namespace phosphor::network::netlink
 {
 
 using phosphor::logging::entry;
@@ -122,6 +113,4 @@
     performRequest(NETLINK_ROUTE, RTM_GETNEIGH, NLM_F_DUMP, ndmsg{}, cb);
 }
 
-} // namespace netlink
-} // namespace network
-} // namespace phosphor
+} // namespace phosphor::network::netlink
diff --git a/src/system_queries.cpp b/src/system_queries.cpp
index 894fc09..9a360bd 100644
--- a/src/system_queries.cpp
+++ b/src/system_queries.cpp
@@ -1,8 +1,5 @@
 #include "system_queries.hpp"
 
-#include "netlink.hpp"
-#include "rtnetlink.hpp"
-
 #include <fmt/format.h>
 #include <linux/ethtool.h>
 #include <linux/sockios.h>
@@ -13,10 +10,8 @@
 #include <phosphor-logging/log.hpp>
 #include <stdexcept>
 #include <stdplus/fd/create.hpp>
-#include <stdplus/raw.hpp>
 #include <stdplus/util/cexec.hpp>
 #include <string_view>
-#include <system_error>
 
 namespace phosphor::network::system
 {
@@ -99,17 +94,6 @@
         .value_or(EthInfo{});
 }
 
-bool intfIsRunning(std::string_view ifname)
-{
-    return executeIFReq(ifname, SIOCGIFFLAGS).ifr_flags & IFF_RUNNING;
-}
-
-std::optional<unsigned> getMTU(stdplus::zstring_view ifname)
-{
-    return optionalIFReq(ifname, SIOCGIFMTU, "GMTU",
-                         [](const ifreq& ifr) { return ifr.ifr_mtu; });
-}
-
 void setMTU(std::string_view ifname, unsigned mtu)
 {
     auto ifr = makeIFReq(ifname);
@@ -125,93 +109,4 @@
     getIFSock().ioctl(SIOCSIFFLAGS, &ifr);
 }
 
-bool detail::validateNewAddr(const AddressInfo& info,
-                             const AddressFilter& filter) noexcept
-{
-    if (filter.ifidx != 0 && filter.ifidx != info.ifidx)
-    {
-        return false;
-    }
-    return true;
-}
-
-bool detail::validateNewNeigh(const NeighborInfo& info,
-                              const NeighborFilter& filter) noexcept
-{
-    if (filter.ifidx != 0 && filter.ifidx != info.ifidx)
-    {
-        return false;
-    }
-    return true;
-}
-
-std::vector<InterfaceInfo> getInterfaces()
-{
-    std::vector<InterfaceInfo> ret;
-    auto cb = [&](const nlmsghdr&, std::string_view msg) {
-        try
-        {
-            ret.emplace_back(netlink::intfFromRtm(msg));
-        }
-        catch (const std::exception& e)
-        {
-            auto msg = fmt::format("Failed parsing interface: {}", e.what());
-            log<level::ERR>(msg.c_str());
-        }
-    };
-    ifinfomsg msg{};
-    netlink::performRequest(NETLINK_ROUTE, RTM_GETLINK, NLM_F_DUMP, msg, cb);
-    return ret;
-}
-
-std::vector<AddressInfo> getAddresses(const AddressFilter& filter)
-{
-    std::vector<AddressInfo> ret;
-    auto cb = [&](const nlmsghdr&, std::string_view msg) {
-        try
-        {
-            auto info = netlink::addrFromRtm(msg);
-            if (detail::validateNewAddr(info, filter))
-            {
-                ret.emplace_back(std::move(info));
-            }
-        }
-        catch (const std::exception& e)
-        {
-            auto msg = fmt::format("Failed parsing address for ifidx {}: {}",
-                                   filter.ifidx, e.what());
-            log<level::ERR>(msg.c_str());
-        }
-    };
-    ifaddrmsg msg{};
-    msg.ifa_index = filter.ifidx;
-    netlink::performRequest(NETLINK_ROUTE, RTM_GETADDR, NLM_F_DUMP, msg, cb);
-    return ret;
-}
-
-std::vector<NeighborInfo> getNeighbors(const NeighborFilter& filter)
-{
-    std::vector<NeighborInfo> ret;
-    auto cb = [&](const nlmsghdr&, std::string_view msg) {
-        try
-        {
-            auto info = netlink::neighFromRtm(msg);
-            if (detail::validateNewNeigh(info, filter))
-            {
-                ret.push_back(std::move(info));
-            }
-        }
-        catch (const std::exception& e)
-        {
-            auto msg = fmt::format("Failed parsing neighbor for ifidx {}: {}",
-                                   filter.ifidx, e.what());
-            log<level::ERR>(msg.c_str());
-        }
-    };
-    ndmsg msg{};
-    msg.ndm_ifindex = filter.ifidx;
-    netlink::performRequest(NETLINK_ROUTE, RTM_GETNEIGH, NLM_F_DUMP, msg, cb);
-    return ret;
-}
-
 } // namespace phosphor::network::system
diff --git a/src/system_queries.hpp b/src/system_queries.hpp
index 7785c39..4c187c7 100644
--- a/src/system_queries.hpp
+++ b/src/system_queries.hpp
@@ -1,17 +1,9 @@
 #pragma once
 #include "types.hpp"
 
-#include <net/ethernet.h>
-
 #include <cstdint>
-#include <optional>
-#include <stdplus/zstring.hpp>
 #include <stdplus/zstring_view.hpp>
-#include <string>
 #include <string_view>
-#include <vector>
-
-struct nlmsghdr;
 
 namespace phosphor::network::system
 {
@@ -22,44 +14,8 @@
 };
 EthInfo getEthInfo(stdplus::zstring_view ifname);
 
-bool intfIsRunning(std::string_view ifname);
-
-std::optional<unsigned> getMTU(stdplus::zstring_view ifname);
-
 void setMTU(std::string_view ifname, unsigned mtu);
 
 void setNICUp(std::string_view ifname, bool up);
 
-struct AddressFilter
-{
-    unsigned ifidx = 0;
-};
-
-struct NeighborFilter
-{
-    unsigned ifidx = 0;
-};
-
-namespace detail
-{
-bool validateNewAddr(const AddressInfo& info,
-                     const AddressFilter& filter) noexcept;
-bool validateNewNeigh(const NeighborInfo& info,
-                      const NeighborFilter& filter) noexcept;
-} // namespace detail
-
-/** @brief Get all the interfaces from the system.
- *  @returns list of interface names.
- */
-std::vector<InterfaceInfo> getInterfaces();
-
-/** @brief Get all the addreses from the system.
- *  @returns list of addresses
- */
-std::vector<AddressInfo> getAddresses(const AddressFilter& filter);
-
-/** @brief Returns a list of system neighbor table
- */
-std::vector<NeighborInfo> getNeighbors(const NeighborFilter& filter);
-
 } // namespace phosphor::network::system
diff --git a/src/types.hpp b/src/types.hpp
index 709874c..badc977 100644
--- a/src/types.hpp
+++ b/src/types.hpp
@@ -42,10 +42,6 @@
 // wait for three seconds before reloading systemd-networkd
 constexpr auto reloadTimeout = 3s;
 
-// refresh the objets after four seconds as network
-// configuration takes 3-4 sec to reconfigure at most.
-constexpr auto refreshTimeout = 4s;
-
 // Byte representations for common address types in network byte order
 using InAddrAny = std::variant<in_addr, in6_addr>;
 class IfAddr
