diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index ed8ebe33..c1cd34fa 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -187,7 +187,7 @@ ip4_route(const ip4_addr_t *dest)
   /* loopif is disabled, looopback traffic is passed through any netif */
   if (ip4_addr_isloopback(dest)) {
     /* don't check for link on loopback traffic */
-    if (netif_default != NULL && netif_is_up(netif_default)) {
+    if ((netif_default != NULL) && netif_is_up(netif_default)) {
       return netif_default;
     }
     /* default netif is not up, just use any netif for loopback traffic */
diff --git a/src/core/netif.c b/src/core/netif.c
index 4e1dcfcd..f2b3a4f4 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -141,7 +141,7 @@ static err_t netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const i
 #endif
 
 
-static struct netif loop_netif;
+struct netif lwip_loop_netif;
 
 /**
  * Initialize a lwip network interface structure for a loopback interface
@@ -191,18 +191,18 @@ netif_init(void)
 #endif /* LWIP_IPV4 */
 
 #if NO_SYS
-  netif_add(&loop_netif, LOOPIF_ADDRINIT NULL, netif_loopif_init, ip_input);
+  netif_add(&lwip_loop_netif, LOOPIF_ADDRINIT NULL, netif_loopif_init, ip_input);
 #else  /* NO_SYS */
-  netif_add(&loop_netif, LOOPIF_ADDRINIT NULL, netif_loopif_init, tcpip_input);
+  netif_add(&lwip_loop_netif, LOOPIF_ADDRINIT NULL, netif_loopif_init, tcpip_input);
 #endif /* NO_SYS */
 
 #if LWIP_IPV6
-  IP_ADDR6_HOST(loop_netif.ip6_addr, 0, 0, 0, 0x00000001UL);
-  loop_netif.ip6_addr_state[0] = IP6_ADDR_VALID;
+  IP_ADDR6_HOST(lwip_loop_netif.ip6_addr, 0, 0, 0, 0x00000001UL);
+  lwip_loop_netif.ip6_addr_state[0] = IP6_ADDR_VALID;
 #endif /* LWIP_IPV6 */
 
-  netif_set_link_up(&loop_netif);
-  netif_set_up(&loop_netif);
+  netif_set_link_up(&lwip_loop_netif);
+  netif_set_up(&lwip_loop_netif);
 
 #endif /* LWIP_HAVE_LOOPIF */
 }
@@ -1105,7 +1105,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
    * if not they are adjusted for 'netif'. */
 #if MIB2_STATS
 #if LWIP_HAVE_LOOPIF
-  struct netif *stats_if = &loop_netif;
+  struct netif *stats_if = &lwip_loop_netif;
 #else /* LWIP_HAVE_LOOPIF */
   struct netif *stats_if = netif;
 #endif /* LWIP_HAVE_LOOPIF */
@@ -1220,7 +1220,7 @@ netif_poll(struct netif *netif)
    * if not they are adjusted for 'netif'. */
 #if MIB2_STATS
 #if LWIP_HAVE_LOOPIF
-  struct netif *stats_if = &loop_netif;
+  struct netif *stats_if = &lwip_loop_netif;
 #else /* LWIP_HAVE_LOOPIF */
   struct netif *stats_if = netif;
 #endif /* LWIP_HAVE_LOOPIF */
diff --git a/test/unit/ip4/test_ip4.c b/test/unit/ip4/test_ip4.c
index a5a7fd93..dd16fcdc 100644
--- a/test/unit/ip4/test_ip4.c
+++ b/test/unit/ip4/test_ip4.c
@@ -1,6 +1,7 @@
 #include "test_ip4.h"
 
 #include "lwip/ip4.h"
+#include "lwip/etharp.h"
 #include "lwip/inet_chksum.h"
 #include "lwip/stats.h"
 #include "lwip/prot/ip.h"
@@ -12,6 +13,56 @@
 #error "This tests needs LWIP_IPV4, IP_REASSEMBLY; MIB2- and IPFRAG-statistics enabled"
 #endif
 
+static struct netif test_netif;
+static ip4_addr_t test_ipaddr, test_netmask, test_gw;
+static int linkoutput_ctr;
+
+/* reference internal lwip variable in netif.c */
+extern struct netif lwip_loop_netif;
+
+static err_t
+test_netif_linkoutput(struct netif *netif, struct pbuf *p)
+{
+  fail_unless(netif == &test_netif);
+  fail_unless(p != NULL);
+  linkoutput_ctr++;
+  return ERR_OK;
+}
+
+static err_t
+test_netif_init(struct netif *netif)
+{
+  fail_unless(netif != NULL);
+  netif->linkoutput = test_netif_linkoutput;
+  netif->output = etharp_output;
+  netif->mtu = 1500;
+  netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
+  netif->hwaddr_len = ETHARP_HWADDR_LEN;
+  return ERR_OK;
+}
+
+static void
+test_netif_add(void)
+{
+  IP4_ADDR(&test_gw, 192,168,0,1);
+  IP4_ADDR(&test_ipaddr, 192,168,0,1);
+  IP4_ADDR(&test_netmask, 255,255,0,0);
+
+  fail_unless(netif_default == NULL);
+  netif_add(&test_netif, &test_ipaddr, &test_netmask, &test_gw,
+    NULL, test_netif_init, NULL);
+  netif_set_default(&test_netif);
+  netif_set_up(&test_netif);
+}
+
+static void
+test_netif_remove(void)
+{
+  if (netif_default == &test_netif) {
+    netif_remove(&test_netif);
+  }
+}
+
 /* Helper functions */
 static void
 create_ip4_input_fragment(u16_t ip_id, u16_t start, u16_t len, int last)
@@ -71,11 +122,11 @@ ip4_teardown(void)
   /* poll until all memory is released... */
   tcpip_thread_poll_one();
   lwip_check_ensure_no_alloc(SKIP_POOL(MEMP_SYS_TIMEOUT));
+  test_netif_remove();
+  netif_set_up(&lwip_loop_netif);
 }
 
-
 /* Test functions */
-
 START_TEST(test_ip4_reass)
 {
   const u16_t ip_id = 128;
@@ -148,6 +199,24 @@ START_TEST(test_ip4_reass)
 }
 END_TEST
 
+/* packets to 127.0.0.1 shall not be sent out to netif_default */
+START_TEST(test_127_0_0_1)
+{
+  ip4_addr_t localhost;
+  struct pbuf* p;
+
+  LWIP_UNUSED_ARG(_i);
+
+  test_netif_add();
+  netif_set_down(&lwip_loop_netif);
+
+  IP4_ADDR(&localhost, 127, 0, 0, 1);
+  p = pbuf_alloc(PBUF_IP, 10, PBUF_POOL);
+
+  ip4_output(p, netif_ip4_addr(netif_default), &localhost, 0, 0, IP_PROTO_UDP);
+  fail_unless(linkoutput_ctr == 0);
+}
+END_TEST
 
 /** Create the suite including all tests for this module */
 Suite *
@@ -155,6 +224,7 @@ ip4_suite(void)
 {
   testfunc tests[] = {
     TESTFUNC(test_ip4_reass),
+    TESTFUNC(test_127_0_0_1),
   };
   return create_suite("IPv4", tests, sizeof(tests)/sizeof(testfunc), ip4_setup, ip4_teardown);
 }
