VMWare fusion: connecting to host's web server from guest - webserver

I am a web developer and my development platform is Mac. I have installed a copy of Windows XP in VMWare fusion for testing purposes and using IE for previwing my websites. I have Apache running on my Mac with several subdomains, like test.localhost etc.
How can I access the webserver on host OS from the guest OS?
Thank you in advance.

Using Fusion 6.0.2 on OS X 10.9 Mavericks
In the host system (Mac)
turn off your virtual machine
open the "Virtual Machine | Network Adapter | Network Adapter Settings..." menu
in the "Bridget Networking" section choose "Autodetect":
turn on your virtual machine
In the guest system (Win7)
right click on the Notepad application, then select "Run as administrator":
when Win7 asks: "Do you want to allow the following program to make changes to this computer?"
click on the "Yes" button
navigate to: "Computer | Local disk (C:) | Windows | System32 | drivers | etc"
select "All files" in the drop down menu on the right of the "file name:" field
double click the "hosts" file
In the host system (Mac)
open your system preferences and select "Network"; in your connected interface look for the Mac IP:
192.168.1.106 in the example
In the guest system (Win7)
in your notepad window enter the Mac IP followed by the sites you want to reach in your host (Mac) system:
in the example I configured two sites: localhost and caeb.leo
open the browser and you will be able to see the sites hosted on your host system:
Hope it helps!

VMWare Fusion registers an IP address on your Mac and you can use this to point to the host from the virtual machine. You can find it with ifconfig vmnet8. Mine's 192.168.36.1, yours might be the same.
If you're using apache virtual hosts and you try to get http from this address on your virtual machine, it will probably display the default apache page. You'll need to map the domains on your windows host:
Open C:\WINDOWS\system32\drivers\etc\hosts in Notepad and add your hostnames, 1 per line:
192.168.36.1 test.localhost
Then, when you put http://test.localhost/ in IE, it will route to your Mac's apache virtual host.

Andrew's answer, while correct, is missing a significant portion, namely that vmnet8 is only used when the guest OS is set to use the Bridged network option.
If your guest OS is using the NAT network option, as seen in this Windows host example, you would need to use vmnet1 instead.
In this case, the IP of vmnet1 192.168.119.1 allows access to the host webserver, while the IP of vmnet8 leads nowhere.

note, I provide this answer for those who, like me, have the same question as the title but not the exact same specifics of running Apache as a raw local installation
double note, this answer is a mix of Andrew and Camaleo's answer since neither worked in my set up (not pointing to Mac's ip and Bridged Networking's "Autodetect" wasn't working for some reason?) , not sure if the inclusion of Docker Machine causes the hiccup
If you're setup is like so:
(Host) Mac (example ip 192.168.1.249)
(Guest) Docker Machine (example ip 192.168.99.102)
Apache (port 80)
VMware Fusion 10
(Guest) Windows 10 (example ip 192.168.68.142)
Step 1
From within Windows 10 VM open Notepad as Administrator (right click notepad for the option). Navigate to C:\Windows\System32\drivers\etc and instead of Text Documents(*.txt) select All Files. Open the hosts file and add a hosts entry for your Docker Machine's IP(via docker-machine ls). Per our above example setup, the line would look like so:
192.168.99.102 myapp.test # or some other fitting name
Save changes.
Step 2
Note: No need to stop or restart your virtual machine in VMware Fusion 10 when making network changes.
From VMware Fusion Menus select Virtual Machine / Network Adapter / Network Adapter Settings. Choose Share with my Mac.
if "Share with my Mac" is already selected, select a different network adapter option (like Bridged Network Automatic) and then re-select "Share with my Mac" to ensure host file changes are taken
Step 3
Test changes are in place from within Windows VM by pinging the desired address (e.g "myapp.test" as shown above) or by opening Edge/Chrome checking if the webpage loads
note, using a domain name that ends in .test is recommended or Chrome may still have issues with HSTS errors

Related

How can I set up virtualbox to connect to both external internet and localhost.mysite.com server?

I am trying to use a Virtual Box VM to create a development environment I can share with a few dozen other developers. We are all on an internal network and need to connect to external web sites via proxy server. On the VM (guest) I am putting:
windows 10 64 bit
weblogic server
Several other dev tools
My requirements are:
From the guest OS I need to be able to hit the internet (ie google.com)
From the guest OS I also need to be able to open chrome and hit the server webpages running on the guest OS using mysite.com:8007/index.html.
I have modified the guest OS host file such that 127.0.0.1 maps to mysite.com. Ideally that should mean anything going to mysite.com will get resolved to 127.0.0.1.
Our proxy to reach the internet is http-proxy.mysite.com:80. I am able to connect to the internet (pages like www.google.com) as long as I enable the proxy (http-proxy.mysite.com:80) in chrome proxy settings. However I need to be able to enter mysite.com:8007/index.html in the browser and be able to load the homepage. I am able to hit the server using localhost:8007 but I need mysite.com:8007 to work since authentication cookies wont get passed correctly to localhost:8007 urls.
When I enter mysite.com:8007/index.html in chrome it keeps trying to redirect to the IP address of the host OS 10 . * . * . * and the server is not running on the Host OS.
When I enter 'curl mysite.com:8007/index.html' in a command prompt on the guest OS it actually does prints the correct response from my server (no idea why chrome is different / not respecting the host file config).
Any idea how to configure Virtual Box or chrome such that the external pages as well as the guest server pages work?
For internet access on VM, you need to configure network card as BRIDGE, NAT or NAT NETWORK. In your case NAT NETWORK will be better solution, because this will allow you bo be you VM visible in network, just like your Host.
If you have and Internal network you mus have also another card configured for VM for internal network.
To be your VM accessible from Internal Network via http... the coomputers in network have to setup DNS entry pointing to your VM.

VMWare: Unable to access web server running on guest OS (Oracle Enterprise Linux 6.5) from host (Windows 7)

I am hosting a Oracle Linux 6.5 OS using VMWare on my windows 7 laptop. The VM is configured to use NAT networking configuration, and I am able to ping the guest OS successfully from my windows machine. Also, I am able to access internet from within my guest OS.
However, I am unable to access a web application running on port 8080 on a web server hosted within the guest OS using a browser in my host OS. The application is however accessible when accessed from a browser within the guest OS.
Some observations that may be of some use:
1. Neither my laptop, nor the VM have a static IP address.
2. I am able to ping my guest OS from host, and vice versa
3. Firewalls are disabled on both my laptop as well as the guest OS
Any help would be highly appreciated
The reason for the above issue could be mostly because of firewall settings/rules enabled in guest OS OEL. To check the rules you can type iptables -L -n at bash prompt which will display FILTER rules (CHAIN INPUT/OUTPUT/FORWARD).
Adding filters to allow the host to access guest http protocol would make things work. On the other hand, if this is for developmental purposes you can completely disable the firewall filter by saying
service iptables stop. Keep in mind that this is not a safe approach as it exposes your guest to the world without a firewall especially if you are using a bridged network connection.

How can I debug Windows in one VM from another VM using VirtualBox?

I am working on some start-up (pre-logon) code for Windows 7, and would like to be able to debug it (if only to see how it really works, as Microsoft's documentation is terrible).
My environment is VirtualBox on a Linux host, with three Windows VMs (a Windows 2008 domain controller, a Windows 7 dev machine, and a Windows 7 test machine), and I'd like to be able to debug the startup process of the test machine remotely from the dev machine using a virtual serial connection two virtual machines.
[I have, in another life, debugged Linux kernel drivers in one linux VM from another using VMware workstation on a Windows host so I know that this sort of thing is potentially doable.]
I've seen people using windbg to debug Windows in a VirtualBox VM from the host, but I need to do it from a second guest (because my host is non-Windows). Has anyone figured out how to do that?
Edit:
I had tried the obvious approach before I posted. I created a virtual serial port in each VM configuration and attached them both to the same host pipe, to be created by the dev VM (debugger) and used by the test VM (debugee). I then ran
bcdedit /dbgsettings serial debugport:1 baudrate:115200
bcdedit /debug {current} on
in the test VM and shut it down. Ran windbg in the dev VM selected kernel debugging (on the correct serial port) and restarted the test VM. Some messages appeared about not having any symbols available and the test VM hung.
I have since found this article: http://www.benjaminhumphrey.co.uk/remote-kernel-debugging-windbg-virtualbox/ which (although that guy is using a Windows host) seems to describe exactly the method I'd tried, but his test VM doesn't hang. The output I get in the wndbg window is the same as his, but stops before the line staring "Windows XP Kernel ..."
I'm now less sure that this problem is related to VirtualBox and more unsure as to whether I'm using windbg correctly. Any help would be appreciated.
Another Edit I have tried attaching the virtual serial port of the Test VM to a host file, and I get some debugging output in the file. I have tried setting the virtual serial ports of the two VMs to point to a host pipe and running a terminal (rather than WinDbg) in the Dev VM, and I get debugging information in the terminal.
I think I've now determined that this is definitely a problem with WinDbg rather than VirtualBox (I'll remove the virtualbox tag and replace it with windbg) but I'm not sure why WinDbg isn't talking.
More information:
I've just upgrade Upgrading to VirtualBox 4.2.4 (not sure whether the version matters) and have looked at this again.
I rebuilt the test VM and was more patient!
It now seems that the test VM is running - and I do eventually get some output in the windbg window - but it takes about 15 minutes for the debuggee OS to boot! This is clearly not useful for day-to-day kernel debugging. I have no idea why this should be so slow ... there is no perceptible slowdown if I run a simple terminal in the dev VM instead of windbg (though, of course, the debug information is then mostly garbage).
Any ideas?
I realize this is one helluva necro, but...
Have you tried setting up the debugee for kernel-mode network debugging? I'm thinking that the slowdown is in a large part because serial is so g.d. slow.
http://msdn.microsoft.com/en-us/library/windows/hardware/hh439346%28v=vs.85%29.aspx
If/when M$ decides to rot away that link, these parts of above article are what you need to do to get this set up:
Setting Up the Target Computer
To set up the target computer, follow these steps:
Verify that the target computer has a supported network adapter.
Connect the supported adapter to a network hub or switch using standard CAT5 or better network cable. Do not use a crossover cable, and do not use a crossover port in your hub or switch.
In an elevated Command Prompt window, enter the following commands, where w.x.y.z is the IP address of the host computer, and n is a port number of your choice:
bcdedit /debug on
bcdedit /dbgsettings net hostip:w.x.y.z port:n
bcdedit will display an automatically generated key. Copy the key and store it on a removable storage device like a USB flash drive. You will need the key when you start a debugging session on the host computer.
Note We strongly recommend that you use an automatically generated key. However, you can create your own key as described later in the Creating Your Own Key section.
If there is more than one network adapter in the target computer, use Device Manager to determine the PCI bus, device, and function numbers for the adapter you want to use for debugging. Then in an elevated Command Prompt window, enter the following command, where b, d, and f are the bus number, device number, and function number of the adapter:
bcdedit /set "{dbgsettings}" busparams b.d.f
Reboot the target computer.
And to connect to it, use the following steps:
Using WinDbg
On the host computer, open WinDbg. On the File menu, choose Kernel Debug. In the Kernel Debugging dialog box, open the Net tab. Enter your port number and key. Click OK.
You can also start a session with WinDbg by opening a Command Prompt window and entering the following command, where n is your port number and Key is the key that was automatically generated by bcdedit when you set up the target computer:
windbg -k net:port=n,key=Key
If you are prompted about allowing WinDbg to access the port through the firewall, allow WinDbg to access the port for all the different network types.
Using KD
On the host computer, open a Command Prompt window. Enter the following command, where n is your port number and Key is the key that was automatically generated by bcdedit when you set up the target computer:
kd -k net:port=n,key=Key
If you are prompted about allowing KD to access the port through the firewall, allow KD to access the port for all the different network types.

VirtualBox VM guest to pop up a window to the host machine

Question mark
I'm wondering whether it's possible for the VM guest machine to pop up a window to the MS-Windows host machine once a task is done within the VM (not an email). If I'm not dreaming, how to achieve that ?
Why
The VM is a simulator for a production server. Code is written within the host IDE and tested straight into the VM. So files are transferred manually from the IDE to the VM, and then automatically moved, formatted, chmoded, chowned and so on in the VM. This process can take a while, so I want to warn the devleopper once the process is over. The developper have no access to the VM and shall not necessary have one.
Config
Tool: VirtualBox 4.1
host: MS-Windows XP or Windows seven
guest: VM Debian
shared dir: yes
network : bridged connection
If this ability existed, it would be quite a security hole in VirtualBox. Guest VMs gaining access to the host machine's OS is not a good thing! As such, I don't think it's possible to accomplish this in a supported manner.
Instead, think of it as two separate machines. What mechanisms do you have for causing alerts or popups on one machine from another? Is anything like IMs, netsend, etc enabled in your environment?

rdp web client of virtualbox

thank you for reading my question.
I want to login the virtual machine romotely through rdpweb shipped with virtualbox sdk.Of course, the virtual machine was installed in the virtualbox.The rdpweb(a folder) contains 4 files, webclient3.html, swfobject.js, webclient.js and RDPClientUI.swf.
Firstly, I copy rdpweb to the /.../tomcat/webapp. So i can visit webclinet3.html now. And there is a image which shows what i get.Sorry, i haven't enough reputation for posting a image.I just can put a link to the image.
http://i.minus.com/jbdHDzjWwQntWQ.PNG
An error happened. Google says that putting the crossdomin.xml to the root of webapp would solve the bug.The bug may be aroused by flash.But it is invalid for me. Why ?
My physical host is win7(ip:192.168.1.107), and my virtual guest is windowsxp(ip:192.168.1.111). The version of the virtualbox is 4.1.8.
Any help would be appreciated!Thank you very much.
I am so sorry for my poor english.
Update:
Your configuration looks like you have configured your WinXP guest with a bridged network adapter, and you are trying to connect directly to it. Have you enabled Remote Desktop on the WinXP guest? Go to the Control Panel -> System applet, then choose the remote tab and be sure to check both boxes to allow remote desktop connections. You will also need to make sure the firewall will allow this connection to the guest.
VirtualBox also have the capability to serve up a virtual machines display over RDP or VNC (VNC in the OSE - Open Source Edition). If you are wanting to use that capability then you should be connecting to the HOST IP address - not the guest. Since your host is Windows 7 you will also need to adjust the Remote Display Server Port for your guest (in the VM Settings in VirtualBox) to use a port besides 3389. I usually pick 3390. Your screenshot doesn't show somewhere you can enter the TCP port, so this approach may not be supported, but you could try appending :3390 to the IP address.
Original Answer:
Could you post the crossdomain.xml file you are currently using? This is almost certainly a problem with it.
My guess is that your crossdomain.xml file should look something like this:
<?xml version="1.0"?>
<!-- http://127.0.0.1:8080/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="192.168.1.111" />
</cross-domain-policy>
You could start with just putting * instead of the IP address in the file as well - though that is generally not recommended as it opens the possibility that the flash player can access any resource on any network. It would make it easier to access other virtual machines you might use in the future with different addresses.