Network Experiments with VMware NSX-T and Cisco Modeling Labs
Tags: datacenternetworking, homelab, networkautomation, programmability
Published: 2022-04-30 01:18:49

---
title: Network Experiments with VMware NSX-T and Cisco Modeling Labs
published: true
date: 2022-04-30 01:09:00 UTC
tags: DatacenterNetworking,HomeLab,NetworkAutomation,Programmability
canonical_url: https://blog.engyak.co/2022/04/network-experiments-with-vmware-nsx-t.html
---

Cisco Modeling Labs (CML) has turned out to be a great tool for deploying virtual network resources, but the "only Cisco VNFs" limitation is a bit much.

Let's use this opportunity to really take advantage of the capabilities that NSX-T has for virtual network labs!

## Overview

For the purpose of lab construction, I will use an existing Tier-0 router and uplinks to facilitate the "basics", e.g. internet connectivity && remote accessibility:

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFhWLwjjDN3xmyIM21PZ6Z78OYZL0GDa5ZYZNT8gUPo0FmvjWkGivZomeBTdfI-RfkEeNrbVpbeRIrnPNcKM4M989MPySzL5Nariz4v5BjLCocOTxn0LClFZR4skcX-8YY6DOzr3gmY1DYEBDpBXnhS5qdbXq5jAA9YzAcK0KKYK_kR7G36oQH4Mnd/w655-h845/NetworkDiagram-Sanitized%20Virtual%20Topology.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFhWLwjjDN3xmyIM21PZ6Z78OYZL0GDa5ZYZNT8gUPo0FmvjWkGivZomeBTdfI-RfkEeNrbVpbeRIrnPNcKM4M989MPySzL5Nariz4v5BjLCocOTxn0LClFZR4skcX-8YY6DOzr3gmY1DYEBDpBXnhS5qdbXq5jAA9YzAcK0KKYK_kR7G36oQH4Mnd/s1001/NetworkDiagram-Sanitized%20Virtual%20Topology.png)

### Constructing the NSX-T "Outside" Environment   

NSX-T has a few super-powers when it comes to constructing network topologies. We need one in particular to execute this - **Q-in-VNI**  **encapsulation** - which is enabled on a per-segment basis. Compared to NSX-V, this is simple and straightforward - a user simply applies the allowed VLAN range to the vn-segment, in this case, _ **eng-lab-vn-cml-trunk: ** _

_**[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5H-xpiZB6ZMdOICtsN0ocj64pSlD0QPpSqzaC8cV8hTriEEpLBUBM3K5IAOsyvfi7d23HzbYmAYWMOix_uk37P26FGribnZkmnM1z547YGJWtCP8JT-w-IK1aNCA3yhBY1BjZSkNV4by3DvoaMRsQpkLJZRAText68wf2qByz4mXWwvp8Pg4fBrZ1/w671-h316/2022-04-29%2010_27_36-NSX%20%E2%80%94%20Mozilla%20Firefox.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5H-xpiZB6ZMdOICtsN0ocj64pSlD0QPpSqzaC8cV8hTriEEpLBUBM3K5IAOsyvfi7d23HzbYmAYWMOix_uk37P26FGribnZkmnM1z547YGJWtCP8JT-w-IK1aNCA3yhBY1BjZSkNV4by3DvoaMRsQpkLJZRAText68wf2qByz4mXWwvp8Pg4fBrZ1/s903/2022-04-29%2010_27_36-NSX%20%E2%80%94%20Mozilla%20Firefox.png)**_

We'll need to disable some security features that protect the network by creating and applying the following segment profiles. The objective is to limit ARP snooping and force NSX to learn MAC addresses over the segment instead of from the controller.

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-wGyIvOahw-YbEYKHrhHwgxMF_zFfnarlkqMvR0if3iWE5IR20GsygplQ4AGpZahXRFgz3-___XSE9A5p3idjV8heYrTzfFumleaIs5KmCzAqyvmLu7hyKp53_0dk9igmWl_n9sLD2BY3K3JqRXHpgArf95kNBkZydf7TgpBPXT9ismC3a-EpS9-j/w751-h314/2022-04-29%2012_25_59-NSX%20%E2%80%94%20Mozilla%20Firefox.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-wGyIvOahw-YbEYKHrhHwgxMF_zFfnarlkqMvR0if3iWE5IR20GsygplQ4AGpZahXRFgz3-___XSE9A5p3idjV8heYrTzfFumleaIs5KmCzAqyvmLu7hyKp53_0dk9igmWl_n9sLD2BY3K3JqRXHpgArf95kNBkZydf7TgpBPXT9ismC3a-EpS9-j/s889/2022-04-29%2012_25_59-NSX%20%E2%80%94%20Mozilla%20Firefox.png)

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjUQTV7EJir0K7EsTSGteXtyqHW4i8LAVeTvEJ_9zg8t_V42v2iFrgakBodthhh8B-F4dSfwSzqeSJAx-47G1qKKDtPPWLuI0HRr-5258QksPbOKeYMnPmUy23GRiSkkjYE5uxp4EuVSGanA-I280YW2MuMffz4_oBkv9_y-M9s0SI2RIF3hL_ispG/w750-h225/2022-04-29%2012_26_26-NSX%20%E2%80%94%20Mozilla%20Firefox.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjUQTV7EJir0K7EsTSGteXtyqHW4i8LAVeTvEJ_9zg8t_V42v2iFrgakBodthhh8B-F4dSfwSzqeSJAx-47G1qKKDtPPWLuI0HRr-5258QksPbOKeYMnPmUy23GRiSkkjYE5uxp4EuVSGanA-I280YW2MuMffz4_oBkv9_y-M9s0SI2RIF3hL_ispG/s980/2022-04-29%2012_26_26-NSX%20%E2%80%94%20Mozilla%20Firefox.png)
**I can't stress this enough, the Q-in-VNI feature gives us near unlimited power with other VFs, circumventing the 10 vNIC limit in vSphere and reducing the number of segments that must be deployed to what would normally be "physical pipes".**

Here's what it looks like via the API:

<script src="https://gist.github.com/ngschmidt/9d7451c40a0fc9126a394c2abb922fa8.js"></script>
### Expose connectivity to CML   

Generating the segments in NSX is complete, and now we need to get into the weeds a bit with CML. CML is, in essence, a Linux machine running containers, and has external interface support. Let's add the segments to the appropriate VM:

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcDFOPsdt8QwmoJpmCrq21PPglBNimfkfCYItOzXodEDRuvbHaKY4QC6wMBKnNq5my78nI4SybqWSD_w2R4vyE5OfAzbW6BlrgHr635vgTydLy_X6nJXdr-EPKnkul7-k1Iz2QyOn4kxygB2ebnahuRWm7qn-NF0K60Tcz1yTZshYgZaPGirsVwOBV/w676-h581/2022-04-29%2010_56_41-vSphere%20-%20cml.lab.engyak.net%20-%20Summary%20%E2%80%94%20Mozilla%20Firefox.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcDFOPsdt8QwmoJpmCrq21PPglBNimfkfCYItOzXodEDRuvbHaKY4QC6wMBKnNq5my78nI4SybqWSD_w2R4vyE5OfAzbW6BlrgHr635vgTydLy_X6nJXdr-EPKnkul7-k1Iz2QyOn4kxygB2ebnahuRWm7qn-NF0K60Tcz1yTZshYgZaPGirsVwOBV/s846/2022-04-29%2010_56_41-vSphere%20-%20cml.lab.engyak.net%20-%20Summary%20%E2%80%94%20Mozilla%20Firefox.png)

CML provides a Cockpit UI to make this easy, but the usual suspects exist to create a Linux bridge. We're going to create both segments as bridge adapters:

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy7CCChK4vPTIic_DRXp1EQgtMk-bBQvz5q29cJMdcbSXZbMbWTozM62E6k_paGBdsZu7fvbG145RXau95zan0eI9KnjFxktgMmR4SFjKa5F4NZOMwH30hBuiJUy8CJWFKPeV5CK8BLZaP8B0R4N1PIa2RCgDaTjHealW1YQ0OBj10KGRkLvtQu02A/w805-h475/2022-04-29%2011_40_52-Networking%20-%20cml-controller%20%E2%80%94%20Mozilla%20Firefox.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy7CCChK4vPTIic_DRXp1EQgtMk-bBQvz5q29cJMdcbSXZbMbWTozM62E6k_paGBdsZu7fvbG145RXau95zan0eI9KnjFxktgMmR4SFjKa5F4NZOMwH30hBuiJUy8CJWFKPeV5CK8BLZaP8B0R4N1PIa2RCgDaTjHealW1YQ0OBj10KGRkLvtQu02A/s1199/2022-04-29%2011_40_52-Networking%20-%20cml-controller%20%E2%80%94%20Mozilla%20Firefox.png)

A word of warning - this is a **Linux Software Bridge** , and will copy everything flowing through the port. NSX helps by squelching a significant chunk of the "network storms" that result, but I would recommend not putting it on the same NSX manager or hosts as your production environments.

### Leveraging CML connectivity in a Lab

The hard part's done! To consume this new network, add a node of type **External Connector** , and configure it to leverage the bridge we just created:

[![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMwn-pgQ5KeffGr7z6pnPhQg4WDrsv5umCbJ5epdvxdgKgANg0syyN5AMKRYl0cPI_KQELPU5IWxrCMwZMCNZ6W-yRqxmshuVZvaO_iaUW9c5pFo9zAS8S8_a3YPEvqu8ICRu7X-G-_ywqCjQ57_Os3ZkNYlLOBDYPIg2AubQNiG4iPKme9ieczIxI/s1600/2022-04-29%2016_52_29-Router%20to%20Outside%20Lab%20__%20CML%C2%B2%20%E2%80%94%20Mozilla%20Firefox.png)](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMwn-pgQ5KeffGr7z6pnPhQg4WDrsv5umCbJ5epdvxdgKgANg0syyN5AMKRYl0cPI_KQELPU5IWxrCMwZMCNZ6W-yRqxmshuVZvaO_iaUW9c5pFo9zAS8S8_a3YPEvqu8ICRu7X-G-_ywqCjQ57_Os3ZkNYlLOBDYPIg2AubQNiG4iPKme9ieczIxI/s256/2022-04-29%2016_52_29-Router%20to%20Outside%20Lab%20__%20CML%C2%B2%20%E2%80%94%20Mozilla%20Firefox.png)

The next step would be to deploy resources and configure them to connect to this central point - I'd recommend this approach to make nodes reachable via their management interface, i.e. deploy a management VRF and connect all nodes to it for stuff like Ansible testing. CML has an API, so the end goal here would be to spin up a test topology and test code against it, or to build a mini service provider.

### Lessons Learned

This is a network lab, and we're taking some of the guardrails off when building something this free-form. NSX does allow an engineer to do so on a **per-segment basis** , and insulates the "outside" network from any weird stuff you intend to do. The inherent dangers to spamming BPDUs outwards from a host or packet flooding can be contained with the built-in feature "segment security profiles", indicating that VMware had clear intent to support similar use-cases in the future.

NSX also enables a few other functions if in routed mode with a Tier-1. It's trivial to set up NAT policies, redistribute routes as Tier-1 statics, to control export of any internal connectivity you may or may not want touching the "real network".

I do think that this combination is a really impressive one-two punch for supporting enterprise deployments. If you ask anyone but Cisco, a typical enterprise network environment will involve many different network vendors, and having the flexibility to mix and match in a "testing environment" is a luxury that most infrastructure engineers don't have, but should.

### CML Scenario

Here's the CML scenario I deployed to test this functionality:

<script src="https://gist.github.com/ngschmidt/7fbf2c687bcf23460456931c8ca5cf29.js"></script>