syselement's Blog
🏠 Home BlogXGitHub📚 Buy Me a Book📧 Contact
  • 🏠Home
  • 🔳Operating Systems
    • 🐧Linux
      • 📃Everything Linux
      • Linux Distros
        • Kali Linux - VM
        • ParrotOS - VM
        • Rocky Linux
        • Ubuntu Desktop - VM
        • Ubuntu Server - VM
      • Linux Tools
        • BookStack
        • Nessus Essentials
        • SysReptor
        • Terminator
        • UniFi
        • Zsh & Oh-My-Zsh
    • 🪟Windows
      • 📃Everything Windows
      • Windows Tools
        • Hashcat
        • Vagrant
      • Windows Virtual Machines
        • Windows 11 - VM
        • Windows Server 2025 - VM
  • 📝Courses Notes
    • eLearnSecurity / INE
      • eJPT - PTSv2
      • eMAPT
      • ICCA
    • Practical Networking
      • Practical TLS
        • TLS/SSL Overview
        • Cryptography
        • x509 Certificates and Keys
        • Security through Certificates
        • Cipher Suites
        • TLS/SSL Handshake
        • TLS Defenses
        • TLS Attacks & Vulnerabilities
        • What's new in TLS 1.3?
        • TLS 1.3 Under the Hood
        • TLS 1.3 Extensions
        • 🌐Practical TLS References
    • TCM Security
      • Linux101
      • MAPT
      • PEH
  • 🖥️Cyber Everything
    • 📌Generic Resources
      • Cryptography
      • CVSS 3.1
      • Cyber Threat Intelligence (CTI)
    • 📱Mobile
      • Apps Lab
        • Android Rooting Guide
        • iOS Jailbreak Guide
        • Intercepting Android App Traffic
      • OWASP MAS
        • MASTG Techniques
        • MASTG Tests
        • MASTG Theory
        • MASVS Notes
      • Tools
        • MobSF
    • 🧬Network
      • Commands
        • Linux Privesc Commands
        • Networking Commands
    • 🌐Web
      • API
        • API Sec Fundamentals
        • API Penetration Testing
      • PortSwigger Academy
        • Server-Side Topics
        • Client-Side Topics
        • Advanced topics
        • 🔬Vulnerability Labs
    • ✍️Writeups & Walkthroughs
      • 🌩️TryHackMe
        • 📖Learn
          • Cyber Threat Intelligence
          • Intro to Defensive Security
          • Juice Shop
          • Upload Vulnerabilities
        • 🎯Practice
          • Easy
            • Blaster
            • Blue
            • Bolt
            • Chill Hack
            • Ice
            • Ignite
            • Retro
            • Startup
          • Medium
            • Blog
      • 📦HackTheBox
      • 🚩Capture The Flag
  • ♾️DevOps Everything
    • 🔗DevOps Resources
      • Introduction to DevOps
      • Ansible
      • Docker
      • Git
      • Kubernetes
      • Terraform
      • Vim
  • 🔬Home Lab
    • 🖥️Hypervisors
      • Hyper-V
        • Windows WSL
      • Proxmox
        • Proxmox VE
        • Proxmox Upgrade 7 to 8
      • VMware
        • VMware Workstation Pro
    • 🔴Offensive Labs
      • Hashcat Password Cracking
      • Metasploitable3
    • 🔵Defensive Labs
      • Detection Lab
    • ⚪Misc Labs
      • Bitwarden On-Premise
      • OpenWrt & WiFi Exploitation
      • Passbolt CE - Ubuntu Server
Powered by GitBook
On this page
  • 🌐 Resources 🔗
  • Default Provider
  • VirtualBox
  • VMware Workstation
  • 📝 Cheatsheet

Was this helpful?

Edit on GitHub
  1. Operating Systems
  2. Windows
  3. Windows Tools

Vagrant

PreviousHashcatNextWindows Virtual Machines

Last updated 9 days ago

Was this helpful?


🌐 Resources 🔗

    • The installer will automatically add vagrant to your system path so that it is available in terminals.

    • Verify the correct installation using the vagrant command inside PowerShell.

  • Vagrant is meant to run with one Vagrantfile per project.

  • When you run any vagrant command, Vagrant climbs up the directory tree looking for the first Vagrantfile it can find, starting first in the current directory.

    • This feature lets you run vagrant from any directory in your project.


Default Provider

  • If you have the VMware provider installed, it will always take priority over VirtualBox.

  • E.g.

Vagrant.configure("2") do |config|
  # ... other config up here

  # Prefer VirtualBox before VMware Workstation
  config.vm.provider "virtualbox"
  config.vm.provider "vmware_desktop"
end

VirtualBox

  • Create a new directory for the vargrant project

  • Open PowerShell and move into the project directory

vagrant init hashicorp/bionic64
  • box add subcommand can be used to install a box without creating a new Vagrantfile

    • do not add it if already initialized

vagrant box add hashicorp/bionic64

Boxes are globally stored for the current user. Each project uses a box as an initial image to clone from, and never modifies the actual base image. This means that if you have two projects both using the hashicorp/bionic64 box you just added, adding files in one guest machine will have no effect on the other machine.

  • Use the box as a base in the project by opening the Vagrantfile. Content must be:

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/bionic64"
end

The hashicorp/bionic64 in this case must match the name you used to add the box above. This is how Vagrant knows what box to use. If the box was not added before, Vagrant will automatically download and add the box when it is run.

  • Bring up the virtual machine

vagrant up --provider=virtualbox
  • VirtualBox - created and started VM

  • SSH into the machine:

vagrant ssh

vagrant@127.0.0.1's password:
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Feb  1 21:46:32 UTC 2023

  System load:  0.08              Processes:           91
  Usage of /:   2.5% of 61.80GB   Users logged in:     0
  Memory usage: 11%               IP address for eth0: 10.0.2.15
  Swap usage:   0%
[...]

vagrant@vagrant:~$ logout
Connection to 127.0.0.1 closed.
  • Destroy the machine

vagrant destroy
  • Remove the box

vagrant box list
	hashicorp/bionic64 (virtualbox, 1.0.282)
vagrant box remove hashicorp/bionic64
  • Extras:

    • Suspend the VM

      • The virtual machine will still use disk space while suspended, and requires additional disk space to store the state of the virtual machine RAM.

    vagrant suspend
    • Gracefully shutdown the VM

      • Halting your machine will cleanly shut it down, preserving the contents of disk and allowing you to cleanly start it again.

    vagrant halt

VMware Workstation

  • You can install or update the Vagrant VMware plugin to the latest version by re-running the install command:

vagrant plugin install vagrant-vmware-desktop

vagrant plugin update
  • Create a new directory for the vargrant project

  • Open PowerShell and move into the project directory

vagrant init hashicorp/bionic64
config.vm.provider "vmware_desktop" do |v|
    v.gui = true
end
  • Bring up the virtual machine and try to SSH into it

vagrant up --provider=vmware_desktop
vagrant ssh
  • VMware Workstation - created and started VM

  • Shutdown the VM and destroy it

vagrant halt
vagrant destroy

📌

  • After stopping the VM with vagrant halt, at the second boot with vagrant up this error could appear ❗:

Vagrant encountered an error while attempting to prune unused port forward entries

  • To solve this port forwarding issue use this command:

vagrant cap provider scrub_forwarded_ports
  • Then bring up again the VM with vagrant up --provider=vmware_desktop command.


📝 Cheatsheet

vagrant plugin install vagrant-vmware-desktop
vagrant plugin update

vagrant init <IMAGE>
vagrant up
vagrant up --provider=vmware_desktop
vagrant ssh

vagrant suspend
vagrant halt
vagrant destroy

vagrant box list
vagrant box remove <BOX_NAME>

and Run the installer for Windows system.

The primary function of the is to describe the type of machine required for a project, and how to configure and provision these machines. Vagrantfiles are called Vagrantfiles because the actual literal filename for the file is Vagrantfile.

Find more boxes at

Check more infos about Default Providers

Install & VirtualBox Extension Pack (default Vagrant provider)

Initialize the directory with a box, in this case the box will be used

This will download the box named hashicorp/bionic64 from , where you can find and host boxes.

To upgrade the Vagrant VMware utility, download the latest version from the and install the system package to your local system.

Initialize the directory with a box, in this case the box will be used

Set the GUI in the Vagrantfile to show the VMs in the VMware dashboard ()

🔳
🪟
Vagrant Installation
Download
Vagrantfile
HashiCorp's Vagrant Cloud box catalog
here
VirtualBox
hashicorp/bionic64
HashiCorp's Vagrant Cloud box catalog
Install VMware
Vagrant VMware utility downloads page
hashicorp/bionic64
provider settings here
vagrantup.com
vagrant up --provider=virtualbox
vagrant up --provider=vmware_desktop