Hi all,
I'm running VirtualBox (5.0.20) under Windows 10 and have a quick question 
about creating a package box from VirtualBox guest.


   1. My Ubuntu 14.04.4 guest I configure with a single NIC (attached to 
   NAT) and then I go through and install the OS, VirtualBox Guest Additions 
   etc etc. to get it to a good point that I will use as a base package. 
    We'll assume that I've called my VirtualBox guest "UbuntuBasePackage".
   2. I create a folder *C:\Vagrant\Boxes* and through a command prompt, 
   enter that folder
   3. I create a text file (*UbuntuBasePackage.txt*) that will be used as 
   the initial provisioning (I hope that's the correct term) Vagrantfile for 
   the package. The text file contains a custom SSH username ("*bob*") and 
   password that I'll use within my boxes. It looks like this:
   4. 
   
   # -*- mode: ruby -*-
   # vi: set ft=ruby :
    
   Vagrant.configure(2) do |config|
     config.vm.box = "file://D://Vagrant//Boxes//UBP.box"
     config.vm.define "UBP"
     config.vm.provider "virtualbox" do |v|
       v.name = "UBP"
          v.memory = 1024
          v.cpus = 1
     end
     config.ssh.username = "bob"
     config.ssh.password = "bobbob"
   end
   
   5. I then create my base package using the following command
      1. *vagrant package --base UbuntuBasePackage --output UBP.box 
      --vagrantfile UBP.txt*
   6. All goes great.
   7. Now I create *C:\Vagrant\UBP* and through a command prompt, enter 
   that folder
   8. I now initialize my new box with the following
      1. *vagrant init C:\Vagrant\Boxes\UBP.box*
      9. All goes great and a Vagrantfile appears in the UBP folder.
   10. It's at this point that developers would potentially customize the 
   box to their own environments, so my instructions are to edit the new 
   Vagrantfile to look something like this
   11. 
   
   # -*- mode: ruby -*-
   # vi: set ft=ruby :
   Vagrant.configure(2) do |config|
     config.vm.box = "C:/Vagrant/Boxes/UBP.box"
     config.vm.network "private_network", ip: "192.168.56.40"
     config.vm.define "UBP" 
     config.vm.provider "virtualbox" do |v| 
       v.name = "UBP" 
       v.memory = 1024 
     end 
   end
   
   12. *Please note* the configuration of the *additional private_network 
   interface*!
   13. Once the file is saved, we start the guest up with the normal *vagrant 
   up*.
      1. I notice that the log shows that Adapter 1: nat and Adapter 2: 
      hostonly
   14. All is just fine, but I've noticed that there are some interesting 
   results when it comes to the networking.  
      1. I can (from the host) SSH into the 192.168.56.40 address - great!
      2. I can (from the host) access a WWW server from 192.168.56.40 - 
      great!
      3. From the guest, I run *ifconfig* and notice that my eth1 (2nd 
      "HostOnly" NIC) is configured with a DHCP address of 192.168.56.101
      4. I can (from the host) now access both SSH and WWW from 
      192.168.56.101
   15. I check the /etc/network/interfaces file and sure enough, there's a 
   couple of additional entries

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

*auto eth1*
*iface eth1 inet dhcp*
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto eth1
iface eth1 inet static
      address 192.168.56.40
      netmask 255.255.255.0
#VAGRANT-END


   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   

   
I check the original UbuntuBasePackage server within VirtualBox, and 
there's the loopback and eth0 assigned as I expect. I can understand the 
*Vagrant 
begin* being added to the file and indeed, that's the IP address that was 
set in the Vagrantfile, but where's the initial request for DHCP coming 
from (in *bold*)? 

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
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 vagrant-up+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/63f06ed4-4c13-42db-a91e-573007e66eb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to