
Parfois et pour diverses raisons, il est nécessaire de configurer le VLAN directement au niveau de notre cluster Nutanix, notamment pour assurer la segmentation du réseau.
Cas d’usage
Ayant eu un peu de temps pour moi durant les vacances de Noel, je me suis attelé à la reprise de la configuration de mon réseau local afin d’isoler mon lab Nutanix de mon réseau interne.
Pour cela, il a fallu avant que je reconfigure mes équipements Ubiquiti afin de :
- créer le VLAN 84 au niveau de la Dream Machine Pro
- propager le VLAN 84 sur le switch 24 ports puis sur le switch 5 ports sur lequel est branché le cluster
Changement du VLAN sur AHV
Avant d’entamer les modifications, je commence par vérifier la configuration réseau de mon hôte :
[root@NTNX-5e8f7308-A ~]# ovs-vsctl list port br0
_uuid : b76f885d-59b2-4153-99d3-27605a729ab8
bond_active_slave : []
bond_downdelay : 0
bond_fake_iface : false
bond_mode : []
bond_updelay : 0
cvlans : []
external_ids : {}
fake_bridge : false
interfaces : [17e8b0de-2ef5-4f6f-b253-94a766ec9603]
lacp : []
mac : []
name : br0
other_config : {}
protected : false
qos : []
rstp_statistics : {}
rstp_status : {}
statistics : {}
status : {}
tag : 0
trunks : []
vlan_mode : []
Le résultat de la commande nous montre qu’il n’y a pas de tag sur mon hôte. Nous allons y remédier avec la commande suivante :
[root@NTNX-5e8f7308-A ~]# ovs-vsctl set port br0 tag=84
La commande « ovs-vsctl set port br0 tag= » permet de taguer l’interface de mon hôte avec l’ID du VLAN que j’ai dédié à mon réseau Nutanix. On vérifie ensuite l’application de la configuration :
[root@NTNX-5e8f7308-A ~]# ovs-vsctl show
Bridge br0
Port vnet4
tag: 0
Interface vnet4
Port br0-up
Interface eth4
Interface eth0
Interface eth5
Interface eth2
Interface eth1
Interface eth3
Port br0.u
Interface br0.u
type: patch
options: {peer=br.dmx.d.br0}
Port br0
tag: 84
Interface br0
type: internal
Port br0-dhcp
Interface br0-dhcp
type: vxlan
options: {key="1", remote_ip="192.168.84.200"}
Port br0-arp
Interface br0-arp
type: vxlan
options: {key="1", remote_ip="192.168.5.2"}
Port vnet2
Interface vnet2
ovs_version: "2.14.8"
On peut maintenant constater que le VLAN est configuré sur mon hôte, il faut maintenant faire la configuration coté CVM…
Configuration du VLAN sur la CVM
On commence par vérifier la configuration réseau de notre CVM :
[root@NTNX-5e8f7308-A ~]# ovs-vsctl show
Bridge br0
Port br0-up
Interface eth4
Interface eth0
Interface eth5
Interface eth2
Interface eth1
Interface eth3
Port br0-arp
Interface br0-arp
type: vxlan
options: {key="1", remote_ip="192.168.5.2"}
Port br0.u
Interface br0.u
type: patch
options: {peer=br.dmx.d.br0}
Port vnet5
Interface vnet5
Port br0
tag: 84
Interface br0
type: internal
Port br0-dhcp
Interface br0-dhcp
type: vxlan
options: {key="1", remote_ip="192.168.84.200"}
Port vnet2
Interface vnet2
ovs_version: "2.14.8"
On peut constater ici que mon interface réseau ne comporte aucune information de vlan. Je procède donc à la configuration du VLAN ID en me connectant à ma CVM puis en tapant la commande
change_cvm_vlan VLANID
nutanix@NTNX-5e8f7308-A-CVM:192.168.84.200:~$ change_cvm_vlan 84
This operation will perform a network restart. Please enter [y/yes] to proceed or any other key to cancel: y
Changing vlan tag to 84
Replacing external NIC in CVM, old XML:
<interface type="bridge">
<mac address="52:54:00:8e:69:bc" />
<source bridge="br0" />
<virtualport type="openvswitch">
<parameters interfaceid="356e3bf3-5700-4131-b1b2-4fa65195a6e2" />
</virtualport>
<target dev="vnet0" />
<model type="virtio" />
<driver name="vhost" queues="4" />
<alias name="ua-1decc31c-2764-416a-b509-d54ecd1a684f" />
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" />
</interface>
new XML:
<interface type="bridge">
<mac address="52:54:00:8e:69:bc" />
<model type="virtio" />
<driver name="vhost" queues="4" />
<address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" />
<source bridge="br0" /><virtualport type="openvswitch" /><vlan><tag id="84" /></vlan></interface>
CVM external NIC successfully updated.
Performing a network restart
On contrôle maintenant la configuration réseau de la CVM pour vérifier que le tag a bien été configuré :
[root@NTNX-5e8f7308-A ~]# ovs-vsctl show
Bridge br0
Port br0-up
Interface eth4
Interface eth0
Interface eth5
Interface eth2
Interface eth1
Interface eth3
Port br0-arp
Interface br0-arp
type: vxlan
options: {key="1", remote_ip="192.168.5.2"}
Port br0.u
Interface br0.u
type: patch
options: {peer=br.dmx.d.br0}
Port vnet5
tag: 84
Interface vnet5
Port br0
tag: 84
Interface br0
type: internal
Port br0-dhcp
Interface br0-dhcp
type: vxlan
options: {key="1", remote_ip="192.168.84.200"}
Port vnet2
Interface vnet2
ovs_version: "2.14.8"
Ma CVM est dorénavant sur le VLAN 84. Il ne me reste plus qu’à reproduire ces manipulations sur l’ensemble de mes noeuds et de vérifier ensuite que tout fonctionne correctement.
ATTENTION : la commande change_cvm_vlan présente un bug connu en 6.8 avec AHV 20230302.100173 qui fait que le VLAN ID n’est pas préservé lors du redémarrage de l’hôte : https://portal.nutanix.com/page/documents/kbs/details?targetId=kA0VO0000002uJ30AI







