Playing with Virtual and Real Networks: Midonet + GNS3
The main difference between virtual and real networks is that most of the time the IP packets are not forwarded by real routers and switches, in midonet they are encapsulated and routed by software daemons that create a virtual topology over a real underlay network. These daemons use a central cluster of zookeeper to share the data, you can get more details of the midonet architecture in the repository of the project https://github.com/midonet/midonet.
Midonet is an overlay network that improves the default Openstack networks, but it can work without Openstack too. However, I think that will be easier to understand how it works with a bit of practice, so we are going to use GNS3 for this.
First, you need GNS3 installed in a linux OS with your favorite appliances ( Cisco, Juniper, Arista, Cumulus, ... ) configured and ready to play.
To try the latest version of midonet with Openstack you only need to do this in your host:
curl -sL quickstart.midonet.org | sudo bash
Logging to /opt/quickstart-midonet/quickstart-midonet.log
* Installing basic dependencies... ok.
* Installing python pip... ok.
* Installing and loading virtual env... ok.
* Installing ansible... ok.
--2015-11-12 18:36:50-- https://www.midonet.org/quickstart-v5.0.tgz
Resolving www.midonet.org (www.midonet.org)... 220.127.116.11
Connecting to www.midonet.org (www.midonet.org)|18.104.22.168|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 125677 (123K) [application/x-gzip]
Saving to: '/tmp/quickstart-ansible.tar.gz'
100%[==========================================================================================================>] 125,677 58.6KB/s in 2.1s
2015-11-12 18:36:53 (58.6 KB/s) - '/tmp/quickstart-ansible.tar.gz' saved [125677/125677]
* Checking distribution/version... ok.
* Running ansible...
OpenStack Kilo with MidoNet available in http://10.0.2.15/horizon
To access through Horizon, use one of the following user/passwords:
* demo/midonet (Demo tenant, demo user)
* admin/midonet (Admin tenant, admin user)
Thanks for trying MidoNet!
Great, we can login in horizon with the credentials mentioned above and launch an instance inside the cloud.
The uplink configured by the quickstart script use a static route and a veth pair. We are going to add a new port to Midonet and configure BGP against a pair of routers so we can connect the cloud against an emulated topology with GNS3 as described below following the next steps:
1) On the host system, add a tap0 interface, a veth pair and connect to a bridge:
ip tuntap add mode tap tap0
ip link add name gns3in type veth peer name gns3out
ip link set up gns3in
ip link set up gns3out
brctl addbr br0
brctl addif br0 tap1
brctl addif br0 gns3int
2) Create a cloud device in GNS3 and add the tap0 interface to it:
3) Configure the Cisco routers to peer against the midonet router, this snippet is from IOU2 router:
router bgp 3
neighbor 10.0.0.10 remote-as 100
4) Add other port to the midonet router:
midonet> router router0 add port address 10.0.0.10 net 10.0.0.0/28
midonet> host host0 add binding port router0:port2 interface gns3out
host host0 interface gns3out port router0:port2
midonet> router router0 set asn 100
midonet> router router0 add bgp-peer asn 3 address 10.0.0.2
midonet> router router0 add bgp-network net 22.214.171.124/24
As you can see the BGP session is established and we can ping from the physical machine to the cloud instance: