Basic Vagrant Concepts
For Creating VM’s with the help of vagrant we do not need iso files we need vagrant images/boxes from here.https://app.vagrantup.com/boxes/search
VM’s are managed with Vagrantfile
There are different commands to manges vm’s with vagrant, like vagrant halt to stop vm.
Provisioning a VM means executing commands and scripts on VM
Vagrant works with Type 2 Hypervisors, which are not used on servers, so we can not use vagrant in production servers.
by default vms get ip address from NAT, which virtual box private network and we can not access vm’s that are on NAT only from computers which are on different network.
Bridge networking allows vm’s to take ip directly from router dhcp and assign the ip from the same range to which we are connected. Now vm have access to two networks one private (NAT) and one public (bridge network (router dhcp)).
to implement the bridge network via vagrant open the
Vagrantfile, uncomment line no 40
config.vm.network "public_network"save, exit and run
create new user and password to test the bridge network.
in ubuntu open file at location
/etc/ssh/sshd_configand find the line
PasswordAuthentication noand change it to
yes, service ssh restart.
login with new user and new public ip assigned to bridge network adapter. example
ssh email@example.com, we can use powershell or putty or ssh tool to login.