PXE Booting?

467 views
Skip to first unread message

Joaquin Menchaca

unread,
Sep 10, 2015, 7:08:53 PM9/10/15
to Vagrant
Say, if I wanted to do like, a pxeboot server, would my vagrant file look like this (assuming my server has dhcpd on it)?

Vagrant.configure("2") do |config|
  config.vm.define "server" do |server|
    server.vm.box = "hashicorp/precise64"  # Heisenbug
    server.vm.hostname = "pxeboot"
    server.vm.network :private_network, ip: "10.1.1.1"
  end

  config.vm.define "client" do |client|
    client.vm.gui = true
    client.vm.customize ["modifyvm", :id, "--boot1", "net", "--boot2", "disk"]
    client.vm.network :private_network, type: "dhcp", auto_config: false
  end

end

Simon McCartney

unread,
Sep 11, 2015, 6:00:24 PM9/11/15
to vagra...@googlegroups.com
Almost, I’ve had more reliable success if you ensure that the private network of the server & primary network of the client are forced on to the vbox network (assuming you are using Virtualbox.)


  # PXE Server 
  config.vm.define "jumpstart" do |jumpstart|
    jumpstart.vm.network :private_network, :ip => "10.241.19.11"

    # force the secondardy nic to the same vboxnet as the PXE node
    jumpstart.vm.provider "virtualbox" do |virtualbox|
      # put primary network interface into hostonly network segement
      virtualbox.customize ["modifyvm", :id, "--nic1", "hostonly"]
      virtualbox.customize ["modifyvm", :id, "--hostonlyadapter2", "vboxnet7"]
    end

  # PXE client
  config.vm.define :"node01" do |vm_config|
    vm_config.vm.box      = "blank-amd64
    # Use an empty box 
   
    # wait up to 10min before declaring the node dead (from Vagrant's POV)
    # the user can still just ctrl-c the `vagrant upi node01` and
    # vagrant will clean up
    vm_config.vm.boot_timeout = 600
    vm_config.vm.provider "virtualbox" do |virtualbox|
      virtualbox.gui = true unless ENV['NO_GUI’]

      # generate a new mac address for each node, to make them unique
      virtualbox.customize ["modifyvm", :id, "--macaddress1", "auto"]

      # put primary network interface into hostonly network segement
      virtualbox.customize ["modifyvm", :id, "--nic1", "hostonly"]
      virtualbox.customize ["modifyvm", :id, "--hostonlyadapter1", "vboxnet7"]

      # pxe boot the node
      #virtualbox.customize ["modifyvm", :id, "--boot1", "net"]
    end
  end


I’ve also noticed that the version of iPXE that ships with Virtualbox is quite old, and didn’t like some of the kernels I was working with, luckily it’s easy enough to use the ipxe.iso from ipxe.org to use newer versions of the iPXE code  (the alternative box below is needed because Fletcher’s box used above doesn’t have an IDE interface defined):



vm_config.vm.box      = "boot-from-iso"
    vm_config.vm.provider "virtualbox" do |virtualbox|
      virtualbox.gui = true unless ENV['NO_GUI']

      # VirtualBox ship old iPXE code, so boot off an up to date
      # iPXE ISO instead
      virtualbox.customize ["modifyvm", :id, "--boot1", "dvd"]
      virtualbox.customize ["storageattach", :id, "--storagectl",
                            "IDE", "--port",  "0", "--device", "0", "--type", "dvddrive",
                            "--medium", "ipxe.iso"]


Hope that helps - if not ping me, I’m working on 2 different PXE projects in Vagrant at the moment.

-- 
Simon McCartney
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/f783ad03-303b-4083-be7c-e7368bfefa5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon McCartney

unread,
Sep 11, 2015, 6:46:40 PM9/11/15
to Vagrant
There is a mistake in the PXE Server definition, remove the following line:

 virtualbox.customize ["modifyvm", :id, "--nic1", "hostonly"]


To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages