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.

  • 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.

Bridge Networking

  • 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 "public_network" save, exit and run vagrant reload.

  • create new user and password to test the bridge network.

  • sudo -i

  • useradd devops

  • passwd devops

  • in ubuntu open file at location /etc/ssh/sshd_config and find the line PasswordAuthentication no and change it to yes, service ssh restart.

  • login with new user and new public ip assigned to bridge network adapter. example ssh devops@, we can use powershell or putty or ssh tool to login.