diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c
index 83f1283..f4c41bd 100644
--- a/src/vnet/gre/gre.c
+++ b/src/vnet/gre/gre.c
@@ -472,7 +472,8 @@
   ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
   t = pool_elt_at_index (gm->tunnels, ti);
 
-  ne = teib_entry_find (sw_if_index, &adj->sub_type.nbr.next_hop);
+  ne = teib_entry_find (sw_if_index,
+			adj->ia_nh_proto, &adj->sub_type.nbr.next_hop);
 
   if (NULL == ne)
     // no NHRP entry to provide the next-hop
diff --git a/src/vnet/ipip/ipip.c b/src/vnet/ipip/ipip.c
index 089e2b6..138f4d2 100644
--- a/src/vnet/ipip/ipip.c
+++ b/src/vnet/ipip/ipip.c
@@ -364,7 +364,8 @@
   ti = gm->tunnel_index_by_sw_if_index[sw_if_index];
   t = pool_elt_at_index (gm->tunnels, ti);
 
-  ne = teib_entry_find (sw_if_index, &adj->sub_type.nbr.next_hop);
+  ne = teib_entry_find (sw_if_index,
+			adj->ia_nh_proto, &adj->sub_type.nbr.next_hop);
 
   if (NULL == ne)
     {
diff --git a/src/vnet/ipsec/ipsec_tun.c b/src/vnet/ipsec/ipsec_tun.c
index fb530c8..ac8b24e 100644
--- a/src/vnet/ipsec/ipsec_tun.c
+++ b/src/vnet/ipsec/ipsec_tun.c
@@ -718,7 +718,9 @@
 	  ip_address_to_46 (nh, &peer);
 
 	  ipsec_tun_protect_update_from_teib
-	    (itp, teib_entry_find (sw_if_index, &peer));
+	    (itp, teib_entry_find (sw_if_index,
+				   ip_address_family_to_fib_proto
+				   (ip_addr_version (nh)), &peer));
 	}
 
       if (is_l2)
diff --git a/src/vnet/teib/teib.c b/src/vnet/teib/teib.c
index e392b49..0f33d08 100644
--- a/src/vnet/teib/teib.c
+++ b/src/vnet/teib/teib.c
@@ -19,12 +19,14 @@
 #include <vnet/teib/teib.h>
 #include <vnet/fib/fib_table.h>
 #include <vnet/adj/adj_midchain.h>
+#include <vnet/ip/ip6_ll_table.h>
 
 typedef struct teib_key_t_
 {
   ip46_address_t tk_peer;
   u32 tk_sw_if_index;
-} teib_key_t;
+  fib_protocol_t tk_proto;
+} __clib_packed teib_key_t;
 
 struct teib_entry_t_
 {
@@ -33,9 +35,10 @@
   u32 te_fib_index;
 };
 
-static uword *teib_db;
+static uword *teib_db[FIB_PROTOCOL_IP_MAX];
 static teib_entry_t *teib_pool;
 static teib_vft_t *teib_vfts;
+static vlib_log_class_t teib_logger;
 
 #define TEIB_NOTIFY(_te, _fn) {                  \
   teib_vft_t *_vft;                              \
@@ -46,12 +49,29 @@
   }                                              \
 }
 
+#define TEIB_DBG(...)                           \
+    vlib_log_debug (teib_logger, __VA_ARGS__);
+
+#define TEIB_INFO(...)                          \
+    vlib_log_notice (teib_logger, __VA_ARGS__);
+
+#define TEIB_TE_DBG(_te, _fmt, _args...)                      \
+  vlib_log_debug (teib_logger, "[%U]: " _fmt, format_teib_entry, _te - teib_pool, ##_args)
+#define TEIB_TE_INFO(_te, _fmt, _args...)                      \
+  vlib_log_notice (teib_logger, "[%U]: " _fmt, format_teib_entry, _te - teib_pool, ##_args)
+
 u32
 teib_entry_get_sw_if_index (const teib_entry_t * te)
 {
   return (te->te_key->tk_sw_if_index);
 }
 
+fib_protocol_t
+teib_entry_get_proto (const teib_entry_t * te)
+{
+  return (te->te_key->tk_proto);
+}
+
 u32
 teib_entry_get_fib_index (const teib_entry_t * te)
 {
@@ -83,15 +103,17 @@
 }
 
 teib_entry_t *
-teib_entry_find (u32 sw_if_index, const ip46_address_t * peer)
+teib_entry_find (u32 sw_if_index,
+		 fib_protocol_t fproto, const ip46_address_t * peer)
 {
   teib_key_t nk = {
     .tk_peer = *peer,
+    .tk_proto = fproto,
     .tk_sw_if_index = sw_if_index,
   };
   uword *p;
 
-  p = hash_get_mem (teib_db, &nk);
+  p = hash_get_mem (teib_db[fproto], &nk);
 
   if (NULL != p)
     return teib_entry_get (p[0]);
@@ -99,34 +121,104 @@
   return (NULL);
 }
 
+static void
+teib_adj_fib_add (fib_protocol_t fproto,
+		  const ip46_address_t * ip, u32 sw_if_index, u32 fib_index)
+{
+  if (FIB_PROTOCOL_IP6 == fproto &&
+      ip6_address_is_link_local_unicast (&ip->ip6))
+    {
+      ip6_ll_prefix_t pfx = {
+	.ilp_addr = ip->ip6,
+	.ilp_sw_if_index = sw_if_index,
+      };
+      ip6_ll_table_entry_update (&pfx, FIB_ROUTE_PATH_FLAG_NONE);
+    }
+  else
+    {
+      fib_prefix_t pfx = {
+	.fp_len = (FIB_PROTOCOL_IP4 == fproto ? 32 : 128),
+	.fp_proto = fproto,
+	.fp_addr = *ip,
+      };
+      fib_table_entry_path_add (fib_index, &pfx, FIB_SOURCE_ADJ,
+				FIB_ENTRY_FLAG_ATTACHED,
+				fib_proto_to_dpo (pfx.fp_proto),
+				&pfx.fp_addr,
+				sw_if_index,
+				~0, 1, NULL, FIB_ROUTE_PATH_FLAG_NONE);
+
+
+      if (1 == hash_elts (teib_db[pfx.fp_proto]))
+	fib_table_lock (fib_index, pfx.fp_proto, FIB_SOURCE_ADJ);
+    }
+}
+
+static void
+teib_adj_fib_remove (fib_protocol_t fproto,
+		     ip46_address_t * ip, u32 sw_if_index, u32 fib_index)
+{
+  if (FIB_PROTOCOL_IP6 == fproto &&
+      ip6_address_is_link_local_unicast (&ip->ip6))
+    {
+      ip6_ll_prefix_t pfx = {
+	.ilp_addr = ip->ip6,
+	.ilp_sw_if_index = sw_if_index,
+      };
+      ip6_ll_table_entry_delete (&pfx);
+    }
+  else
+    {
+      fib_prefix_t pfx = {
+	.fp_len = (FIB_PROTOCOL_IP4 == fproto ? 32 : 128),
+	.fp_proto = fproto,
+	.fp_addr = *ip,
+      };
+
+      fib_table_entry_path_remove (fib_index, &pfx, FIB_SOURCE_ADJ,
+				   fib_proto_to_dpo (pfx.fp_proto),
+				   &pfx.fp_addr,
+				   sw_if_index,
+				   ~0, 1, FIB_ROUTE_PATH_FLAG_NONE);
+
+      if (0 == hash_elts (teib_db[pfx.fp_proto]))
+	fib_table_unlock (fib_index, pfx.fp_proto, FIB_SOURCE_ADJ);
+    }
+}
+
 int
 teib_entry_add (u32 sw_if_index,
+		fib_protocol_t fproto,
 		const ip46_address_t * peer,
 		u32 nh_table_id, const ip46_address_t * nh)
 {
-  fib_protocol_t fproto;
+  fib_protocol_t nh_proto;
   teib_entry_t *te;
   u32 fib_index;
   index_t tei;
 
-  fproto = (ip46_address_is_ip4 (nh) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
+  nh_proto = (ip46_address_is_ip4 (nh) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6);
 
-  fib_index = fib_table_find (fproto, nh_table_id);
+  fib_index = fib_table_find (nh_proto, nh_table_id);
 
   if (~0 == fib_index)
     {
       return (VNET_API_ERROR_NO_SUCH_FIB);
     }
 
-  te = teib_entry_find (sw_if_index, peer);
+  te = teib_entry_find (sw_if_index, fproto, peer);
 
   if (NULL == te)
     {
       teib_key_t nk = {
 	.tk_peer = *peer,
+	.tk_proto = fproto,
 	.tk_sw_if_index = sw_if_index,
       };
       teib_entry_t *te;
+      u32 fib_index;
+
+      fib_index = fib_table_get_index_for_sw_if_index (fproto, sw_if_index);
 
       pool_get_zero (teib_pool, te);
 
@@ -139,26 +231,43 @@
       te->te_nh.fp_len = (te->te_nh.fp_proto == FIB_PROTOCOL_IP4 ? 32 : 128);
       te->te_fib_index = fib_index;
 
-      hash_set_mem (teib_db, te->te_key, tei);
+      hash_set_mem (teib_db[fproto], te->te_key, tei);
+
+      /* we how have a /32 in the overlay, add an adj-fib */
+      teib_adj_fib_add (te->te_key->tk_proto,
+			&te->te_key->tk_peer, sw_if_index, fib_index);
 
       TEIB_NOTIFY (te, nv_added);
+      TEIB_TE_INFO (te, "created");
     }
   else
-    return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
-
+    {
+      TEIB_TE_INFO (te, "exists");
+      return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
+    }
   return 0;
 }
 
 int
-teib_entry_del (u32 sw_if_index, const ip46_address_t * peer)
+teib_entry_del (u32 sw_if_index,
+		fib_protocol_t fproto, const ip46_address_t * peer)
 {
   teib_entry_t *te;
 
-  te = teib_entry_find (sw_if_index, peer);
+  te = teib_entry_find (sw_if_index, fproto, peer);
 
   if (te != NULL)
     {
-      hash_unset_mem (teib_db, te->te_key);
+      TEIB_TE_INFO (te, "removed");
+
+      u32 fib_index;
+
+      fib_index = fib_table_get_index_for_sw_if_index (fproto, sw_if_index);
+
+      teib_adj_fib_remove (te->te_key->tk_proto,
+			   &te->te_key->tk_peer, sw_if_index, fib_index);
+
+      hash_unset_mem (teib_db[fproto], te->te_key);
 
       TEIB_NOTIFY (te, nv_deleted);
 
@@ -166,8 +275,14 @@
       pool_put (teib_pool, te);
     }
   else
-    return (VNET_API_ERROR_ENTRY_ALREADY_EXISTS);
-
+    {
+      TEIB_INFO ("no such entry: %U, %U, %U",
+		 format_vnet_sw_if_index_name,
+		 vnet_get_main (), sw_if_index,
+		 format_fib_protocol, fproto,
+		 format_ip46_address, peer, IP46_TYPE_ANY);
+      return (VNET_API_ERROR_NO_SUCH_ENTRY);
+    }
   return 0;
 }
 
@@ -183,7 +298,8 @@
   s = format (s, "[%d] ", tei);
   s = format (s, "%U:", format_vnet_sw_if_index_name,
 	      vnm, te->te_key->tk_sw_if_index);
-  s = format (s, " %U", format_ip46_address,
+  s = format (s, " %U:", format_fib_protocol, te->te_key->tk_proto);
+  s = format (s, "%U", format_ip46_address,
 	      &te->te_key->tk_peer, IP46_TYPE_ANY);
   s = format (s, " via [%d]:%U",
 	      fib_table_get_table_id (te->te_fib_index, te->te_nh.fp_proto),
@@ -219,6 +335,76 @@
   /* *INDENT-ON* */
 }
 
+static void
+teib_walk_itf_proto (u32 sw_if_index,
+		     fib_protocol_t fproto, teib_walk_cb_t fn, void *ctx)
+{
+  index_t tei;
+
+  /* *INDENT-OFF* */
+  pool_foreach_index(tei, teib_pool,
+  ({
+    if (sw_if_index == teib_entry_get_sw_if_index(teib_entry_get(tei)) &&
+        fproto == teib_entry_get_proto(teib_entry_get(tei)))
+      fn(tei, ctx);
+  }));
+  /* *INDENT-ON* */
+}
+
+typedef struct teib_table_bind_ctx_t_
+{
+  u32 new_fib_index;
+  u32 old_fib_index;
+} teib_table_bind_ctx_t;
+
+static walk_rc_t
+teib_walk_table_bind (index_t tei, void *arg)
+{
+  teib_table_bind_ctx_t *ctx = arg;
+  teib_entry_t *te;
+
+  te = teib_entry_get (tei);
+
+  TEIB_TE_INFO (te, "bind: %d -> %d", ctx->old_fib_index, ctx->new_fib_index);
+
+  teib_adj_fib_remove (te->te_key->tk_proto,
+		       &te->te_key->tk_peer,
+		       te->te_key->tk_sw_if_index, ctx->old_fib_index);
+  teib_adj_fib_add (te->te_key->tk_proto,
+		    &te->te_key->tk_peer,
+		    te->te_key->tk_sw_if_index, ctx->new_fib_index);
+
+  return (WALK_CONTINUE);
+}
+
+static void
+teib_table_bind_v4 (ip4_main_t * im,
+		    uword opaque,
+		    u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
+{
+  teib_table_bind_ctx_t ctx = {
+    .old_fib_index = old_fib_index,
+    .new_fib_index = new_fib_index,
+  };
+
+  teib_walk_itf_proto (sw_if_index,
+		       FIB_PROTOCOL_IP4, teib_walk_table_bind, &ctx);
+}
+
+static void
+teib_table_bind_v6 (ip6_main_t * im,
+		    uword opaque,
+		    u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
+{
+  teib_table_bind_ctx_t ctx = {
+    .old_fib_index = old_fib_index,
+    .new_fib_index = new_fib_index,
+  };
+
+  teib_walk_itf_proto (sw_if_index,
+		       FIB_PROTOCOL_IP6, teib_walk_table_bind, &ctx);
+}
+
 void
 teib_register (const teib_vft_t * vft)
 {
@@ -228,7 +414,22 @@
 static clib_error_t *
 teib_init (vlib_main_t * vm)
 {
-  teib_db = hash_create_mem (0, sizeof (teib_key_t), sizeof (u32));
+  fib_protocol_t fproto;
+
+  FOR_EACH_FIB_IP_PROTOCOL (fproto)
+    teib_db[fproto] = hash_create_mem (0, sizeof (teib_key_t), sizeof (u32));
+
+  ip4_table_bind_callback_t cb4 = {
+    .function = teib_table_bind_v4,
+  };
+  vec_add1 (ip4_main.table_bind_callbacks, cb4);
+
+  ip6_table_bind_callback_t cb6 = {
+    .function = teib_table_bind_v6,
+  };
+  vec_add1 (ip6_main.table_bind_callbacks, cb6);
+
+  teib_logger = vlib_log_register_class ("teib", "teib");
 
   return (NULL);
 }
diff --git a/src/vnet/teib/teib.h b/src/vnet/teib/teib.h
index 4a03eee..2a5da76 100644
--- a/src/vnet/teib/teib.h
+++ b/src/vnet/teib/teib.h
@@ -37,6 +37,7 @@
 extern u32 teib_entry_get_sw_if_index (const teib_entry_t * ne);
 extern u32 teib_entry_get_fib_index (const teib_entry_t * ne);
 extern const ip46_address_t *teib_entry_get_peer (const teib_entry_t * ne);
+extern fib_protocol_t teib_entry_get_proto (const teib_entry_t * ne);
 extern const fib_prefix_t *teib_entry_get_nh (const teib_entry_t * ne);
 extern u8 *format_teib_entry (u8 * s, va_list * args);
 
@@ -44,12 +45,16 @@
  * Create a new TEIB entry
  */
 extern int teib_entry_add (u32 sw_if_index,
+			   fib_protocol_t fproto,
 			   const ip46_address_t * peer,
 			   u32 nh_table_id, const ip46_address_t * nh);
 
-extern int teib_entry_del (u32 sw_if_index, const ip46_address_t * peer);
+extern int teib_entry_del (u32 sw_if_index,
+			   fib_protocol_t fproto,
+			   const ip46_address_t * peer);
 
 extern teib_entry_t *teib_entry_find (u32 sw_if_index,
+				      fib_protocol_t fproto,
 				      const ip46_address_t * peer);
 extern teib_entry_t *teib_entry_get (index_t nei);
 
diff --git a/src/vnet/teib/teib_api.c b/src/vnet/teib/teib_api.c
index 48bfee3..b885128 100644
--- a/src/vnet/teib/teib_api.c
+++ b/src/vnet/teib/teib_api.c
@@ -39,19 +39,26 @@
 vl_api_teib_entry_add_del_t_handler (vl_api_teib_entry_add_del_t * mp)
 {
   vl_api_teib_entry_add_del_reply_t *rmp;
-  ip46_address_t peer, nh;
+  ip46_address_t nh;
+  ip_address_t peer;
   int rv;
 
   VALIDATE_SW_IF_INDEX ((&mp->entry));
 
-  ip_address_decode (&mp->entry.peer, &peer);
+  ip_address_decode2 (&mp->entry.peer, &peer);
   ip_address_decode (&mp->entry.nh, &nh);
 
   if (mp->is_add)
-    rv = teib_entry_add (ntohl (mp->entry.sw_if_index), &peer,
-			 ntohl (mp->entry.nh_table_id), &nh);
+    rv = teib_entry_add (ntohl (mp->entry.sw_if_index),
+			 ip_address_family_to_fib_proto (ip_addr_version
+							 (&peer)),
+			 &ip_addr_46 (&peer), ntohl (mp->entry.nh_table_id),
+			 &nh);
   else
-    rv = teib_entry_del (ntohl (mp->entry.sw_if_index), &peer);
+    rv = teib_entry_del (ntohl (mp->entry.sw_if_index),
+			 ip_address_family_to_fib_proto (ip_addr_version
+							 (&peer)),
+			 &ip_addr_46 (&peer));
 
   BAD_SW_IF_INDEX_LABEL;
 
diff --git a/src/vnet/teib/teib_cli.c b/src/vnet/teib/teib_cli.c
index faf0d82..63e3645 100644
--- a/src/vnet/teib/teib_cli.c
+++ b/src/vnet/teib/teib_cli.c
@@ -20,8 +20,8 @@
 	  unformat_input_t * input, vlib_cli_command_t * cmd)
 {
   unformat_input_t _line_input, *line_input = &_line_input;
-  ip46_address_t peer = ip46_address_initializer;
   ip46_address_t nh = ip46_address_initializer;
+  ip_address_t peer = IP_ADDRESS_V6_ALL_0S;
   u32 sw_if_index, nh_table_id;
   clib_error_t *error = NULL;
   int rv;
@@ -38,7 +38,7 @@
       if (unformat (line_input, "%U", unformat_vnet_sw_interface,
 		    vnet_get_main (), &sw_if_index))
 	;
-      else if (unformat (line_input, "peer %U", unformat_ip46_address, &peer))
+      else if (unformat (line_input, "peer %U", unformat_ip_address, &peer))
 	;
       else if (unformat (line_input, "nh %U", unformat_ip46_address, &nh))
 	;
@@ -58,7 +58,7 @@
 				 format_unformat_error, line_input);
       goto done;
     }
-  if (ip46_address_is_zero (&peer))
+  if (ip_address_is_zero (&peer))
     {
       error = clib_error_return (0, "peer required'",
 				 format_unformat_error, line_input);
@@ -71,7 +71,10 @@
       goto done;
     }
 
-  rv = teib_entry_add (sw_if_index, &peer, nh_table_id, &nh);
+  rv = teib_entry_add (sw_if_index,
+		       ip_address_family_to_fib_proto (ip_addr_version
+						       (&peer)),
+		       &ip_addr_46 (&peer), nh_table_id, &nh);
 
   if (rv)
     {
@@ -99,7 +102,7 @@
 	  unformat_input_t * input, vlib_cli_command_t * cmd)
 {
   unformat_input_t _line_input, *line_input = &_line_input;
-  ip46_address_t peer = ip46_address_initializer;
+  ip_address_t peer = IP_ADDRESS_V6_ALL_0S;
   clib_error_t *error = NULL;
   u32 sw_if_index;
   int rv;
@@ -115,7 +118,7 @@
       if (unformat (line_input, "%U", unformat_vnet_sw_interface,
 		    vnet_get_main (), &sw_if_index))
 	;
-      else if (unformat (line_input, "peer %U", unformat_ip46_address, &peer))
+      else if (unformat (line_input, "peer %U", unformat_ip_address, &peer))
 	;
       else
 	{
@@ -130,14 +133,17 @@
       error = clib_error_return (0, "interface required'",
 				 format_unformat_error, line_input);
     }
-  if (ip46_address_is_zero (&peer))
+  if (ip_address_is_zero (&peer))
     {
       error = clib_error_return (0, "peer required'",
 				 format_unformat_error, line_input);
       goto done;
     }
 
-  rv = teib_entry_del (sw_if_index, &peer);
+  rv = teib_entry_del (sw_if_index,
+		       ip_address_family_to_fib_proto (ip_addr_version
+						       (&peer)),
+		       &ip_addr_46 (&peer));
 
   if (rv)
     {
diff --git a/test/test_ipip.py b/test/test_ipip.py
index 0403487..8f18c07 100644
--- a/test/test_ipip.py
+++ b/test/test_ipip.py
@@ -45,7 +45,7 @@
     @classmethod
     def setUpClass(cls):
         super(TestIPIP, cls).setUpClass()
-        cls.create_pg_interfaces(range(2))
+        cls.create_pg_interfaces(range(3))
         cls.interfaces = list(cls.pg_interfaces)
 
     @classmethod
@@ -54,8 +54,14 @@
 
     def setUp(self):
         super(TestIPIP, self).setUp()
+        self.table = VppIpTable(self, 1, register=False)
+        self.table.add_vpp_config()
+
         for i in self.interfaces:
             i.admin_up()
+
+        self.pg2.set_table_ip4(self.table.table_id)
+        for i in self.interfaces:
             i.config_ip4()
             i.config_ip6()
             i.disable_ipv6_ra()
@@ -68,8 +74,11 @@
             for i in self.pg_interfaces:
                 i.unconfig_ip4()
                 i.unconfig_ip6()
+                i.set_table_ip4(0)
                 i.admin_down()
 
+        self.table.remove_vpp_config()
+
     def validate(self, rx, expected):
         self.assertEqual(rx, expected.__class__(expected))
 
@@ -475,7 +484,7 @@
     def test_mipip4(self):
         """ p2mp IPv4 tunnel Tests """
 
-        for itf in self.pg_interfaces:
+        for itf in self.pg_interfaces[:2]:
             #
             # one underlay nh for each overlay/tunnel peer
             #
@@ -579,8 +588,44 @@
                     self.assertEqual(rx[IP].dst, itf._remote_hosts[ii].ip4)
                 rx = self.send_and_expect(self.pg0, tx_i, self.pg0)
 
+                #
+                # we can also send to the peer's address
+                #
+                inner = (IP(dst=teib.peer, src="5.5.5.5") /
+                         UDP(sport=1234, dport=1234) /
+                         Raw(b'0x44' * 100))
+                tx_e = [(Ether(dst=self.pg0.local_mac,
+                               src=self.pg0.remote_mac) /
+                         inner) for x in range(63)]
+
+                rxs = self.send_and_expect(self.pg0, tx_e, itf)
+
+            #
+            # with all of the peers in place, swap the ip-table of
+            # the ipip interface
+            #
+            table = VppIpTable(self, 2)
+            table.add_vpp_config()
+
+            ipip_if.unconfig_ip4()
+            ipip_if.set_table_ip4(self.table.table_id)
+            ipip_if.config_ip4()
+
+            #
+            # we should still be able to reach the peers from the new table
+            #
+            inner = (IP(dst=teib.peer, src="5.5.5.5") /
+                     UDP(sport=1234, dport=1234) /
+                     Raw(b'0x44' * 100))
+            tx_e = [(Ether(dst=self.pg0.local_mac,
+                           src=self.pg0.remote_mac) /
+                     inner) for x in range(63)]
+
+            rxs = self.send_and_expect(self.pg2, tx_e, itf)
+
             ipip_if.admin_down()
             ipip_if.unconfig_ip4()
+            ipip_if.set_table_ip4(0)
 
 
 class TestIPIP6(VppTestCase):
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index cd70b38..4675db5 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -188,16 +188,19 @@
     def __init__(self,
                  test,
                  table_id,
-                 is_ip6=0):
+                 is_ip6=0,
+                 register=True):
         self._test = test
         self.table_id = table_id
         self.is_ip6 = is_ip6
+        self.register = register
 
     def add_vpp_config(self):
         self._test.vapi.ip_table_add_del(is_add=1,
                                          table={'is_ip6': self.is_ip6,
                                                 'table_id': self.table_id})
-        self._test.registry.register(self, self._test.logger)
+        if self.register:
+            self._test.registry.register(self, self._test.logger)
         return self
 
     def remove_vpp_config(self):
