No access to web or mysql on vagrant after upgrading to macos monterey - vagrant

Last week I decided to upgrade the mac to the latest version Monterey. Well. Most things works, except for Vagrant. Well.. it works, except there is almost no connection to the server.
vagrant ssh works.
I have been able to launch virtualbox, but access to http or mysql is not happening.
I know the mysql-server is running. The same goes with the apache server.
Logs have been checked and I cannot see that any traffic going to the server.
Ping is not working.
I have updated virtualbox. I have destroyed the box and upgraded vagrant / homestead. still no luck.
MORE INFO:
When I run traceroute I see that the first hit is the correct IP I have set in hosts file. Then it goes to 192.168.0.1 which isn't going anywhere.
I guess the 192.168.0.1 comes from the mac virtualbox / vagrant is running on.
Any pointers on what to do next are welcome.

Probably the same problem as mine (I couldn't use any longer IP 192.168.10.10). VirtualBox did some changes lately (from VirtualBox 6.1.28 I think) and a new configuration is needed to use your preferred (192.168.0.1) IP address:
On Linux, macOS and Solaris Oracle VM VirtualBox will only allow IP
addresses in 192.168.56.0/21 range to be assigned to host-only
adapters. For IPv6 only link-local addresses are allowed. If other
ranges are desired, they can be enabled by creating
/etc/vbox/networks.conf and specifying allowed ranges there. For
example, to allow 10.0.0.0/8 and 192.168.0.0/16 IPv4 ranges as well as
2001::/64 range put the following lines into /etc/vbox/networks.conf:
* 10.0.0.0/8 192.168.0.0/16
* 2001::/64
You can check the whole information here.
Alternatively (skipping the networks.conf configuration) you can use any IP from the initially supported range like for instance: 192.168.56.10

Related

Why can't I connect to 127.0.0.1 HortonWorks Dashboard?

I have installed Virtual Box (Version 5.2.0 r118431 (Qt5.6.2)) on Windows 10 and i imported appliance HDP_2.4_virtualbox_v3 (downloaded from here).
I followed the tutorial from here step by step.
The virtual machine is running on the computer from where I am trying to access the Dashboard. I have set up the Host Only Adapter Option on the sandbox so the computer and the virtual machine can communicate
After the CentOs finished booting I am prompt to enter to the ip 127.0.0.1:8888, which is a different address from the tutorial,
and there is no server listening to that address because i get
"127.0.0.1 refused to connect." in the browser.
image here
Run the ipconfig command in your command prompt and identyfy your virtual box's ip under Ethernet adapter VirtualBox Host-Only Network.
Take that ip address and go to your Virtual Box.
Select your appliance and go to Settings->Network->Adapter 1->Port Forwarding.
Replace the Host IP 127.0.0.1 for the port you need 8080, 8888 and so on with the ip of your virtual box that should be sth like 192.168.x.x.
Now start your sandbox, login on it and try to connect in your browser to the new ip set 192.168.x.x:8888.
Use appliance HDP_2.4_virtualbox because in the most recent some linux commands like netstat are considered deprecated and no longer function, which willmake your life harder when trying to debug or identify a networking problem.
If you still encounter issues eith it, reinstall your operating system, reinstall your virtual box and reimport the sandbox, make the changes needed in the Port Forwarding settings and it should be ok.
try to connect using 127.0.0.1 to connect make sure the VM is running make sure there are no errors if there are debug them and at the last straw uninstall the Vm and retry (make sure to make a backup if there are any files)
you can also try to check all the local host ips on your network and try to connect to them
Make sure you set NAT in your VirtualBox network settings:

Using gitlab-vagrant-vm from OSX host

I followed the instructions here and was able to succesfully (I think) install the gitlab vagrant virtual machine on OSX 10.8 using virtualbox.
I can do vagrant up to get the VM running, and everything seems to work fine. After that I can do vagrant ssh without a problem. Also, after sshing into the VM I was able to do bundle exec rake gitlab:test, which completed with results being 1584 examples, 0 failures.
I would like to see the gitlab web interface from my OSX host machine. I thought I could just direct my browser to the IP indicated in the VagrantFile (http://192.168.3.14), but that didn't work.
Any ideas?
Also any other usage tips for this setup would be appriciated (things like where the repositories are stored on my host machine so I can back them up, if anyone set the gitlab-vagrant-vm up for external access from either another computer on the network or a remote source, ect.)
You have to connect a second interface for vagrant. To do this you've to edit the VagrantFile.
For example if you want to conenct to the host wifi add the following line after 192.168.3.14
config.vm.network :bridged, bridge: "en0: Wi-Fi (AirPort)"
You also can bridge to the ethernet interface. Use ifconfig on the host machine to determine the right interface. After that the dyndns-server of the host network will assign an IP to the Vagrant-Box. Then you can access GitLab on that IP.
Did you actually start the server? You can do that with
bundle exec foreman start -p 3000
This will start the server on port 3000, you would then access it from the host with
http://192.168.3.14:3000/
Hope this helps,
Chris

Vagrant Port Forwarding on Mac OS X Lion

I've been struggling trying to connect to a centos 6.4 vm using Vagrant.
I'm using salt as a provisioning agent and I have installed apache,php,mysql packages successfully.
When i ssh into the box apache is running fine. I added an index.html file in /var/www and I get the contents back when I curl localhost:80
Vagrant.configure("2") do |config|
## Chose your base box
config.vm.box = "centos63"
config.vm.box_url = ""
## For masterless, mount your salt file root
config.vm.synced_folder "salt/roots/", "/srv/"
## Use all the defaults:
config.vm.provision :salt do |salt|
salt.verbose = true
salt.run_highstate = true
salt.minion_config = "salt/minion"
end
end
Vagrant::Config.run do |config|
config.vm.forward_port 80, 8080
config.vm.share_folder "mypath", "/var/www/leo", "."
end
I ran sudo lsof -i :8080 on my local machine and gave me no results. I also cleared the iptable config in the guest machine with iptables -F. When I curl the guest machine
curl -v 'localhost:8080'
* About to connect() to localhost port 8080 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* Connection refused
* Trying fe80::1...
* Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host
Do I need guest additions installed? I looked around on how to install this but I'm not sure if it has to be installed on the host or the guest. Not sure what else to try.
What you are trying to do here isn't possible just using vagrant without running vagrant as root. You can run Vagrant as root i believe but VirtualBox won't agree with that. You can continue to use a port number or if you want or need to use port 80 there is a way.
I had this issue when a client of mine asked me to do a Wordpress Multisite setup. With Wordpress MS you can't have port numbers in the URL b/c some of the URL mapping will not work correctly. I was surprised when I found that out and didn't want to go back to using a program like MAMP.
Anyway here are two ways to achieve this goal (neither are very hard). I'm a Mac user so these are Mac specific Answers, I will see if there is a Windows version and update my answer when I can test it to make sure (see below, there is a way).
Way #1 (Mac IP Firewall Utility):
In your vagrant file
config.vm.forward_port 80, 8080
config.vm.forward_port 443, 8443
Thats pretty normal.
Now open up terminal and you can use the ipfw utility
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to me 80
sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443
Now that cmd is not permanent so you would have to re-run the cmd if you restarted your machine. You can make it permanent though and I am including a link below that will explain the rest of way #1.
Web Development on Port 80 and 443 in Vagrant
Way #2 (Mac POW and Anvil):
If you don't have Pow yet, get it! It's a really cool app.
Install Pow and Anvil, you can find Anvil there and you can find Pow there.
You can read the docs on how to set those up but don't pay attention to the "static" and "rack" sites part, you need this part.
You will be using Port Proxying through Pow to take the incoming traffic from mycoolsite.dev and forward it to the virtual machine like mycoolsite.dev:8080 and then the virtual machine will forward 8080 to 80 and back up the line your content will come.
After you install Anvil/Pow and get them set up run this line:
echo 8080 > ~/.pow/mycoolsite
Then click Anvil in the task bar (you may have to refresh it or close and reopen) and turn the site on, thats it, what?? Really? Pow and Anvil rock!!
So there are two ways I have found, I'm sure that there are some things you can do with your Hosts file and I used to do that a bunch. However, these other ways that are available really make it easy to forget about that pesky hosts file.
Note for Windows Users (and Mac users that don't like the first 2 ways): You can use Vagrant Host Manager, you can find out how to set it up here on github. It is a vagrant plugin and basically will edit your hosts file for you, all you do is your vagrantfile config and you are good to go after that. I just tested it on Windows 7 and it worked there so it should be good, if you have any issues just look through the docs on github or file an issue for the Vagrant Host Manager team to review.
I changed the guest port to 5656 and it worked. When running lsof -i :8080 I didn't see any results so i figured nothing was using that port maybe I was wrong.

Access virtual host from guest os ( oracle virtual box)

I am using ubuntu 11.10 and have installed different virtual host on different ip like
127.0.0.2 www.example.local
127.0.0.3 www.wordpress.local
... etc
I want to test these website in IE9, for this i have install windows7 in oracle virtual box and also modified host file of windows7 and add this line 10.0.2.2 localhost at the end of the file and also create a new bridge adapted.
After all this setup i can access localhost of ubuntu from windows7, but find problem while accessing virtual host of ubuntu.
Please help me to access these virtual host on windows 7, i have already search google, ubuntu forum and stackoverflow for this but didnt find right answer.
If I understand you correctly, you want the virtual adapters ip, ie. the gateway ip.
Just add those lines you have added to Ubuntu's host file to the host file in your Windows 7 VM, replacing 127.0.0.x with 10.0.2.2 should make your Windows VM connect to your Ubuntu host for requests to those hosts. This should usually sufficient, unless your HTTP server is configured to serve www.example.local only for connection to 127.0.0.2 and similar for www.wordpress.local.

Using dnsmasq on a Windows VM in VirtualBox on a Mac (+ MAMP)

I'm using dnsmasq on the Mac (OS X 10.7) to facilitate local development (along with MAMP), with just this pretty simple config:
[dnsmasq.conf]
address=/dev/127.0.0.1
.. pretty darn simple. All my *.dev domains resolve to 127.0.0.1 (localhost). Together with:
[DNS Servers]
127.0.0.1
8.8.8.8
8.8.8.4
..as my Mac's DNS settings, this works a treat.
But then I also have a pretty stock Windows 7 SP 1 VM running in VirtualBox (latest). It uses 10.0.2.* as its IP subnet within Windows. At the moment I have to use a service like http://xip.io + another hostname alias to use my *.dev sites in Windows, e.g:
[ if Mac's local IP is 192.168.1.50 ]
something.dev.192.168.1.50.xip.io
..and I need to have this extra ServerAlias manually set up in my Apache config, and keep it updated each time my local IP address changes.
Is there any way I can set up either dnsmasq, VirtualBox, or my Windows IP settings (or a combination of these) so that I can use my .dev hostnames (e.g. http://something.dev/) directly from Windows?
Try this:
https://github.com/stackia/DNSAgent
It has functions similar to Dnsmasq server= and address=
and a rule converter: https://stackia.github.io/masq2agent/
If you mean that you want to run something like dnsmasq on your windows vm then I share your pain. I have been trying to get something setup on a windows host to do wildcard localhost sites without doing something like xip.io but I am having problems getting it to work. Dnsmasq on the osx machine I have was a breeze, but trying to get Acrylic DNS to work on windows the same way hasn't worked. I do have it running as a local caching DNS, and it should be doing the wildcard part, but having problems getting over the final steps.
Check it out. Looks neat, free, and a dnsmasq alternative on windows. And if you get it working post your results! I'll do the same if I can get it going.

Resources