Can't connect to guest node set up with nat and hostonly vagrant and virtualbox -
i have been trying replace manual vitualbox setup vagrant. create guest node 2 network adapters nat guest(ubuntu) use host internet apt-get operations, , hostonly host connect guest. has been working pretty well.
below vagrant file
vagrant.configure("1") |config| config.vm.boot_mode = :gui end vagrant.configure("2") |config| config.vm.define "web" |web| web.vm.box = "ubuntu/trusty64" web.vm.network "forwarded_port", guest:22, host:2222, id:"ssh", disabled:true web.vm.network "private_network", ip:"192.168.56.103", :adapter =>2 end end
below output:
bringing machine 'web' 'virtualbox' provider... ==> web: importing base box 'ubuntu/trusty64'... ==> web: matching mac address nat networking... ==> web: checking if box 'ubuntu/trusty64' date... ==> web: newer version of box 'ubuntu/trusty64' available! ==> web: have version '14.04'. latest version '20150430.0.0'. run ==> web: `vagrant box update` update. ==> web: setting name of vm: ansible_web_1431424632866_64634 ==> web: clearing set forwarded ports... ==> web: clearing set network interfaces... ==> web: preparing network interfaces based on configuration... web: adapter 1: nat web: adapter 2: hostonly ==> web: forwarding ports... ==> web: booting vm... ==> web: waiting machine boot. may take few minutes... web: ssh address: 127.0.0.1:22 web: ssh username: vagrant web: ssh auth method: private key web: warning: authentication failure. retrying... web: warning: authentication failure. retrying... web: warning: authentication failure. retrying...
now on vagrant works , can't figure out few things:
question 1 vagrant need port forwarding connect guest?
question 2 when vagrant says : ==> web: preparing network interfaces based on configuration... web: adapter 1: nat web: adapter 2: hostonly
figured eth1 should that's not case. ifconfig -a
shows interface eth1 without ip sudo ifup eth1
shows ignoring unknown interface eth1=eth1
. happened here , how can solve this?
thanks helping
never mind, fixed it. relies heavily on version of vagrant used. works of version support auto correct feature of forwarding port.
after removing line:
web.vm.network "forwarded_port", guest:22, host:2222, id:"ssh", disabled:true
it started working charm , add other nodes .kindly see below config worked sake of sharing
vagrant.configure("1") |config| config.vm.boot_mode = :gui end vagrant.configure("2") |config| auto_config= false config.vm.define "web" |web| web.vm.box = "ubuntu/trusty64" web.vm.network "private_network", ip:"192.168.56.103", :adapter =>2 end (1..3).each |i| config.vm.define "mongo-#{i}" |mongo| mongo.vm.box = "ubuntu/trusty64" mongo.vm.network "private_network" , ip:"192.168.56.11#{i}", :adapter =>2 end end (1..2).each |i| config.vm.define "tomcat-#{i}" |tomcat| tomcat.vm.box = "ubuntu/trusty64" tomcat.vm.network "private_network" , ip:"192.168.56.12#{i}", :adapter =>2 end end (1..2).each |i| config.vm.define "mysql-#{i}" |mysql| mysql.vm.box = "ubuntu/trusty64" mysql.vm.network "private_network" , ip:"192.168.56.13#{i}", :adapter =>2 end end end
Comments
Post a Comment