Closed bings closed 10 years ago
Please check if there is a file called /etc/udev/rules.d/70-persistent-net.rule
if there is any, delete it, if there is none, check /etc/udev/rules.d/ for a similar file persistent net and reboot.
in Redhat 6 at boot moment, that file is created that have hardcoded the interfaces and cause issues, so not sure in SL.
Alvaro.
On Fri, Jan 10, 2014 at 11:16 PM, bings notifications@github.com wrote:
Hi,
I'm running vagrant 1.4.2, VirtualBox 4.3.6 and Scientific Linux 6.4 as guest OS.
If I have defined multiple private networks
Create a private network, which allows host-only access to the machine
using a specific IP.
config.vm.network :private_network, ip: "192.168.50.4", virtualbox__intnet: "mynetwork" config.vm.network :private_network, ip: "33.33.33.33"
this results in two add. adapters create in VB, and the following config files in /etc/sysconfig/network-scripts
ifcfg-eth1:
VAGRANT-BEGIN
The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=no BOOTPROTO=none ONBOOT=yes IPADDR=192.168.50.4 NETMASK=255.255.255.0 DEVICE=eth1 PEERDNS=no
VAGRANT-END
ifcfg-eth2:
VAGRANT-BEGIN
The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=no BOOTPROTO=none ONBOOT=yes IPADDR=33.33.33.33 NETMASK=255.255.255.0 DEVICE=eth2 PEERDNS=no
VAGRANT-END
Obviously these configs are missing the hardware mac address, therefore the same IP address is assigned to both interfaces:
[root@localhost network-scripts]# ifconfig -a eth0 Link encap:Ethernet HWaddr 08:00:27:36:2E:AC inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe36:2eac/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:376035 errors:0 dropped:0 overruns:0 frame:0 TX packets:161184 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:475172385 (453.1 MiB) TX bytes:11116388 (10.6 MiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:C3:4C:3A inet addr:192.168.50.4 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fec3:4c3a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:27 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:6938 (6.7 KiB)
eth2 Link encap:Ethernet HWaddr 08:00:27:90:2B:49 inet addr:192.168.50.4 Bcast:192.168.50.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe90:2b49/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:810 errors:0 dropped:0 overruns:0 frame:0 TX packets:30 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:74386 (72.6 KiB) TX bytes:7720 (7.5 KiB)
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798 .
Thanks for your info, I tried it but unfortunately after reboot the problem still exists.
I did download a SL 6 from vagrantboxes.es and did work, are you on the latest vagrant?
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ vagrant ssh Last login: Wed Sep 19 12:08:50 2012 from 10.0.2.2 [vagrant@localhost ~]$ ifconfig | grep -i addr eth0 Link encap:Ethernet HWaddr 08:00:27:9C:C5:F7 inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe9c:c5f7/64 Scope:Link eth1 Link encap:Ethernet HWaddr 08:00:27:8D:08:B8 inet addr:192.168.56.65 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe8d:8b8/64 Scope:Link eth2 Link encap:Ethernet HWaddr 08:00:27:EC:FE:85 inet addr:192.168.66.65 Bcast:192.168.66.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feec:fe85/64 Scope:Link eth3 Link encap:Ethernet HWaddr 08:00:27:A4:8D:DE inet addr:192.168.76.65 Bcast:192.168.76.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fea4:8dde/64 Scope:Link inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host [vagrant@localhost ~]$ logout Connection to 127.0.0.1 closed.
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ vagrant -v Vagrant 1.4.3
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ grep -i network Vagrantfile
config.vm.network :private_network, ip: "192.168.56.65" config.vm.network :private_network, ip: "192.168.66.65" config.vm.network :private_network, ip: "192.168.76.65", virtualbox__intnet: "mynetwork"
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $
Hi Alvaro,
thanks for looking into this.
I'm on 1.4.2. your suggested change worked out for me, even as 1.4.2 already had an error check in it. So I change
machine.communicate.sudo(
"/sbin/ifdown eth#{network[:interface]} 2> /dev/null", error_check: false)
to
machine.communicate.sudo(
"/sbin/ifconfig eth#{network[:interface]} down 2> /dev/null", error_check: false)
and it works now for me... so it makes sense to bring in that change.
Thanks!
yes, however, the version 1.4.3 include already a fix, so when you have time, you can upgrade and that will be the best.
so no need to Pull Request here, just upgrade on your end.
Alvaro.
On Sun, Jan 12, 2014 at 9:33 PM, bings notifications@github.com wrote:
Hi Alvaro,
thanks for looking into this.
I'm on 1.4.2. your suggested change worked out for me, even as 1.4.2 already had an error check in it. So I change
machine.communicate.sudo( "/sbin/ifdown eth#{network[:interface]} 2> /dev/null", error_check: false)
to
machine.communicate.sudo( "/sbin/ifconfig eth#{network[:interface]} down 2> /dev/null", error_check: false)
and it works now for me... so it makes sense to bring in that change.
Thanks!
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798#issuecomment-32117861 .
Hi,
now tested with 1.4.3 and a new basebox built with packer 0.51 - still having issues... seems not to work reliable...
Hi, thats what I found in the RedHat documentation:
HWADDR=MAC-address where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction with MACADDR.
So I think the configuration written by vagrant should include HWADDR to assign to correct device names. What do you think?
I did un-install vagrant, and delete all the files/directories just in case.
Started with a fresh vagrant 1.4.3 install, and it's working.
(output at the end)
Can you please download the same SL6 vagrant box that I am using?
http://lyte.id.au/vagrant/sl6-64-lyte.box
For the packer json file, this is the shell part I use to create Oracle Linux boxes with Vagrant SSH
please, check the last few lines, as I delete the HWMAC from the source files and delete the udev net if exits.
(I copy the virtualbox additions, and then install it, as I do updates and kernel updates after the OS is installed)
"provisioners" : [{ "type": "shell", "executecommand": "sh '{{ .Path }}'", "inline": [ "mkdir -p /media/dvd", "mount -o loop VBoxGuestAdditions.iso /media/dvd", "sh /media/dvd/VBoxLinuxAdditions.run --nox11", "umount /media/dvd", "rm VBoxGuestAdditions_.iso", "useradd vagrant", "cp /etc/sudoers /etc/sudoers.orig", "sed -i -e 's/Defaults\s_requiretty$/#Defaults\trequiretty/' /etc/sudoers", "sed -i -e '/# %wheel\tALL=(ALL)\tNOPASSWD: ALL/a %vagrant\tALL=(ALL)\tNOPASSWD: ALL' /etc/sudoers", "mkdir ~vagrant/.ssh", "chmod 700 ~vagrant/.ssh", "echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgC gzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAm CP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key' > ~ vagrant/.ssh/authorized_keys", "chmod 600 ~vagrant/.ssh/authorized_keys", "chown -R vagrant: ~vagrant/.ssh", "cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ori", "sed -i -e '/#UseDNS yes/a UseDNS no' /etc/ssh/sshdconfig", "for nic in /etc/sysconfig/network-scripts/ifcfg-eth; do sed -i /HWADDR/d $nic; done", "rm /etc/udev/rules.d/70-persistent-net.rules" ] },
The ssh key need to be in one line.
This is the output after i did delete and reinstall vagrant AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ vagrant destroy [default] VM not created. Moving on...
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Importing base box 'sl6'... [default] Matching MAC address for NAT networking... [default] Clearing any previously set forwarded ports... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] Running 'pre-boot' VM customizations... [default] Booting VM... [default] Waiting for machine to boot. This may take a few minutes... DL is deprecated, please use Fiddle [default] Machine booted and ready! [default] The guest additions on this VM do not match the installed version of VirtualBox! In most cases this is fine, but in rare cases it can prevent things such as shared folders from working properly. If you see shared folder errors, please make sure the guest additions within the virtual machine match the version of VirtualBox you have installed on your host and reload your VM.
Guest Additions Version: 4.1.12
VirtualBox Version: 4.3
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /media/sf_stagefiles
[default] VM already provisioned. Run vagrant provision
or use
--provision
to force it
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ vagrant ssh Last login: Wed Sep 19 12:08:50 2012 from 10.0.2.2 [vagrant@localhost ~]$ ifconfig | grep -i addr eth0 Link encap:Ethernet HWaddr 08:00:27:9C:C5:F7 inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe9c:c5f7/64 Scope:Link eth1 Link encap:Ethernet HWaddr 08:00:27:FC:70:3A inet addr:192.168.56.65 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fefc:703a/64 Scope:Link eth2 Link encap:Ethernet HWaddr 08:00:27:0C:8A:30 inet addr:192.168.66.65 Bcast:192.168.66.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe0c:8a30/64 Scope:Link eth3 Link encap:Ethernet HWaddr 08:00:27:E6:1B:4D inet addr:192.168.76.65 Bcast:192.168.76.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fee6:1b4d/64 Scope:Link inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host [vagrant@localhost ~]$ logout Connection to 127.0.0.1 closed.
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/sl6 $ vagrant -v Vagrant 1.4.3
On Mon, Jan 13, 2014 at 10:00 PM, bings notifications@github.com wrote:
Hi,
now tested with 1.4.3 and a new basebox built with packer 0.51 - still having issues... seems not to work reliable...
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798#issuecomment-32153071 .
The answer to the HWADDR question is.
You don't need that as Virtualbox or the hypervisor will set the nics in order, so always will be the
first physical nic -> eth0 second physical nic -> eth1 , etc..
That problem happen on real server when say you have 2 nics on board, 2 nics on a pci card, 2 more in a second card.. how do you will know which one is eth0? and which one will be eth1? so map the port with cable and the logical name ethN is a mess..
On Wed, Jan 15, 2014 at 5:51 AM, bings notifications@github.com wrote:
Hi, thats what I found in the RedHat documentation:
HWADDR=MAC-address where MAC-address is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:FF. This directive must be used in machines containing more than one NIC to ensure that the interfaces are assigned the correct device names regardless of the configured load order for each NIC's module. This directive should not be used in conjunction with MACADDR.
So I think the configuration written by vagrant should include HWADDR to assign to correct device names. What do you think?
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798#issuecomment-32282734 .
Sorry for being late with my comment, but exactly this happens. without HWADDR at some time suddenly the IP address "jumps" from one adapter to the other. This happens only on a box that includes and runs an Desktop, I haven't seen that yet with a gui-less box...
What are you using for virtualization?
That should not happen in a virtual guest, as that's an issue more likely to happen in a physical server where you won't know what nic/port is eth0 and what wil be eth3 for example.
Alvaro
On Sat, Jan 18, 2014 at 12:36 AM, bings notifications@github.com wrote:
Sorry for being late with my comment, but exactly this happens. without HWADDR at some time suddenly the IP address "jumps" from one adapter to the other. This happens only on a box that includes and runs an Desktop, I haven't seen that yet with a gui-less box...
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798#issuecomment-32598930 .
Well, I can only say that it happens, unfortunately. As said, I'm using VirtualBox 4.3.6 with SL 6.4.
Hi, I have same problem, running with VirtualBox 4.3.6, Centos 6.5 and Vagrant 1.4.3
Extract from my Vagrantfile:
config.vm.network :private_network, ip: "10.10.3.11" # sy1
config.vm.network :private_network, ip: "10.10.3.21" # rtgov1
config.vm.network :private_network, ip: "10.10.3.31" # dtgov1
config.vm.network :private_network, ip: "10.10.3.41" # sramp1
config.vm.network :private_network, ip: "10.10.3.51" # db1
And this is an ifconfig
eth1 Link encap:Ethernet HWaddr 08:00:27:6A:16:35
inet addr:10.10.3.11 Bcast:10.10.3.255 Mask:255.255.255.0
eth2 Link encap:Ethernet HWaddr 08:00:27:24:DC:2E
inet addr:10.10.3.11 Bcast:10.10.3.255 Mask:255.255.255.0
eth3 Link encap:Ethernet HWaddr 08:00:27:90:C4:31
inet addr:10.10.3.11 Bcast:10.10.3.255 Mask:255.255.255.0
eth4 Link encap:Ethernet HWaddr 08:00:27:B3:14:96
inet addr:10.10.3.11 Bcast:10.10.3.255 Mask:255.255.255.0
eth5 Link encap:Ethernet HWaddr 08:00:27:65:64:66
inet addr:10.10.3.11 Bcast:10.10.3.255 Mask:255.255.255.0
As you can see, they have different HWaddr.
I have deleted de udev rules file.
I have added HWADDR manually to /etc/sysconfig/network-scripts/ifcfg-ethX and restarted network service and is working right, so it seems that HWADDR must be present.
eth0 Link encap:Ethernet HWaddr 08:00:27:F3:E3:03
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
eth1 Link encap:Ethernet HWaddr 08:00:27:6A:16:35
inet addr:10.10.3.11 Bcast:10.10.3.255 Mask:255.255.255.0
eth2 Link encap:Ethernet HWaddr 08:00:27:24:DC:2E
inet addr:10.10.3.21 Bcast:10.10.3.255 Mask:255.255.255.0
eth3 Link encap:Ethernet HWaddr 08:00:27:90:C4:31
inet addr:10.10.3.31 Bcast:10.10.3.255 Mask:255.255.255.0
eth4 Link encap:Ethernet HWaddr 08:00:27:B3:14:96
inet addr:10.10.3.41 Bcast:10.10.3.255 Mask:255.255.255.0
eth5 Link encap:Ethernet HWaddr 08:00:27:65:64:66
inet addr:10.10.3.51 Bcast:10.10.3.255 Mask:255.255.255.0
Question, Are all the nic the same in your VM ?
Can you share your Vagrantfile and centos box ?
i did a test with a centos 6.4, virtualbox 4.3.6 vagrant 1.4.3
the VM guest got created properly
The machine started without errors:
And the host got the proper IP
AlvaroM@ALVAROMW8LT /c/vagrant_laptop/centos-64-x64-vbox4219 $ vagrant ssh Last login: Wed Jan 22 20:14:55 2014 from 10.0.2.2 Welcome to your Vagrant-built virtual machine. [vagrant@localhost ~]$ ifconfig -a | grep -A1 eth eth0 Link encap:Ethernet HWaddr 08:00:27:F7:3D:84
eth1 Link encap:Ethernet HWaddr 08:00:27:34:27:78
eth2 Link encap:Ethernet HWaddr 08:00:27:F9:B2:D0
eth3 Link encap:Ethernet HWaddr 08:00:27:EB:C8:4C
eth4 Link encap:Ethernet HWaddr 08:00:27:94:67:7B
eth5 Link encap:Ethernet HWaddr 08:00:27:DD:6A:7A inet addr:10.10.3.51 Bcast:10.10.3.255 Mask:255.255.255.0 [vagrant@localhost ~]$
After a reboot, it's still good.
Yes,
I can share. Base box is created with packer. You can get it from https://github.com/jorgemoralespou/jboss-virtual-environments/tree/master/base-boxes/centos-6_5-64-jboss
Base box is centos-6.5-64-jboss.json
And Vagrant project is at:
https://github.com/jorgemoralespou/jboss-virtual-environments/tree/master/vagrant-vms/jboss-fsw-demo
Hope it helps
Can you please add this to your build ?
for nic in /etc/sysconfig/network-scripts/ifcfg-eth*; do sed -i /HWADDR/d $nic; done
rm /etc/udev/rules.d/70-persistent-net.rules
to be done before the .box machine is created?
I am trying to build one based on your json.. will report if I get luck..
Hi, today I've got a new situation, that NAT is not available anymore but eth0 uses the same IP as confgured for eth1 (see my comments opening this issue...) There is something really wrong... any ideas? My SL-6.4 machine has all the steps included @kikitux mentioned. If helpful, I can provide you the box.
eth0 Link encap:Ethernet HWaddr 08:00:27:F6:87:F7
inet addr:192.168.50.4 Bcast:192.168.50.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fef6:87f7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:51 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3590 (3.5 KiB) TX bytes:3042 (2.9 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:49:84:51
inet addr:192.168.50.4 Bcast:192.168.50.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe49:8451/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:111 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12148 (11.8 KiB) TX bytes:980 (980.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1088 (1.0 KiB) TX bytes:1088 (1.0 KiB)
I have removed udev rules and done the "sed" and same result. :-(
Share the box and I will have a look.
Alvaro On Jan 23, 2014 9:41 PM, "Jorge Morales Pou" notifications@github.com wrote:
I have removed udev rules and done the "sed" and same result. :-(
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798#issuecomment-33105878 .
I can't share the box, as it is 800MB, but I have updated my github repo (link in comment above), so the box can be rebuilt with packer.
was able to get the process running on ubuntu.. in windows i wasn't able to get due error on virtualbox-iso (??)
so, is now installing/running your scripts..
On Thu, Jan 23, 2014 at 10:42 PM, Jorge Morales Pou < notifications@github.com> wrote:
I can't share the box, as it is 800MB, but I have updated my github repo (link in comment above), so the box can be rebuilt with packer.
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/2798#issuecomment-33109292 .
Any news on this? Here seems to be the same issue: #2881
There is no work being done on this. For guest specific bugs (in this case scientific linux), we rely on community PRs to maintain stability. Can someone with experience please open a PR? Otherwise, closing this as "wontfix" since we likely won't ever get to this. sorry!
Hi,
I'm running vagrant 1.4.2, VirtualBox 4.3.6 and Scientific Linux 6.4 as guest OS.
If I have defined multiple private networks
this results in two add. adapters create in VB, and the following config files in /etc/sysconfig/network-scripts
ifcfg-eth1:
ifcfg-eth2:
Obviously these configs are missing the hardware mac address, therefore the same IP address is assigned to both interfaces: