force vm to use eth1 as the public_network

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

force vm to use eth1 as the public_network

ask stack
Most the time "vagrant up" will use eth0 as its dhcp interface and eth1 as the public interface. But often it will switches the two interfaces.
How do I ensure vm's eth1 as the public_network.
Thanks!


#host environment.
centos6, kvm/libvirt, bridged interface br0,

#Vagrantfile network section
config.vm.network :public_network, :bridge => 'br0', :device => "eth1", :mac => "52:54:00:25:01:1B"

#VM setup
I emptied /etc/udev/rules.d/70-persistent-net.rules

[root@cn20 network-scripts]# cat ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
NM_CONTROLLED="no"
ONBOOT="yes"the
TYPE="Ethernet"
[root@cn20 network-scripts]# cat ifcfg-eth1
DEVICE="eth1"
BOOTPROTO="static"
BROADCAST="172.20.255.255"
DNS1="172.20.2.1"
GATEWAY="172.20.0.250"
IPADDR="172.20.2.21"
NETMASK="255.255.0.0"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
[root@cn20 network-scripts]#

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

force vm to use eth1 as the public_network

VMTrooper
Your first Vagrant network definition should always be eth1. If you are seeing that Vagrant is using eth1 as it's dhcp interface for its own VM configuration work instead of eth0, that is a bug that should be reported on the project's GitHub page.

Does this behavior happen with all your Vagrantfiles? Or just specific ones?

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: force vm to use eth1 as the public_network

ask stack

Trevor
Please take a look of vagrantfile. If you don't see anything wrong with it, I will report it as a bug. 
I do not have any other VMs/vagrantfile to test.
Thanks.


centos 6.4, vagrant-1.3.5-1.x86_64, libvirt 0.10.2, QEMU 0.10.2
###
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "testvm5"
  config.vm.box_url = "/var/lib/libvirt/images/testvm1.box"
 
    config.vm.define :vm1 do |vm1|
vm1.vm.network :public_network, :bridge => 'br0', :device => "eth1", :mac => "52:54:00:25:01:1B"
    end
    config.vm.define :vm2 do |vm2|
vm2.vm.network :public_network, :bridge => 'br0', :device => "eth1", :mac => "52:54:00:25:02:1B"
    end
  config.vm.provider :libvirt do |libvirt|
    libvirt.driver = "qemu"
    libvirt.host = "localhost"
    libvirt.connect_via_ssh = true
    libvirt.username = "root"
    libvirt.storage_pool_name = "default"
    libvirt.memory = 2048
    libvirt.cpus = 2
  end
config.vm.synced_folder ".", "/vagrant", disabled: true
end
###

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: force vm to use eth1 as the public_network

ask stack
I build a barebone VM and did not have ssh-utils installed. after I installed that rpm, vagrant was able to reconfigure network interfaces.
thanks all.

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.