Reputation: 1811
I have recently learned how to setup a virtual machine using vagrant (virtualbox), and I know how to access it from a web browser via the local adress such as 192.168.x.x:9292
since 9292 is the default gate. But I would like to access the server from another computer locally.
My question is if I could access it via cmd as I connect to it on my own with the command vagrant ssh
but from another computer via a command like vagrant ssh 192.168.x.x
?
As far as I understand you have to use external programs or setup something inside the vagrant environment? Is there a simple way to access the server or is it password protected? If I setup a website I can access that for example from another local machine but can I access files on the server (from another computer)?
Upvotes: 2
Views: 3057
Reputation: 1811
I found how to connect to another computer locally by entering the vagrant environment, vagrant up
--> vagrant ssh
. And connected to another computer by typing in ssh [email protected]
where 192.168.x.x is the local address to the computer. The vagrant asks for a password and you type in the default password which I believe is vagrant and then you are connected to the other vagrant instance.
Upvotes: 1
Reputation: 76
Assuming you have virtualbox provider for Vagrant you can achieve this by doing bridging the VBox network interface with Host.
Use this in Vagratfile (for public/private)
For Public
Vagrant.configure("2") do |config|
config.vm.network "public_network",
use_dhcp_assigned_default_route: true
end
For Private
Vagrant.configure("2") do |config|
config.vm.network "private_network", type: "dhcp"
end
above code will create IP in the range of Host network and using this you can access the file server from another machine.
Upvotes: 0