Creating and deleting virtual networks is done automatically by the HMC. As soon as a virtual Ethernet adapter with a new VLAN ID is created, the HMC generates the corresponding vnetwork with a standard name. When the last virtual Ethernet adapter for a VLAN is deleted, the HMC automatically deletes the associated vnetwork. But virtual networks can also be created and deleted manually.
First, let’s take a look at the existing vnetworks on the managed system ms09:
$ ms lsvnetwork ms09 NAME VNETWORK VSWITCH TAGGED VLAN_ID ms09 VLAN725-ETHPROD ETHPROD 1 725 ms09 VLAN1410-ETHPROD ETHPROD 1 1410 ms09 VLAN1411-ETHPROD ETHPROD 1 1411 ms09 VLAN16-ETHPROD ETHPROD 0 16 ms09 VLAN15-ETHERNET0 ETHERNET0 0 15 ms09 VLAN14-ETHERNET0 ETHERNET0 0 14 ms09 VLAN1406-ETHERNET0 ETHERNET0 1 1406 ms09 Mgmt-AIX ETHERNET0 0 815 $
We want to create a new virtual Ethernet adapter for a new VLAN for the LPAR lpar1. We look briefly which virtual slot numbers are still available:
$ lpar lsvslot lpar1 SLOT REQ ADAPTER_TYPE STATE DATA 0 Yes serial/server 0 remote: (any)/any connect_status=unavailable hmc=1 1 Yes serial/server 0 remote: (any)/any connect_status=unavailable hmc=1 2 No eth 0 PVID=815 VLANS= ETHERNET0 XXXXXXXXXXXX 5 No fc/client 0 remote: ms09-vio1(1)/20 c050760XXXXX00c2,c050760XXXXX00c3 $
The new virtual Ethernet adapter is to use slot 3 and VLAN ID 777:
$ lpar addeth lpar1 3 777 $
A quick check confirms that the HMC has created a vnetwork with the default name for the new VLAN 777:
$ ms lsvnetwork ms09 NAME VNETWORK VSWITCH TAGGED VLAN_ID ms09 VLAN725-ETHPROD ETHPROD 1 725 ms09 VLAN1410-ETHPROD ETHPROD 1 1410 ms09 VLAN1411-ETHPROD ETHPROD 1 1411 ms09 VLAN16-ETHPROD ETHPROD 0 16 ms09 VLAN15-ETHERNET0 ETHERNET0 0 15 ms09 VLAN14-ETHERNET0 ETHERNET0 0 14 ms09 VLAN1406-ETHERNET0 ETHERNET0 1 1406 ms09 Mgmt-AIX ETHERNET0 0 815 ms09 VLAN777-ETHERNET0 ETHERNET0 1 777 $
We try to delete the new vnetwork:
$ ms rmvnetwork ms09 VLAN777-ETHERNET0 hmc01: chhwres -r virtualio --rsubtype vnetwork -m ms09 -o r --vnetwork VLAN777-ETHERNET0 ERROR: remote HMC command returned an error (1) StdErr: HSCL368A This virtual network cannot be deleted because there are partitions configured to use this virtual network. $
The attempt fails, because the virtual network is currently configured. That’s good! So you can not manually delete virtual networks that are still needed.
It is possible to create your own virtual networks. We briefly show this by creating a vnetwork named my_test_net for VLAN ID 778 (Virtual switch is again ETHERNET0):
$ ms addvnetwork ms09 my_test_net 778 ETHERNET0 $
(On the HMC-CLI the command is: chhwres -r virtualio –rsubtype vnetwork -m ms09 -o a –vnetwork my_test_net -a is_tagged=1,vlan_id=778,vswitch=ETHERNET0)
The new vnetwork is visible immediately:
$ ms lsvnetwork ms09 NAME VNETWORK VSWITCH TAGGED VLAN_ID ms09 VLAN725-ETHPROD ETHPROD 1 725 ms09 VLAN1410-ETHPROD ETHPROD 1 1410 ms09 VLAN1411-ETHPROD ETHPROD 1 1411 ms09 VLAN16-ETHPROD ETHPROD 0 16 ms09 VLAN15-ETHERNET0 ETHERNET0 0 15 ms09 VLAN14-ETHERNET0 ETHERNET0 0 14 ms09 VLAN1406-ETHERNET0 ETHERNET0 1 1406 ms09 Mgmt-AIX ETHERNET0 0 815 ms09 VLAN777-ETHERNET0 ETHERNET0 1 777 ms09 my_test_net ETHERNET0 1 778 $
As long as the new vnetwork is not used, it can be deleted at any time:
$ ms rmvnetwork ms09 my_test_net $
(The corresponding command on the HMC is: chhwres -r virtualio –rsubtype vnetwork -m ms09 -o r –vnetwork my_test_net)
Finally, we remove the virtual adapter in slot 3 of lpar1 again:
$ lpar rmeth lpar1 3 $
Since the associated vnetwork for the VLAN 777 is nowhere configured anymore, the vnetwork VLAN777-ETHERNET0 is automatically deleted by the HMC:
$ ms lsvnetwork ms09 NAME VNETWORK VSWITCH TAGGED VLAN_ID ms09 VLAN725-ETHPROD ETHPROD 1 725 ms09 VLAN1410-ETHPROD ETHPROD 1 1410 ms09 VLAN1411-ETHPROD ETHPROD 1 1411 ms09 VLAN16-ETHPROD ETHPROD 0 16 ms09 VLAN15-ETHERNET0 ETHERNET0 0 15 ms09 VLAN14-ETHERNET0 ETHERNET0 0 14 ms09 VLAN1406-ETHERNET0 ETHERNET0 1 1406 ms09 Mgmt-AIX ETHERNET0 0 815 $