diff --git a/minindn/helpers/ip_routing_helper.py b/minindn/helpers/ip_routing_helper.py
new file mode 100644
index 0000000..8c2bddf
--- /dev/null
+++ b/minindn/helpers/ip_routing_helper.py
@@ -0,0 +1,134 @@
+# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+#
+# Copyright (C) 2015-2019, The University of Memphis,
+#                          Arizona Board of Regents,
+#                          Regents of the University of California.
+#
+# This file is part of Mini-NDN.
+# See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
+#
+# Mini-NDN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Mini-NDN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Mini-NDN, e.g., in COPYING.md file.
+# If not, see <http://www.gnu.org/licenses/>.
+
+from igraph import Graph
+from mininet.log import info
+
+class LinkInfo(object):
+    """
+    This class is used to encapsule link information (IP and interface names).
+    """
+
+    def __init__(self, start_intf_name, start_ip, end_intf_name, end_ip):
+        self.start_intf_name = start_intf_name
+        self.start_intf_ip = start_ip
+        self.end_intf_name = end_intf_name
+        self.end_ip = end_ip
+
+class IPRoutingHelper(object):
+    """The routing helper allows to run IP-based evaluations with Mini-NDN. It configures static IP
+    routes to all nodes, which means that all nodes can reach all other nodes in the network
+    reachable, even when relaying is required.
+
+     Usage from Experiment folder: `IPRoutingHelper.calcAllRoutes(self.net)`
+    """
+
+    @staticmethod
+    def findLinkInformation(links, first_node, second_node):
+        """ This method returns link information of a link connecting two nodes.
+
+        :param links: All links in the emulation topology
+        :param first_node: Current node which is looked at
+        :param second_node: Target node (neighbour  of first_node)
+        :return: Link information as LinkInfo object, or returns null None if the
+            nodes are not directly connected
+        """
+        for link in links:
+            if link.intf1.node.name == first_node and link.intf2.node.name == second_node:
+                return LinkInfo(link.intf1.name, link.intf1.ip, link.intf2.name, link.intf2.ip)
+            elif link.intf2.node.name == first_node and link.intf1.node.name == second_node:
+                return LinkInfo(link.intf2.name, link.intf2.ip, link.intf1.name, link.intf1.ip)
+
+        return None
+
+    @staticmethod
+    def calcAllRoutes(net):
+        """ Configures IP routes between all nodes in the emulation topology. This is done in three
+         steps:
+
+        1) IP forwarding is enabled on all nodes
+        2) The igraph lib is used to calculate all shortest paths between the nodes
+        3) Route add commands are used to actually configure the ip routes
+
+        :param net:
+        """
+
+        mini_nodes = net.hosts
+        mini_links = net.links
+
+        # Enabling IP forwaring on all nodes
+        info('Configure IP forwarding on all nodes\n')
+        for node in mini_nodes:
+            node.cmd('sysctl -w net.ipv4.ip_forward=1')
+
+        # Calculate igraph to calculate all shortest paths between nodes
+        node_names = [node.name for node in mini_nodes]
+        links = []
+        for link in mini_links:
+            links.append((link.intf1.node.name, link.intf2.node.name))
+            links.append((link.intf2.node.name, link.intf1.node.name))
+
+        networkGraph = Graph()
+        networkGraph = networkGraph.as_directed()
+        for node in node_names:
+            networkGraph.add_vertex(node)
+        for (a, b) in links:
+            networkGraph.add_edges([(a, b), (b, a)])
+
+        named_paths = []
+        for from_node in node_names:
+            for to_node in node_names:
+                if from_node != to_node:
+                    paths = networkGraph.get_all_shortest_paths(from_node, to_node)
+                    if len(paths) == 0:
+                        continue
+                    shortest_path = paths[0]
+                    shortest_path_with_nodenames = []
+                    for node in shortest_path:
+                        shortest_path_with_nodenames.append(networkGraph.vs['name'][node])
+                    named_paths.append(shortest_path_with_nodenames)
+
+        # Iterate over all paths and configure the routes using the 'route add'
+        info('Configure routes on all nodes\n')
+        for path in named_paths:
+            start_node = path[0]
+            end_node = path[-1]
+            mini_start = net.get(start_node)
+            mini_end = net.get(end_node)
+
+            link_info = IPRoutingHelper.findLinkInformation(mini_links, path[0], path[1])
+            start_intf = link_info.start_intf_name
+
+            for intf in mini_end.intfs:
+                addr = mini_end.intfs[intf].ip
+                if len(path) == 2:
+                    # For direct connection, configure exit interface
+                    info('[{}] route add -host {} dev {}\n'.format(start_node, addr, start_intf))
+                    mini_start.cmd('route add -host {} dev {}'.format(addr, start_intf))
+                elif len(path) > 2:
+                    # For longer paths, configure next hop as gateway
+                    gateway_ip = link_info.end_ip
+                    info('[{}] route add -host {} dev {} gw {}\n'
+                         .format(start_node, addr, start_intf, gateway_ip))
+                    mini_start.cmd('route add -host {} dev {} gw {}'
+                                   .format(addr, start_intf, gateway_ip))
