Example topologies

This directory contains example topologies, you can start them using

python -m ipmininet.examples --topo=[topo_name] [--args key=val,key=val]

Where topo_name is the name of the topology, and args are optional arguments for it.

The following sections will detail the topologies.

SimpleOSPFNetwork

topo name : simple_ospf_network args : n/a

This network spawn a single AS topology, using OSPF, with multiple areas and variable link metrics. From the mininet CLI, access the routers vtysh using

[noecho rx] telnet localhost [ospfd/zebra]

Where the noecho rx is required if you don’t use a separate xterm window for the node (via xterm rx), and ospfd/zebra is the name of the daemon you wish to connect to.

SimpleOSPFv3Network

topo name : simple_ospfv3_network args : n/a

This network spawn a single AS topology, using OSPFv3, with variable link metrics. From the mininet CLI, access the routers vtysh using

[noecho rx] telnet localhost [ospf6d/zebra]

Where the noecho rx is required if you don’t use a separate xterm window for the node (via xterm rx), and ospf6d/zebra is the name of the daemon you wish to connect to.

SimpleBGPNetwork

topo name : simple_bgp_network args : n/a

This networks spawn ASes, exchanging reachability information.

  • AS1 has one eBGP peering with AS2
  • AS2 has 2 routers, using iBGP between them, and has two eBGP peering, one with AS1 and one with AS3
  • AS3 has one eBGP peerin with AS2

BGPDecisionProcess

topo name : bgp_decision_process args : other_cost (defaults to 5)

This network is similar to SimpleBGPNetwork. However, AS2 has more routers, and not all of them run BGP. It attempts to show cases the effect of the IGP cost in the BGP decision process in Quagga.

Both AS1 and AS3 advertize a router towards 1.2.3.0/24 to AS2 eBGP routers as2r1 and as2r2. These routers participate in an OSPF topology inside their AS, which looks as follow: as2r1 -[10]- x -[1]- as2r3 -[1]- y -[other_cost]- as2r2. as2r1, as2r3 and as2r2 also participate in an iBGP fullmesh.

Depending on the value of [other_cost] (if it is greater or lower than 10), as2r3 will either choose to use as2r1 or as2r2 as nexthop for 1.2.3.0/24, as both routes are equal up to step #8 in the decision process, which is the IGP cost (in a loosely defined way, as it includes any route towards the BGP nexthop). If other_cost is 10, we then arrive at step #10 to choose the best routes, and compare the routerids of as2r1 and as2r2 to select the path (1.1.1.1 (as2r1) vs 1.1.1.2 (as2r2), so we select the route from as2r1).

You can observe this selection by issuing one of the following command sequence once BGP has converged:

  • net > as2r3 ip route show 1.2.3.0/24
  • [noecho as2r3] telnet localhost bgpd > password is zebra > enable > show ip bgp 1.2.3.0/24

BGPLocalPref

topo name : bgp_local_pref args : n/a

This topology is composed of two ASes connected in dual homing with a higher local pref on one of the BGP peerings. Thus, all the traffic coming from AS1 will go through the upper link.

BGPMED

topo name : bgp_med args : n/a

This topology is composed of two ASes connected in dual homing with a higher MED for routes from the upper peering than the lower one. Thus, all the traffic coming from AS1 will go through the lower link.

BGPRR

topo name : bgp_rr args : n/a

This topology is composed of five AS. AS1 uses two router reflectors.

BGPFullConfig

topo name : bgp_full_config args : n/a

This topology is composed of two AS connected in dual homing with different local pref, MED and communities. AS1 has one route reflector as well.

BGPPolicies

The following topologies are built from the exercise sessions of CNP3 syllabus.

topo name : bgp_policies_1 args : n/a

topo name : bgp_policies_2 args : n/a

topo name : bgp_policies_3 args : n/a

topo name : bgp_policies_4 args : n/a

topo name : bgp_policies_5 args : n/a

All of these topologies have routes exchanging BGP reachability. They use two predefined BGP policies: shared-cost and client/provider peerings.

ASes always favor routes received from clients, then routes from shared-cost peering, and finally, routes received from providers. Moreover, ASes filter out routes depending on the peering type:

  • Routes learned from shared-cost are not forwarded to providers and other shared-cost peers.
  • Routes learned from providers are not forwarded to shared-cost peers and other providers.

BGPPoliciesAdjust

The following topology is built from the exercise sessions of CNP3 syllabus.

topo name : bgp_policies_adjust args : as_start (defaults to None), as_end (defaults to None), bgp_policy (defaults to ‘Share’)

This network contains a topology with 5 shared-cost and 2 client-provider peerings. Some ASes cannot reach all other ASes. The user can add a peering to ensure connectivity. To do so, use the topology arguments. For instance, the following command will add a link between AS1 and AS3 and start a shared-cost BGP peering.

python -m ipmininet.examples --topo=bgp_policies_adjust --args as_start=as1r,as_end=as3r,bgp_policy=Share

IPTables

topo name : iptables args : n/a

This network spawns two routers, which have custom ACLs set such that their inbound traffic (the INPUT chains in ip(6)tables):

  • Can only be ICMP traffic over IPv4
  • Can only be (properly established) TCP over IPv6

You can test this by trying to ping(6) both routers, use nc to (try to) exchange data over TCP, or tracebox to send a crafted TCP packet not part of an already established session.

GRETopo

topo name : gre args : n/a

This network spawns routers in a line, with two hosts attached on the ends. A GRE Tunnel for prefix 10.0.1.0/24 is established with the two hosts (h1 having 10.0.1.1 assigned and h2 10.0.1.2).

Example tests:

  • Verify connectivity, normally: h1 ping h2, over the tunnel: h1 ping 10.0.1.2
  • h1 traceroute h2, h1 traceroute 10.0.1.2, should show two different routes, with the second one hiding the intermediate routers.

SSHd

topo name : ssh args : n/a

This network spawns two routers with an ssh daemon, an a key that is renewed at each run.

You can try to connect by reusing the per-router ssh config, e.g.:

r1 ssh -o IdentityFile=/tmp/__ipmininet_temp_key r2

RIPngNetwork

topo name : ripng_network args : n/a

This network uses the RIPng daemon to ensure connectivity between hosts. Like all FRRouting daemons, you can access the routers vtysh using, from the mininet CLI:

[noecho rx] telnet localhost 2603

RIPngNetworkAdjust

topo name : ripng_network_adjust args : lr1r2_cost, lr1r3_cost, lr1r5_cost, lr2r3_cost, lr2r4_cost, lr2r5_cost, lr4r5_cost

This network also uses the RIPng daemon to ensure connectivity between hosts. Moreover, the IGP metric on each link can be customized. For instance, the following command changes IGP cost of both the link between r1 and r2 and the link between r1 and r3 to 2:

python -m ipmininet.examples --topo=ripng_network_adjust --args lr1r2_cost=2,lr1r3_cost=2

RouterAdvNetwork

topo name : router_adv_network args : n/a

This network spawn a small topology with two hosts and a router. One of these hosts uses Router Advertisements to get its IPv6 addresses The other one’s IP addresses are announced in the Router Advertisements as the DNS server’s addresses.

SimpleOpenRNetwork

topo name : simple_openr_network args : n/a

This network represents a small OpenR network connecting three routers in a Bus topology. Each router has hosts attached. The /tmp folders are private to isolate the unix sockets used by OpenR. The private /var/log directories isolate logs.

Use breeze to investigate the routing state of OpenR.

StaticAddressNetwork

topo name : static_address_network args : n/a

This network has statically assigned addresses instead of using the IPMininet auto-allocator.

PartialStaticAddressNetwork

topo name : partial_static_address_network args : n/a

This network has some statically assigned addresses and the others are dynamically allocated.

StaticRoutingNet

topo name : static_routing_network args : n/a

This network uses static routes with zebra and static daemons.

StaticRoutingNetBasic

topo name : static_routing_network_basic args : n/a

This nework uses static routes with zebra and static daemons. This topology uses only 4 routers.

StaticRoutingNetComplex

topo name : static_routing_network_complex args : n/a

This network uses static routes with zebra and static daemons. This topology uses 6 routers. The routes are not the same as if they were chosen by OSPF6. The path from X to Y and its reverse path are not the same.

StaticRoutingNetFailure

topo name : static_routing_network_failure args : n/a

This network uses static routes with zebra and static daemons. These static routes are incorrect. They do not enable some routers to communicate with each other.

SpanningTreeNet

topo name : spanning_tree_network args : n/a

This network contains a single LAN with a loop. It enables the spanning tree protocol to prevent packet looping in the LAN.

SpanningTreeHub

topo name : spanning_tree_hub args : n/a

This network contains a more complex LAN with many loops, using hubs to simulate one-to-many links between switches. It enables the spanning tree protocol to prevent packet looping in the LAN.

SpanningTreeBus

topo name : spanning_tree_bus args : n/a

This network contains a single LAN without any loop, but using a hub to simulate a bus behavior. It enables the spanning tree protocol to prevent packet looping in the LAN, even if there is no loop here.

SpanningTreeIntermediate

topo name : spanning_tree_intermediate args : n/a

This network contains a single LAN with 2 loops inside. It shows the spanning tree protocol to avoid the packets looping in the network.

SpanningTreeFullMesh

topo name : spanning_tree_full_mesh args : n/a

This network contains a single LAN with many loops inside. It enables the spanning tree protocol to prevent packet looping in the LAN.

SpanningTreeAdjust

topo name : spannnig_tree_adjust

args :

  • l1_start: Endpoint interface of the 1st link on which we want to change the cost
  • l1_end: Endpoint interface of the 1st link on which we want to change the cost
  • l1_cost: Cost to set on the first link
  • l2_start: Endpoint interface of the 2nd link on which we want to change the cost
  • l2_end: Endpoint interface of the 2nd link on which we want to change the cost
  • l2_cost: Cost to set on the second link

This network contains a single LAN with many loops inside. It enables the spanning tree protocol to prevent packets from looping in the network. The arguments of this topology allows users to change the STP cost on two links.

For instance, the following command changes STP cost of the link between s6.1 and s3.4 to 2:

python -m ipmininet.examples --topo=spannnig_tree_adjust --args l1_start=s6-eth1,l1_end=s3-eth4,l1_cost=2

SpanningTreeCost

topo name: spannnig_tree_cost args : n/a

This network contains a single LAN with one loop inside. It enables the spanning tree protocol to prevent packet looping in the LAN. It also changes the STP cost one link.

DNSNetwork

topo name : dns_network args : n/a

This network contains two DNS server, a master and a slave. The domain name is ‘mydomain.org’ and it contains the address mapping of all the hosts of the network. You can query the DNS servers with, for instance, one of the following commands:

master dig @locahost -t NS mydomain.org
master dig @locahost -t AAAA server.mydomain.org
slave dig @locahost -t NS mydomain.org
slave dig @locahost -t AAAA server.mydomain.org

More examples

More examples can be found in this repository.