vagrant netmask config /32 only


Hi, is it possible to configure the VX swp interface subnet mask using a vagrantfile?
The following results in a /32 mask regardless of netmask statement:
config.vm.define "c2" do |c2|   c2.vm.box = "cumulus-vx-2.5.3"   c2.vm.network :private_network, ip: "192.168.33.11", netmask: "255.255.255.0"  vagrant@cumulus:~$ ifconfig | grep -A 1 swp1  swp1      Link encap:Ethernet  HWaddr 08:00:27:68:9b:35            inet addr:192.168.33.11  Bcast:0.0.0.0  Mask:255.255.255.255  
Any ideas?
Virtualbox: 4.3.30
Vagrant: 1.7.4
Wins7

3 replies

Userlevel 1
Yes, although it's slightly different to your example. Cumulus Linux uses ifupdown2 to configure the network interfaces, which understands CIDR ranges. So instead of using the "network" parameter, just set the IP & CIDR range together like so:
c2.vm.network :private_network, ip: "192.168.33.11/24"
Kristian Van Der Vliet wrote:

Yes, although it's slightly different to your example. Cumulus Linux uses ifupdown2 to configure ...

Great stuff, that is what I was looking for. Many thanks.
Hi Kristian,
I am trying to assign IP address to SWP1 in a multi-vm vagrant environment. Somehow after trying all possible options in my mind its not working.. Below is my config: (Please ignore indenting as it messed up when I pasted the text from the vagrantfile here)

the cumulus__intname: parameter is from this link:
https://github.com/CumulusNetworks/cumulus-vx-vagrant/blob/master/vagrant/demos/ccw-2s/Vagrantfile

however even if I don't use it, and leave very simple line such as:
spine111.vm.network 'private_network', virtualbox__intnet: "netmgmt", ip: "10.0.0.2/24", auto_config: false

It isn't still working....
when I do ifquery -a it shows eth1 or swp1 with an IP but with a ifreload or restarting the service nothing works....

any idea what am I doing wrong here? I just need one port with IP for OOB management to provision through ansible.

any help will be appreciated.

Thanks

==================

My vagrant config.vm config.

config.vm.define "spine111" do |spine111|
spine111.vm.box = "cumulus-vx-2.5.3"
spine111.vm.hostname = "Spine-111"

spine111.vm.provider "virtualbox" do |vbox|
vbox.customize ["modifyvm", :id, "--macaddress2", "000000000002"]
end

# Internal network for switchports interfaces.

spine111.vm.network 'private_network', virtualbox__intnet: "netmgmt", ip: "10.0.0.2/24", cumulus__intname: 'eth1', auto_config: false
spine111.vm.network "private_network", virtualbox__intnet: "S111L131P1P1", cumulus__intname: "swp2"
spine111.vm.network "private_network", virtualbox__intnet: "S111L132P2P1", cumulus__intname: "swp3"
spine111.vm.network "private_network", virtualbox__intnet: "S111L141P3P3", cumulus__intname: "swp4"
spine111.vm.network "private_network", virtualbox__intnet: "S111L142P4P3", cumulus__intname: "swp5"
spine111.vm.network "private_network", virtualbox__intnet: "S111S112P5P5_CLAG", cumulus__intname: "swp6"
spine111.vm.network "private_network", virtualbox__intnet: "S111S112P6P6_CLAG", cumulus__intname: "swp7"

Reply