How to add IP, MAC, VLAN to an existent VNET through the command line?

Hi,

I have created a new VNET, onevnet create esteban.net , where esteban.net file contains:

[oneadmin@opennebula4 ~]$ cat esteban.net 
NAME="testing"
DESCRIPTION="Internal network for project"
FILTER_MAC_SPOOFING="YES"
NETWORK_ADDRESS="10.50.8.0"
NETWORK_MASK="255.255.255.0"
PHYDEV=""
SECURITY_GROUPS="0"
BRIDGE="ovsbridge0"

And then I want to add an IP range, MAC and VLAN so I execute this command:

onevnet addar 55 --size 253 --mac 05:06:0b:65:00:01 --ip 10.50.8.1 --vlan --vlanid 1108

But when I see this VNET I see VLAN=“NO” and VLAN_ID="" :

 [oneadmin@opennebula4 ~]$  onevnet show 55
 [ ..... ]
 VLAN="NO"
 VLAN_ID=""

What am I doing wrong?

Thanks in advance,
Esteban

Hi,

I found another way to do it, I just need to create another file with the values that I need for VLAN and VLAN_ID, for example:

cat esteban.net2
VLAN="YES"
VLAN_ID="1108"

And then just add it with the onevnet update command:

 onevnet update 55 --append  esteban.net2

(!) It is necessary to add the --append option, otherwise, it will overwrite the current information for the vnet

In any case, I don’t know if the onevnet addar command should work as I indicated above:

 onevnet addar 55 --size 253 --mac 05:06:0b:65:00:01 --ip 10.50.8.1 --vlan --vlanid 1108

Therefore, I would appreciate if someone could check it and tell me if the command from above is not well executed or if there is a bug trying to add the vlanid with this command.

Thanks in advance,
Esteban

The command in your post works for me, the ar is ccreated with the correct
VLAN and VLAN_ID values… All the attributes of the AR can be checked with
onevm show -x 55…

Hi Ruben,

Thank you very much for your answer :smile:

In my case, it creates the IP and MAC range correctly but when I look for VLAN, I see VLAN=“NO” and VLAN_ID="" :

[oneadmin@opennebula4 ~]$  onevnet show 55
[ ..... ]
VLAN="NO"
VLAN_ID="" 

Do you also get updated the VLAN arguments following the steps described on my example?

I am using OpenNebula 4.12.1 version.

Thanks in advance,
Esteban

Those VLANs are from the VNET…

The final NIC attributes for a VM should follow this priority
1.- values in NIC in the VM template
2.- values in the AR
3.- values in VNET

so with the same VLAN=NO you can group AR’s with VLAN = YES. The rationale
behind this is to be able to use VNETs as super-networks grouping different
AR with different addresses, VLAN profiles etc…

Hi Ruben,

Thank you very much for the explanation about it! :smile:

Cheers,
Esteban