Multiple NICs with VLAN-aware Switch

In this best practice guide on how to configure “VLAN-aware”, we will introduce Harvester VLAN network and external switch configuration for common scenario.

Architecture

Hardware:

  • Three Harvester servers with daul ports network card.
  • One or more VLAN-aware switch(es). We will use “Cisco like” configuration as example.

Network Specification:

  • Assume that the subnet of the Harvester hosts is in VLAN 100.
  • Assume that the VMs are in the VLAN 101-200.

Cabling:

  • The Harvester servers are connected to the switch in a port from 1 to 6.

The following diagram illustrates the cabling used for this guide:

mulitple-nics-vlan-aware.png

External Switch Configuration

For the external switch configuration, we’ll use a “Cisco-like” configuration as an example. You can apply the following configurations to your switch:

For harvester-mgmt ports:

  1. switch# config terminal
  2. switch(config)# interface ethernet1/<Port Number>
  3. switch(config-if)# switchport
  4. switch(config-if)# switchport mode access
  5. switch(config-if)# switchport access 100
  6. switch(config-if)# no shutdown
  7. switch(config-if)# end
  8. switch# copy running-config startup-config

Multiple NICs with VLAN-aware Switch - 图2note

In this case, you need to avoid using harvester-mgmt as the VLAN Network interface. This setting will only allow the traffic in the same subnet of harvester-mgmt and disallow other VLAN traffic.

For VLAN network ports:

  1. switch# config terminal
  2. switch(config)# interface ethernet1/<Port Number>
  3. switch(config-if)# switchport
  4. switch(config-if)# switchport mode trunk
  5. switch(config-if)# switchport trunk allowed vlan 100-200
  6. switch(config-if)# switchport trunk native vlan 1
  7. switch(config-if)# no shutdown
  8. switch(config-if)# end
  9. switch# copy running-config startup-config

Multiple NICs with VLAN-aware Switch - 图3note

We use the VLAN Trunk setup to set up the network ports for the VLAN Network. In this case, you can simply set VLAN 100 for the VMs in the Harvester VLAN network to connect to the same subnet of harvester-mgmt.

Create a VLAN Network in Harvester

You can create a new VLAN network in the Advanced > Networks page, and click the Create button.

Specify the name and a VLAN ID that you want to create for the VLAN network (You can specify the same VLAN ID in different namespaces if you have Rancher multi-tenancy configured).

create-vlan-network.png

Connect a VM to the subnet of the Harvester hosts

Once you finished the configuration in the previous section, the external switch will send out untagged network traffic to the subnet of the Harvester hosts. In Harvester, the untagged traffic is received in VLAN 1.

Therefore, if you need VMs to connect to the VLAN ID 1, you need to create a VLAN ID 1 Network in Harvester also.

Multiple NICs with VLAN-aware Switch - 图5note

We strongly recommend against using VLAN 1 in this scenario.

Connect a VM to specific VLAN network

You need to create a VLAN network with a specific VLAN ID and associate the VM with that VLAN network.

Please refer to this page for additional information on Harvester Networking.