How to access local host from vmware on mac? - vmware

How can I access local host from vmware on mac? I have Modern IE image running in vm ware. I want to be able to access localhost address from the iE.
I have the following in my /etc/hosts file on my mac:
127.0.0.1 example.example.com
127.0.0.1 beta-example.example.com
I want to be able to access beta-example.example.com from vmware VM.

(update: I just did a test on my IE11 - Win8.1 from modern.ie without Charles running for a local domain and it works. Charles is only needed for me when I'm trying to access a Vagrant VM that has a unique IP)
I've been using Charles with macOS and Vagrant, but you can do this without Charles for localhost macOS domains.
If you look at your local /etc/hosts file for your domains it's going to have the 127.0.0.1. For example, mine has:
# local macOS /etc/hosts
127.0.0.1 workalicious.dev
::1 workalicious.dev
Take a look at your local macOS > System Preferences > Network and grab your IP address, currently mine is 10.1.10.146. In the VM run Notepad as the Administrator and open C:\Windows\System32\drivers\etc\hosts
In that hosts file on the VM add that IP address you just got from the local macOS and include it with your localhost domain in you VM's hosts file, for example:
# VM's C:\Windows\System32\drivers\etc\hosts
10.1.10.146 workalicious.dev
You should be able to browse to your localhost domain name on the VM, it's linked through the VM's hosts file and your local IP address. Make changes to the files and see the updates on the VM. Great for testing in IE or other browsers on the VM.
(next bit only if you are using a VM with Vagrant, you don't need Charles for localhost domains)
Start Charles and allow proxying. Now that you have the local IP in the VM hosts file, open up IE and go to the gear (top right for IE11) select Internet Options > Connections > LAN settings then check the Proxy server and add your local macOS IP to Address: XX.X.XX.XXX with the Port: 4444
Then when you browse to your domain, Charles on the macOS should alert and you can allow, then you should see your local macOS domain on your VM's browser. You can make changes locally and refresh and see the changes on the VM.
The only bummer is Charles isn't free, but worth the $50. It's great for doing a similar approach on a mobile browser within the your local network, only easier!
I started using Charles for mobile then thought I'd try for VMs using Vagrant, works great with the Proxy settings in IE.

Related

Local Server not loading in Ubuntu VirtualBox

I have laravel app which is running in my windows local server. This laravel app is running port:80. I want to load this app in my Ubuntu VirtualBox.
My IP Config:
IPv4 Address : 192.168.8.157
Subnet Mask : 255.255.255.0
Default Gateway: 192.168.8.1
I have config my virtualbox as Bridged Adapter. In my /etc/hosts (ubuntu virtualbox), I have this :
127.0.0.1 localhost
127.0.1.1 asus
192.168.8.157 v2.my.local
I have made a hello word app (node.js) in my local windows which is running on port :3000, and it is running in my VirtualBox by typing v2.my.local:3000, but if I type v2.my.local on my VirtualBox, it is not working (although app is running on windows local machine). it says:
This v2.my.local page can’t be found
Any suggestion? Thanks in Advance.
May be windows firewall blocking connections via port 80. turn off firewall and try it, if it works. Start windows firewall and add firewall rule to allow connections via port 80. If your windows version is 10 then, it will block all virtual box related connections. make sure to add correct rules.

how could i connect to Ambari from hortonworks through url "sandbox.hortonworks.com:8080"?

i got installed Hortonworks data platform (HDP 2.4) on oracle virtual box, when i trying to use storm streaming analytics it uses to connect ambari by url
sandbox.hortonworks.com:8080
instead of
127.0.0.1:8080
loop back address and i got an error message over browser
Error : This site can’t be reached
so tell me that how could i assign
sandbox.hortonworks.com:8080
domain name to loop back address from virtual machine OS terminal.
Just add this line
127.0.0.1 localhost sandbox.hortonworks.com
to-
If you're on a windows machine, this file
%systemroot%\system32\drivers\etc\hosts
If you're on a Mac, then, this file
/etc/hosts
This will need to be done for your host machine(the one on which you installed VirtualBox) and not inside the VM.
If you are using bridged mode or host-only-adapter, replace the 127.0.0.1 with your VM's IP, so it should look like
192.168.56.101 localhost sandbox.hortonworks.com
That should help you use the FQDN.

Access web server on VirtualBox/Vagrant machine from host browser?

I have a Django web server on a VirtualBox/Vagrant machine running Ubuntu.
I have followed this guide to create a Django project: https://docs.djangoproject.com/en/dev/intro/tutorial01/
I have a web server running at http://127.0.0.1:8000/ inside my guest machine. This is the first time I am running a Django web server. It is supposed to be a hello world app.
How can I access this web application from my host browser?
I have tried running ifconfig in the guest to get the IP that I should visit I found a promising IP address in inet addr.
But I have tried entering the following into my host browser and it didn't work.
http://inetaddrnumbers:8000/
How can I access the web server from my browser?
Try this.
Open the vagrant file (should be in the directory where you specified to create a new vagrant machine).
Search for config.vm.network. If you didn't setup the file earlier, it should be commented.
Change it to look something like this config.vm.network "private_network", ip: "55.55.55.5". Here ip address (55.55.55.5) can be any ip address you want.
Now logout from the vagrant machine and reload your vagrant machine by this command vagrant reload.
Again ssh to your vagrant machine and restart your django server by this command python manage.py runserver 0.0.0.0:80. Again the port address (80) can be 8000 if you want so.
After that, in your browser, enter the following address 55.55.55.5, and hopefully you should see your webapp.
Now if you would like to go further, you can edit your host file, and add this line
55.55.55.5 mynewdomain.com
Then in your browser, enter the follow address,
mynewdomain.com
And you should see your web app. Note that, www is not added in the domain name inside the host file, so only mynewdomain.com can be accessed. You can however add it.
Hope this helps. Cheers.
Complementing #Kakar answer, this configuration can also be done using this:
config.vm.network "private_network", type: "dhcp"
This will assign an IP automatically.
For further reading: https://www.vagrantup.com/docs/networking/private_network.html

How do I hit a modified /etc/hosts from VirtualBox

I have an app that I have to change the /etc/hosts file to be able to hit. Here is my new file.
#127.0.0.1 localhost
127.0.0.1 local.connectwithme
This works easily on my local machine. I just go to local.connectwithme:3000 in my browser and I am able to view my app.
I am now trying to view it with VirtualBox running Windows 7. Typically I would just go to the ip address 10.0.2.2 in the browser of the virtual machine and access the localhost of my host machine from the VirtualBox, but now that I have changed the /etc/hosts file on my host machine I don't know what I need to hit to see my app on the virtual machine. Could someone please explain this to me. Thanks.
To access the host OS when using a NATed Virtual Box connection, you need to determine the IP address of the host OS (on the other side of the NAT) and then add this IP address to the hosts file on your guest OS:
From within the guest OS, determine your default gateway. This will be the IP address of the host OS. The easiest way to do this is to open a command prompt and run ipconfig /all. Under the Ethernet adapter, find the Default Gateway. This is almost certinaly 10.0.2.2 if you haven't changed anything.
Now, find your hosts file and add the host IP address. On Windows 7, this file is located in %systemroot%\system32\drivers\etc\.
Start Notepad with administrator privileges (Start|Run, type "notepad", right click and choose "Run as administrator."
Open up %systemroot%\system32\drivers\etc\hosts in Notepad (you'll need to change it to show all files).
Add an entry to the hosts file mapping the host IP address to the hostname you want, such as: 10.0.2.2 local.connectwithme

how to access django development server on virtual machine from actual computer

Okay so I have my actual laptop which has vmware player installed. I am running lubuntu as a virtual machine and I installed django on the virtual machine and am testing my app so I did python manage.py runserver and I can access the app by visiting 127.0.0.1:8000 from my VM, however, If I go to 127.0.0.1:8000 from the actual computer (not the VM), it says 'chrome could not connect to 127.0.0.1:8000'.. Any idea how to fix it?
You can try running the server on 0.0.0.0
python manage.py runserver 0.0.0.0:8000
The IP address 0.0.0.0 means "all IP addresses on the local machine" (or all IPv4 addresses on the local machine).
Next, you will need the ip address of your VM. Visting http://<ip_address_of_vm>:8000 on other computers should access the django development server on your VM.
Note: If your VM only has an internal IP (e.g. 192.168.x.x) then only computers on the same network can visit the VM.
I was able to get #Kerberos answer to work. (not enough points to comment so I'm adding it as a seperate answer).
I am running Ubuntu 12.04 LTS in a guest OS in VMWare. The host laptop is running Windows 8.
As mentioned by Kerberos, in VMWare, go to Player ==> Manage ==> Virtual Machine Settings...
On the Hardware tab, select Network Adaptor, then select the radio button for Bridged: Connect directly to the physical network. Select OK
In the VM, the network connection information should now have the same IP address of the host OS internet connection. In my case: 192.168.1.141 (yours will vary).
In the VM, start Django using python manage runserver 192.168.1.141:8000
Using this method, I am able to access the webserver running in the VM at this IP address from within the VM, from host machine, and from other systems on the same 192.168.1.xxx network.
to access virtual machine (guest) from outside the host computer, you have to set the guest network mode to bridge
Bridge-mode connects the guest to the actual network so that other machines can connect to it