¿Qué es Vagrant?
Antes de nada
Antes de nada debemos crear una carpeta que llamaremos “-workspace" donde trabajaremos.
Uso de Vagrant
Iniciar/levantar máquina virtual:
Recargar configuración de la máquina virtual:
Apagar la máquina virtual:
Ejecutar el script de aprovisionamiento:
1
| $vagrant up --provision
|
o
Conectar mediante SSH:
Eliminar una máquina:
VA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| # -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.synced_folder '.', '/media/vagrant', disabled: true
config.vm.define "ub1404" do |ub1404|
ub1404.vm.box = "rapid7/metasploitable3-ub1404"
ub1404.vm.hostname = "metasploitable3-ub1404-2"
config.ssh.username = 'vagrant'
config.ssh.password = 'vagrant'
ub1404.vm.network "private_network", ip: '172.28.128.3'
ub1404.vm.network "private_network", ip: "192.168.50.5", virtualbox__intnet: true
ub1404.vm.provider "virtualbox" do |v|
v.name = "Metasploitable3-ub1404-2"
v.memory = 2048
end
end
end
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| Vagrant.configure("2") do |config|
# Synced folder
config.vm.synced_folder '.', '/media/vagrant'
config.vm.box = "kalilinux/rolling"
config.ssh.username = 'vagrant'
config.ssh.password = 'vagrant'
# VirtualBox Host-Only Networks
config.vm.network "private_network", type: "dhcp"
# VirtualBox Internal Network
config.vm.network "private_network", ip: "192.168.50.4", virtualbox__intnet: true
config.vm.provision "shell", inline: <<-SHELL
sed -i 's/"us"/"es"/g' /etc/default/keyboard
install-keymap es
SHELL
end
|
Guest additions
Si estamos en Windows:
1
| $vagrant plugin install vagrant-winnfsd
|
Instalamos el plugin:
1
| $vagrant plugin install vagrant-vbguest
|
Comprobamos que está instalado:
Bibliografía