diff --git a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
index a8541a6..ad67681 100644
--- a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
+++ b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/DhcpRelayManager.java
@@ -26,10 +26,12 @@
 import org.onlab.packet.IPv4;
 import org.onlab.packet.IPv6;
 import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.UDP;
 import org.onlab.packet.VlanId;
+import org.onlab.packet.ndp.NeighborSolicitation;
 import org.onlab.util.Tools;
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.core.ApplicationId;
@@ -40,8 +42,10 @@
 import org.onosproject.dhcprelay.config.DefaultDhcpRelayConfig;
 import org.onosproject.dhcprelay.config.DhcpServerConfig;
 import org.onosproject.dhcprelay.config.EnableDhcpFpmConfig;
+import org.onosproject.dhcprelay.config.HostAutoRelearnConfig;
 import org.onosproject.dhcprelay.config.IgnoreDhcpConfig;
 import org.onosproject.dhcprelay.config.IndirectDhcpRelayConfig;
+import org.onosproject.mastership.MastershipService;
 import org.onosproject.dhcprelay.store.DhcpFpmPrefixStore;
 import org.onosproject.dhcprelay.store.DhcpRecord;
 import org.onosproject.dhcprelay.store.DhcpRelayStore;
@@ -49,6 +53,7 @@
 import org.onosproject.net.Device;
 import org.onosproject.net.Host;
 import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
 import org.onosproject.net.config.Config;
 import org.onosproject.net.config.ConfigFactory;
 import org.onosproject.net.config.NetworkConfigEvent;
@@ -62,6 +67,7 @@
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.host.HostService;
+import org.onosproject.net.Port;
 import org.onosproject.net.intf.Interface;
 import org.onosproject.net.intf.InterfaceService;
 import org.onosproject.net.packet.DefaultOutboundPacket;
@@ -93,6 +99,7 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -103,6 +110,10 @@
 import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_FPM_ENABLED_DEFAULT;
 import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_POLL_INTERVAL;
 import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_POLL_INTERVAL_DEFAULT;
+import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_PROBE_INTERVAL;
+import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_PROBE_INTERVAL_DEFAULT;
+import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_PROBE_COUNT;
+import static org.onosproject.dhcprelay.OsgiPropertyConstants.DHCP_PROBE_COUNT_DEFAULT;
 import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
 import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
 
@@ -115,7 +126,9 @@
     property = {
         ARP_ENABLED + ":Boolean=" + ARP_ENABLED_DEFAULT,
         DHCP_POLL_INTERVAL + ":Integer=" + DHCP_POLL_INTERVAL_DEFAULT,
-        DHCP_FPM_ENABLED + ":Boolean=" + DHCP_FPM_ENABLED_DEFAULT
+        DHCP_FPM_ENABLED + ":Boolean=" + DHCP_FPM_ENABLED_DEFAULT,
+        DHCP_PROBE_INTERVAL + ":Integer=" + DHCP_PROBE_INTERVAL_DEFAULT,
+        DHCP_PROBE_COUNT + ":Integer=" + DHCP_PROBE_COUNT_DEFAULT
     }
 )
 public class DhcpRelayManager implements DhcpRelayService {
@@ -129,6 +142,7 @@
             .build();
     private final Logger log = LoggerFactory.getLogger(getClass());
     private final InternalConfigListener cfgListener = new InternalConfigListener();
+    protected CopyOnWriteArraySet hostAutoRelearnEnabledDevices = new CopyOnWriteArraySet();
 
     private final Set<ConfigFactory> factories = ImmutableSet.of(
             new ConfigFactory<ApplicationId, DefaultDhcpRelayConfig>(APP_SUBJECT_FACTORY,
@@ -166,6 +180,15 @@
                 public EnableDhcpFpmConfig createConfig() {
                     return new EnableDhcpFpmConfig();
                 }
+            },
+            new ConfigFactory<ApplicationId, HostAutoRelearnConfig>(APP_SUBJECT_FACTORY,
+                    HostAutoRelearnConfig.class,
+                    HostAutoRelearnConfig.KEY,
+                    true) {
+                @Override
+                public HostAutoRelearnConfig createConfig() {
+                    return new HostAutoRelearnConfig();
+                }
             }
     );
 
@@ -174,6 +197,9 @@
     protected NetworkConfigRegistry cfgService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected MastershipService mastershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
     protected CoreService coreService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY)
@@ -214,13 +240,22 @@
     /** Enable DhcpRelay Fpm. */
     protected boolean dhcpFpmEnabled = DHCP_FPM_ENABLED_DEFAULT;
 
+    /** Dhcp host relearn probe interval in millis. */
+    protected int dhcpHostRelearnProbeInterval = DHCP_PROBE_INTERVAL_DEFAULT;
+
+    /** Dhcp host relearn probe count. */
+    protected int dhcpHostRelearnProbeCount = DHCP_PROBE_COUNT_DEFAULT;
+
     private ScheduledExecutorService timerExecutor;
+    private ScheduledExecutorService executorService = null;
     protected ExecutorService devEventExecutor;
     private ExecutorService packetExecutor;
 
     protected DeviceListener deviceListener = new InternalDeviceListener();
     private DhcpRelayPacketProcessor dhcpRelayPacketProcessor = new DhcpRelayPacketProcessor();
     private ApplicationId appId;
+    private static final int POOL_SIZE = 10;
+    private static final int HOST_PROBE_INIT_DELAY = 500;
 
     /**
      *   One second timer.
@@ -261,6 +296,8 @@
                                "distributed", Boolean.TRUE.toString());
         compCfgService.registerProperties(getClass());
 
+        executorService = Executors.newScheduledThreadPool(POOL_SIZE);
+
         deviceService.addListener(deviceListener);
 
         log.info("DHCP-RELAY Started");
@@ -280,6 +317,7 @@
         packetExecutor.shutdown();
         timerExecutor = null;
         packetExecutor = null;
+        executorService.shutdown();
 
         log.info("DHCP-RELAY Stopped");
     }
@@ -352,6 +390,8 @@
                 cfgService.getConfig(appId, IndirectDhcpRelayConfig.class);
         IgnoreDhcpConfig ignoreDhcpConfig =
                 cfgService.getConfig(appId, IgnoreDhcpConfig.class);
+        HostAutoRelearnConfig hostAutoRelearnConfig =
+                cfgService.getConfig(appId, HostAutoRelearnConfig.class);
 
         if (defaultConfig != null) {
             updateConfig(defaultConfig);
@@ -362,6 +402,9 @@
         if (ignoreDhcpConfig != null) {
             updateConfig(ignoreDhcpConfig);
         }
+        if (hostAutoRelearnConfig != null) {
+            updateConfig(hostAutoRelearnConfig);
+        }
     }
 
     /**
@@ -383,6 +426,9 @@
             v4Handler.updateIgnoreVlanConfig((IgnoreDhcpConfig) config);
             v6Handler.updateIgnoreVlanConfig((IgnoreDhcpConfig) config);
         }
+        if (config instanceof HostAutoRelearnConfig) {
+            setHostAutoRelearnConfig((HostAutoRelearnConfig) config);
+        }
     }
 
     protected void removeConfig(Config config) {
@@ -624,7 +670,8 @@
         public boolean isRelevant(NetworkConfigEvent event) {
             if (event.configClass().equals(DefaultDhcpRelayConfig.class) ||
                     event.configClass().equals(IndirectDhcpRelayConfig.class) ||
-                    event.configClass().equals(IgnoreDhcpConfig.class)) {
+                    event.configClass().equals(IgnoreDhcpConfig.class) ||
+                    event.configClass().equals(HostAutoRelearnConfig.class)) {
                 return true;
             }
             log.debug("Ignore irrelevant event class {}", event.configClass().getName());
@@ -637,7 +684,7 @@
         @Override
         public void event(DeviceEvent event) {
           if (devEventExecutor != null) {
-            Device device = event.subject();
+            final Device device = event.subject();
             switch (event.type()) {
                 case DEVICE_ADDED:
                     devEventExecutor.execute(this::updateIgnoreVlanConfigs);
@@ -645,12 +692,44 @@
                 case DEVICE_AVAILABILITY_CHANGED:
                     devEventExecutor.execute(() -> deviceAvailabilityChanged(device));
                     break;
+                case PORT_UPDATED:
+                    Port port = event.port();
+                    devEventExecutor.execute(() -> portUpdatedEventHandler(device, port));
+                    break;
                 default:
                     break;
             }
           }
         }
 
+        private void portUpdatedEventHandler(Device device, Port port) {
+            if (!mastershipService.isLocalMaster(device.id())) {
+                log.warn("This instance is not the master for the device {}", device.id());
+                return;
+            }
+            if (hostAutoRelearnEnabledDevices.contains(device.id()) && port.isEnabled()) {
+                ConnectPoint cp = new ConnectPoint(device.id(), port.number());
+                HostLocation hostLocation = new HostLocation(cp, 0);
+                Set<DhcpRecord> records = dhcpRelayStore.getDhcpRecords()
+                                          .stream()
+                                          .filter(i -> i.directlyConnected())
+                                          .filter(i -> i.locations().contains(hostLocation))
+                                          .collect(Collectors.toSet());
+
+                for (DhcpRecord i : records) {
+                    //found a dhcprecord matching the connect point of the port event
+                    log.debug("portUpdatedEventHandler:DHCP record {}, sending msg on CP {} Mac {} Vlan{} DeviceId {}",
+                            i, cp, i.macAddress(), i.vlanId(), device.id());
+                    if (i.ip4Address().isPresent()) {
+                        log.warn("Sending host relearn probe for v4 not supported for Mac {} Vlan{} ip {}",
+                             i.macAddress(), i.vlanId(), i.ip4Address());
+                    } else if (i.ip6Address().isPresent()) {
+                        sendHostRelearnProbe(cp, i.macAddress(), i.vlanId(), i.ip6Address());
+                    }
+                 }
+            }
+        }
+
         private void deviceAvailabilityChanged(Device device) {
             if (deviceService.isAvailable(device.id())) {
                 updateIgnoreVlanConfigs();
@@ -672,6 +751,83 @@
         }
     }
 
+    private void setHostAutoRelearnConfig(HostAutoRelearnConfig config) {
+        hostAutoRelearnEnabledDevices.clear();
+        if (config == null) {
+            return;
+        }
+        hostAutoRelearnEnabledDevices.addAll(config.hostAutoRelearnEnabledDevices());
+    }
+
+    //  Packet transmission class.
+    private class PktTransmitter implements Runnable {
+
+        MacAddress mac;
+        VlanId vlanId;
+        Ip6Address ipv6Address;
+        ConnectPoint connectPoint;
+
+        PktTransmitter(MacAddress mac, VlanId vlanId, Ip6Address ipv6Address, ConnectPoint connectPoint) {
+            this.mac = mac;
+            this.vlanId = vlanId;
+            this.ipv6Address = ipv6Address;
+            this.connectPoint = connectPoint;
+        }
+
+        @Override
+        public void run() {
+            log.debug("Host Relearn probe packet transmission activated for Mac {} Vlan {} Ip {} ConnectPt {}",
+                                     mac, vlanId, ipv6Address, connectPoint);
+            if (mac == null || vlanId == null || ipv6Address == null || connectPoint == null) {
+                return;
+            }
+
+            Interface senderInterface = interfaceService.getInterfacesByPort(connectPoint)
+                    .stream().filter(iface -> Dhcp6HandlerUtil.interfaceContainsVlan(iface, vlanId))
+                    .findFirst().orElse(null);
+            if (senderInterface == null) {
+                log.warn("Cannot get sender interface for from packet, abort... vlan {}", vlanId.toString());
+            }
+            MacAddress senderMacAddress = senderInterface.mac();
+            byte[] senderIpAddress = IPv6.getLinkLocalAddress(senderMacAddress.toBytes());
+            byte[] destIp = IPv6.getSolicitNodeAddress(ipv6Address.toOctets());
+
+            Ethernet ethernet = NeighborSolicitation.buildNdpSolicit(
+                    this.ipv6Address,
+                    Ip6Address.valueOf(senderIpAddress),
+                    Ip6Address.valueOf(destIp), //destip
+                    senderMacAddress,
+                    this.mac,
+                    this.vlanId);
+            sendHostRelearnProbeToConnectPoint(ethernet, connectPoint);
+
+            log.debug("Host Relearn Probe transmission completed.");
+        }
+    }
+
+    //Create packet and schedule transmitter thread.
+    private void sendHostRelearnProbe(ConnectPoint connectPoint, MacAddress mac, VlanId vlanId,
+                                      Optional<Ip6Address> ipv6Address) {
+        PktTransmitter nsTransmitter = new PktTransmitter(mac, vlanId, ipv6Address.get(), connectPoint);
+        executorService.schedule(nsTransmitter, HOST_PROBE_INIT_DELAY, TimeUnit.MILLISECONDS);
+    }
+
+    // Send Host Relearn Probe packets to ConnectPoint
+    private void sendHostRelearnProbeToConnectPoint(Ethernet nsPacket, ConnectPoint connectPoint) {
+        TrafficTreatment treatment = DefaultTrafficTreatment.builder().setOutput(connectPoint.port()).build();
+        OutboundPacket outboundPacket = new DefaultOutboundPacket(connectPoint.deviceId(),
+                treatment, ByteBuffer.wrap(nsPacket.serialize()));
+        int counter = 0;
+        try {
+            while (counter < dhcpHostRelearnProbeCount) {
+              packetService.emit(outboundPacket);
+              counter++;
+              Thread.sleep(dhcpHostRelearnProbeInterval);
+            }
+        } catch (Exception e) {
+            log.error("Exception while emmiting packet {}", e.getMessage(), e);
+        }
+    }
 
 
     public Optional<FpmRecord> getFpmRecord(IpPrefix prefix) {
diff --git a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/OsgiPropertyConstants.java b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/OsgiPropertyConstants.java
index 7e794fe..207f766 100644
--- a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/OsgiPropertyConstants.java
+++ b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/OsgiPropertyConstants.java
@@ -29,6 +29,12 @@
     static final String DHCP_FPM_ENABLED = "dhcpFpmEnabled";
     static final boolean DHCP_FPM_ENABLED_DEFAULT = false;
 
+    static final String DHCP_PROBE_INTERVAL = "dhcpHostRelearnProbeInterval";
+    static final int DHCP_PROBE_INTERVAL_DEFAULT = 500;
+
+    static final String DHCP_PROBE_COUNT = "dhcpHostRelearnProbeCount";
+    static final int DHCP_PROBE_COUNT_DEFAULT = 3;
+
     static final String LEARN_ROUTE_FROM_LEASE_QUERY = "learnRouteFromLeasequery";
     static final boolean LEARN_ROUTE_FROM_LEASE_QUERY_DEFAULT = false;
 }
diff --git a/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/config/HostAutoRelearnConfig.java b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/config/HostAutoRelearnConfig.java
new file mode 100644
index 0000000..85b8c9a
--- /dev/null
+++ b/apps/dhcprelay/app/src/main/java/org/onosproject/dhcprelay/config/HostAutoRelearnConfig.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.dhcprelay.config;
+
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.Config;
+import java.util.Set;
+import com.fasterxml.jackson.databind.JsonNode;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Dhcp Host Auto Relearn Config.
+ */
+public class HostAutoRelearnConfig extends Config<ApplicationId> {
+    public static final String KEY = "hostAutoRelearnEnabledDevices";
+
+    @Override
+    public boolean isValid() {
+        if (array == null) {
+            return false;
+        }
+        try {
+            for (JsonNode node : array) {
+               DeviceId.deviceId(node.asText());
+            }
+        } catch (IllegalArgumentException ex) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Returns Set of Devices on which Host Auto Relearn is enabled.
+     *
+     * @return Set of DeviceId where Host Auto Relearn is enabled.
+     */
+
+    public Set<DeviceId> hostAutoRelearnEnabledDevices() {
+        Set<DeviceId> enabledDevices = Sets.newHashSet();
+
+        array.forEach(node -> {
+            DeviceId deviceId = DeviceId.deviceId(node.asText());
+            enabledDevices.add(deviceId);
+        });
+
+        return enabledDevices;
+    }
+}
