Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ifdown ethN before munging ifcfg-ethN #2450

Merged
merged 1 commit into from
Nov 23, 2013
Merged

Conversation

onejli
Copy link
Contributor

@onejli onejli commented Nov 2, 2013

This is a patch for issue #1577 (reported by @chorankates-sfdc)

If vagrant munges ifcfg-ethN by removing the previous vagrant config for the interface before calling ifdown, all boxes after the first may encounter an ip address collision as noted here. The simplest fix is to ensure that base boxes contain NO vagrant configured interfaces. However, a more generic solution is simply to call ifdown before munging ifcfg-ethN.

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.define :web do |web_config|
    web_config.vm.box = "rhel6_u2"
    web_config.vm.network "private_network", ip: "172.16.1.100"
    web_config.vm.provider :virtualbox do |vb|
      vb.customize ['modifyvm', :id, '--name', "web"]
    end
  end

  config.vm.define :db do |db_config|
    db_config.vm.box = "rhel6_u2"
    db_config.vm.network "private_network", ip: "172.16.1.101"
    db_config.vm.provider :virtualbox do |vb|
      vb.customize ['modifyvm', :id, '--name', "db"]
    end
  end
end

NOTE: I've intentionally left an ifcfg-eth1 file in my base box. It looks like this:

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
BOOTPROTO=static
IPADDR=192.168.1.161
NETMASK=255.255.255.0
DEVICE=eth1
#VAGRANT-END

Using commit a92e03cf4ce936243d3959b7b5603262a234a58d

As noted in my comments here and here, the first box to the upped retains the ip address as specified by my stray ifcfg-eth1 (even though an updated ifcfg-eth1 has been pushed by vagrant). The second box picks up the correct ip address as specified in the Vagrantfile.

$ VAGRANT_LOG=debug bundle exec bin/vagrant up web db

web

[web] Configuring and enabling network interfaces...
 INFO ssh: SSH is ready!
 INFO guest: Detect guest for machine: #<Vagrant::Machine:0x000001028f7200>
 INFO ssh: Execute: grep 'Fedora release 1[678]' /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/pld-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/SuSE-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Ubuntu' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/arch-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/gentoo-release | grep CoreOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Debian' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: grep Gentoo /etc/gentoo-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/release | grep -i OmniOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: uname -s | grep 'OpenBSD' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO guest: Detected: redhat!
 INFO guest: Full guest chain: [[:redhat, #<VagrantPlugins::GuestRedHat::Guest:0x00000100ddd230>], [:linux, #<VagrantPlugins::GuestLinux::Guest:0x00000102934f88>]]
 INFO guest: Execute capability: configure_networks (redhat)
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: network_scripts_dir (redhat)
 INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-eth1 > /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-ifcfg-eth1 > /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-network-entry_1 >> /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: ARPCHECK=no /sbin/ifup eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-network-entry_1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "24b58063-f4c0-478c-804c-01578e5d7a8c", "--machinereadable"]
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::Network:0x000001029ae6a8>
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::ClearNetworkInterfaces:0x000001029ae6d0>
 INFO interface: info: Mounting shared folders...
[web] Mounting shared folders...
$ VBoxManage guestproperty get web "/VirtualBox/GuestInfo/Net/1/V4/IP"
Value: 192.168.1.161

$ bundle exec bin/vagrant ssh web -c "ifconfig && cat /etc/sysconfig/network-scripts/ifcfg-eth1"
You appear to be running Vagrant in a Bundler environment. Because
Vagrant should be run within installers (outside of Bundler), Vagrant
will assume that you're developing plugins and will change its behavior
in certain ways to better assist plugin development.

eth0      Link encap:Ethernet  HWaddr 08:00:27:42:F5:32  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe42:f532/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:494 errors:0 dropped:0 overruns:0 frame:0
          TX packets:337 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:53238 (51.9 KiB)  TX bytes:44646 (43.5 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:CB:5B:74  
          inet addr:192.168.1.161  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fecb:5b74/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:420 (420.0 b)  TX bytes:1194 (1.1 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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
BOOTPROTO=none
IPADDR=172.16.1.100
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
#VAGRANT-END

/var/log/boot.log

Bringing up loopback interface:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth0:  
Determining IP information for eth0... done.
ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth1:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Starting system logger: ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M

/var/log/messages

Nov  2 20:07:17 hostfoo ntpd[1217]: ntpd [email protected] Thu May 13 14:38:25 UTC 2010 (1)
Nov  2 20:07:17 hostfoo ntpd[1218]: precision = 0.086 usec
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #1 wildcard, ::#123 Disabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #2 lo, ::1#123 Enabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #3 eth0, fe80::a00:27ff:fe42:f532#123 Enabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #4 eth1, fe80::a00:27ff:fe66:1d39#123 Enabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #5 lo, 127.0.0.1#123 Enabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #6 eth0, 10.0.2.15#123 Enabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on interface #7 eth1, 192.168.1.161#123 Enabled
Nov  2 20:07:17 hostfoo ntpd[1218]: Listening on routing socket on fd #24 for interface updates
...
Nov  2 20:08:02 hostfoo ntpd[1218]: frequency initialized 0.000 PPM from /var/lib/ntp/ntp.drift
Nov  2 20:08:02 hostfoo ntpd[1218]: Listening on interface #8 eth1, 172.16.1.100#123 Enabled

db

[db] Configuring and enabling network interfaces...
 INFO ssh: SSH is ready!
 INFO guest: Detect guest for machine: #<Vagrant::Machine:0x00000102975b50>
 INFO ssh: Execute: grep 'Fedora release 1[678]' /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/pld-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/SuSE-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Ubuntu' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/arch-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/gentoo-release | grep CoreOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Debian' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: grep Gentoo /etc/gentoo-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/release | grep -i OmniOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: uname -s | grep 'OpenBSD' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO guest: Detected: redhat!
 INFO guest: Full guest chain: [[:redhat, #<VagrantPlugins::GuestRedHat::Guest:0x0000010299c3e0>], [:linux, #<VagrantPlugins::GuestLinux::Guest:0x000001028f9708>]]
 INFO guest: Execute capability: configure_networks (redhat)
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: network_scripts_dir (redhat)
 INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-eth1 > /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-ifcfg-eth1 > /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-network-entry_1 >> /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: ARPCHECK=no /sbin/ifup eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-network-entry_1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "246ba01b-8a39-45d0-b33a-2e28ae7c6ef0", "--machinereadable"]
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::Network:0x0000010294b990>
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::ClearNetworkInterfaces:0x0000010294b9b8>
 INFO interface: info: Mounting shared folders...
[db] Mounting shared folders...
$ VBoxManage guestproperty get db "/VirtualBox/GuestInfo/Net/1/V4/IP"
Value: 172.16.1.101

$ bundle exec bin/vagrant ssh db -c "ifconfig && cat /etc/sysconfig/network-scripts/ifcfg-eth1"
You appear to be running Vagrant in a Bundler environment. Because
Vagrant should be run within installers (outside of Bundler), Vagrant
will assume that you're developing plugins and will change its behavior
in certain ways to better assist plugin development.

eth0      Link encap:Ethernet  HWaddr 08:00:27:42:F5:32  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe42:f532/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:493 errors:0 dropped:0 overruns:0 frame:0
          TX packets:325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:53215 (51.9 KiB)  TX bytes:43792 (42.7 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:E1:8E:31  
          inet addr:172.16.1.101  Bcast:172.16.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fee1:8e31/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1 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:60 (60.0 b)  TX bytes:872 (872.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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
BOOTPROTO=none
IPADDR=172.16.1.101
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
#VAGRANT-END

/var/log/boot.log

Bringing up loopback interface:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth0:  
Determining IP information for eth0... done.
ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth1:  Error, some other host already uses address 192.168.1.161.
ESC[60G[ESC[0;31mFAILEDESC[0;39m]^M
Starting system logger: ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M

/var/log/messages

Nov  2 20:08:21 hostfoo ntpd[1276]: ntpd [email protected] Thu May 13 14:38:25 UTC 2010 (1)
Nov  2 20:08:21 hostfoo ntpd[1277]: precision = 3.805 usec
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on interface #1 wildcard, ::#123 Disabled
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on interface #2 lo, ::1#123 Enabled
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on interface #3 eth0, fe80::a00:27ff:fe42:f532#123 Enabled
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on interface #4 lo, 127.0.0.1#123 Enabled
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on interface #5 eth0, 10.0.2.15#123 Enabled
Nov  2 20:08:21 hostfoo ntpd[1277]: Listening on routing socket on fd #22 for interface updates
...
Nov  2 20:09:11 hostfoo ntpd[1277]: frequency initialized 0.000 PPM from /var/lib/ntp/ntp.drift
Nov  2 20:09:11 hostfoo ntpd[1277]: Listening on interface #6 eth1, fe80::a00:27ff:fe36:89ba#123 Enabled
Nov  2 20:09:11 hostfoo ntpd[1277]: Listening on interface #7 eth1, 172.16.1.101#123 Enabled

Using this patch 1ad756d52c05a3732ff06e642b12a3e664b41743

Both hosts come up with the ip addresses as specified in the Vagrantfile.

$ VAGRANT_LOG=debug bundle exec bin/vagrant up web db

web

[web] Configuring and enabling network interfaces...
 INFO ssh: SSH is ready!
 INFO guest: Detect guest for machine: #<Vagrant::Machine:0x000001044642b8>
 INFO ssh: Execute: grep 'Fedora release 1[678]' /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/pld-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/SuSE-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Ubuntu' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/arch-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/gentoo-release | grep CoreOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Debian' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: grep Gentoo /etc/gentoo-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/release | grep -i OmniOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: uname -s | grep 'OpenBSD' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO guest: Detected: redhat!
 INFO guest: Full guest chain: [[:redhat, #<VagrantPlugins::GuestRedHat::Guest:0x0000010416f9b8>], [:linux, #<VagrantPlugins::GuestLinux::Guest:0x00000104334410>]]
 INFO guest: Execute capability: configure_networks (redhat)
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: network_scripts_dir (redhat)
 INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-eth1 > /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-ifcfg-eth1 > /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-network-entry_1 >> /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: ARPCHECK=no /sbin/ifup eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-network-entry_1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "9524085f-66de-4092-a77a-fefdda1084e6", "--machinereadable"]
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::Network:0x000001041838c8>
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::ClearNetworkInterfaces:0x00000104183918>
 INFO interface: info: Mounting shared folders...
[web] Mounting shared folders...
$ VBoxManage guestproperty get web "/VirtualBox/GuestInfo/Net/1/V4/IP"
Value: 172.16.1.100

$ bundle exec bin/vagrant ssh web -c "ifconfig && cat /etc/sysconfig/network-scripts/ifcfg-eth1"
You appear to be running Vagrant in a Bundler environment. Because
Vagrant should be run within installers (outside of Bundler), Vagrant
will assume that you're developing plugins and will change its behavior
in certain ways to better assist plugin development.

eth0      Link encap:Ethernet  HWaddr 08:00:27:42:F5:32  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe42:f532/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:528 errors:0 dropped:0 overruns:0 frame:0
          TX packets:367 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:55739 (54.4 KiB)  TX bytes:46915 (45.8 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:7C:E6:C2  
          inet addr:172.16.1.100  Bcast:172.16.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe7c:e6c2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:720 (720.0 b)  TX bytes:1550 (1.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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
BOOTPROTO=none
IPADDR=172.16.1.100
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
#VAGRANT-END

/var/log/boot.log

WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
Bringing up loopback interface:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth0:  
Determining IP information for eth0... done.
ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth1:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Starting system logger: ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M

/var/log/messages

Nov  2 19:58:27 hostfoo ntpd[1305]: ntpd [email protected] Thu May 13 14:38:25 UTC 2010 (1)
Nov  2 19:58:27 hostfoo ntpd[1306]: precision = 0.075 usec
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #1 wildcard, ::#123 Disabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #2 lo, ::1#123 Enabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #3 eth1, fe80::a00:27ff:fe7c:e6c2#123 Enabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #4 eth0, fe80::a00:27ff:fe42:f532#123 Enabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #5 lo, 127.0.0.1#123 Enabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #6 eth0, 10.0.2.15#123 Enabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on interface #7 eth1, 192.168.1.161#123 Enabled
Nov  2 19:58:27 hostfoo ntpd[1306]: Listening on routing socket on fd #24 for interface updates
Nov  2 19:58:27 hostfoo ntpd[1306]: kernel time sync status 2040
...
Nov  2 19:58:43 hostfoo kernel: ADDRCONF(NETDEV_UP): eth1: link is not ready
Nov  2 19:58:43 hostfoo kernel: e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Nov  2 19:58:43 hostfoo kernel: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
...
Nov  2 19:59:22 hostfoo ntpd[1306]: frequency initialized 0.000 PPM from /var/lib/ntp/ntp.drift
Nov  2 19:59:22 hostfoo ntpd[1306]: Listening on interface #8 eth1, 172.16.1.100#123 Enabled
Nov  2 19:59:22 hostfoo ntpd[1306]: Deleting interface #7 eth1, 192.168.1.161#123, interface stats: received=0, sent=0, dropped=0, active_time=55 secs

db

[db] Configuring and enabling network interfaces...
 INFO ssh: SSH is ready!
 INFO guest: Detect guest for machine: #<Vagrant::Machine:0x000001044c2ca0>
 INFO ssh: Execute: grep 'Fedora release 1[678]' /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/pld-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/SuSE-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Ubuntu' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/arch-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/gentoo-release | grep CoreOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/issue | grep 'Debian' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: grep Gentoo /etc/gentoo-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/release | grep -i OmniOS (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: uname -s | grep 'OpenBSD' (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /etc/redhat-release (sudo=false)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO guest: Detected: redhat!
 INFO guest: Full guest chain: [[:redhat, #<VagrantPlugins::GuestRedHat::Guest:0x00000104172a50>], [:linux, #<VagrantPlugins::GuestLinux::Guest:0x000001040a8ea8>]]
 INFO guest: Execute capability: configure_networks (redhat)
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: network_scripts_dir (redhat)
 INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-eth1 > /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-ifcfg-eth1 > /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: /sbin/ifdown eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: cat /tmp/vagrant-network-entry_1 >> /etc/sysconfig/network-scripts/ifcfg-eth1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: ARPCHECK=no /sbin/ifup eth1 2> /dev/null (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO ssh: Execute: rm /tmp/vagrant-network-entry_1 (sudo=true)
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "d8b5b174-62e5-41da-a833-7fa348e586ce", "--machinereadable"]
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::Network:0x000001044420c8>
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::ClearNetworkInterfaces:0x00000104442118>
 INFO interface: info: Mounting shared folders...
[db] Mounting shared folders...
$ VBoxManage guestproperty get db "/VirtualBox/GuestInfo/Net/1/V4/IP"
Value: 172.16.1.101

$ bundle exec bin/vagrant ssh db -c "ifconfig && cat /etc/sysconfig/network-scripts/ifcfg-eth1"
You appear to be running Vagrant in a Bundler environment. Because
Vagrant should be run within installers (outside of Bundler), Vagrant
will assume that you're developing plugins and will change its behavior
in certain ways to better assist plugin development.

eth0      Link encap:Ethernet  HWaddr 08:00:27:42:F5:32  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe42:f532/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:495 errors:0 dropped:0 overruns:0 frame:0
          TX packets:325 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:53568 (52.3 KiB)  TX bytes:44017 (42.9 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:8F:C6:E0  
          inet addr:172.16.1.101  Bcast:172.16.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe8f:c6e0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:1530 (1.4 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:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
BOOTPROTO=none
IPADDR=172.16.1.101
NETMASK=255.255.255.0
DEVICE=eth1
PEERDNS=no
#VAGRANT-END

/var/log/boot.log

WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
Bringing up loopback interface:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth0:  
Determining IP information for eth0... done.
ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Bringing up interface eth1:  ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M
Starting system logger: ESC[60G[ESC[0;32m  OK  ESC[0;39m]^M

/var/log/messages

Nov  2 19:59:41 hostfoo ntpd[1230]: ntpd [email protected] Thu May 13 14:38:25 UTC 2010 (1)
Nov  2 19:59:41 hostfoo ntpd[1231]: precision = 0.068 usec
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #1 wildcard, ::#123 Disabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #2 lo, ::1#123 Enabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #3 eth0, fe80::a00:27ff:fe42:f532#123 Enabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #4 eth1, fe80::a00:27ff:fe8f:c6e0#123 Enabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #5 lo, 127.0.0.1#123 Enabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #6 eth0, 10.0.2.15#123 Enabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on interface #7 eth1, 192.168.1.161#123 Enabled
Nov  2 19:59:41 hostfoo ntpd[1231]: Listening on routing socket on fd #24 for interface updates
...
Nov  2 19:59:48 hostfoo kernel: ADDRCONF(NETDEV_UP): eth1: link is not ready
Nov  2 19:59:48 hostfoo kernel: e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Nov  2 19:59:48 hostfoo kernel: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
...
Nov  2 20:00:26 hostfoo ntpd[1231]: frequency initialized 0.000 PPM from /var/lib/ntp/ntp.drift
Nov  2 20:00:26 hostfoo ntpd[1231]: Listening on interface #8 eth1, 172.16.1.101#123 Enabled
Nov  2 20:00:26 hostfoo ntpd[1231]: Deleting interface #7 eth1, 192.168.1.161#123, interface stats: received=0, sent=0, dropped=0, active_time=45 secs

@mitchellh
Copy link
Contributor

This looks great. Thanks!

mitchellh added a commit that referenced this pull request Nov 23, 2013
guests/redhat: ifdown ethN before munging ifcfg-ethN
@mitchellh mitchellh merged commit 5b71cf8 into hashicorp:master Nov 23, 2013
@ghost ghost locked and limited conversation to collaborators Apr 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants