Score:0

Connecting Unifi Controller running in Docker on ESXi to default VLAN while isolating other containers and container host from default VLAN

in flag

I have an ESXi 6.7 host with 6 physical NICs. Those NICs are configured as follows:

vSwitch0: vSwitch0

vSwitch1: vSwitch1

The NICs assigned to vSwitch0 are physically connected to a Netgear switch who's ports are untagged for the specific VLAN that I wish to manage ESXi from.

The NICs assigned to vSwitch1 are physically connected to a Netgear switch who's ports are tagged with the VLANs that I want to make available to the virtual machines running in my ESXi host (VLANs 10 and 50). Presently, my virtual machines in my ESXi host are only configured to be on VLAN 10.

I have been experimenting with Docker lately, so I spun up a Ubuntu Server 22.04 virtual machine to run as my Docker host. I added a Unifi Controller container and have managed to adopt my access points into the controller by using the "set inform" command from within the access point's cli.

I am looking at expanding my Unifi network, and after doing some further research, I have realized that in order to streamline the device adoption process, I need to get my Unifi Controller onto my default VLAN. Here is where things start to get complicated for me....

In order for the container to access the default VLAN, I figured that I would need to first get my container host connected to the default VLAN. I attempted to achieve this by creating a new vSwitch (vSwitch2). The physical NIC associated with vSwitch2 is tied to the Netgear switch that is configured only for untagged traffic. I figured that isolating the untagged traffic to this specific VM via a dedicated vSwitch was safer than allowing all of my servers access to the default VLAN.

vSwitch2: vSwitch2

I then added a 2nd NIC to my Docker host. Docker image with 2 NICs

This 2nd NIC did not receive an IP address via DHCP. I thought that I may have had a switch configuration issue, so for testing purposes, I tried assigning the 2nd NIC to VLAN 10 and then to VLAN 50. To my surprise, it still did not receive an IP via DHCP. At this point, it is evident that the 2nd NIC not receiving an IP is a result of something being misconfigured within my Ubuntu Server VM. Before I go down the rabbit hole of making lots of configuration changes, I wanted to ask the following:

  1. If I want to use my Docker host for my Unifi Controller as well as other future containers, would it make sense to connect the host to two separate networks in this case?
  2. Is it possible to connect the Docker host to more than one network, but ensure the host is only accessible from only 1 of those networks? If so, how is this achieved?
  3. Does my docker host need to have an IP address on a network in order for the container to be accessed (assuming the container is configured for macvlan networking).
  4. Would it make sense for the Unifi Controller to be configured with macvlan networking?
  5. Was configuring a separate vSwitch (vSwitch2) the right choice for isolating the default VLAN?
  6. From a security standpoint, do I need to make architecture/network topology changes?
almdandi avatar
ru flag
Just leave everything as it was with one vSwitch and use [Layer 3 Adoption](https://help.ui.com/hc/en-us/articles/204909754-UniFi-Network-Layer-3-Adoption). You can either use a DHCP option that advertise the ip-address of the controller or use a dns entry thats point to the controller.
kubiej21 avatar
in flag
I didn't even realize that was an option. Makes perfect sense though. Thanks!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.