Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Connect Virtual PC to local web server without a network Network

I run a development Web server on my Powerbook and frequently test content on Windows browsers via Virtual PC.

The Problem

When I'm not connected to a network (as is often the case for PowerBook users), I don't have an IP address (except 127.0.0.1), so VPC has no address it can use to connect to my local server.

The Solution

Create an alias of your network IP address to the loopback interface (127.0.0.1). In the Terminal, type:

sudo ifconfig lo0 inet 192.168.0.1 netmask 255.255.255.0 alias
IP addresses have been changed to protect the innocent; replace 192.168.0.1 and 255.255.255.0 with your actual network IP address and subnet mask. VPC (or anything else on your computer) should now be able to connect sans network, but using your network IP address (192.168.0.1 in our example). To remove the alias, type:
sudo ifconfig lo0 inet 192.168.0.1 netmask 255.255.255.0 -alias

NOTE: For any of the above to work properly, you will need to fix a now infamous VPC network bug. If you haven't done so already, enable the Scripts menu in VPC preferences and run the "Set Networking Type" script, and change the network type to Shared Sockets.

    •    
  • Currently 3.20 / 5
  You rated: 3 / 5 (5 votes cast)
 
[19,743 views]  

Connect Virtual PC to local web server without a network | 14 comments | Create New Account
Click here to return to the 'Connect Virtual PC to local web server without a network' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Connect Virtual PC to local web server without a network
Authored by: Alrescha on Sep 15, '03 10:54:20AM

Ok, I'm curious - why doesn't 127.0.0.1 work? It's an IP address as much as any other.

ie: http://127.0.0.1/blah

That's what I use, anyway.

A.



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: adodd on Sep 15, '03 11:07:01AM

127.0.0.1 always points back to the local tcp/ip stack. In VPC, trying to use 127.0.0.1 would try to connect you back into the VPC machine's stack, not the Mac's.



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: Alrescha on Sep 15, '03 11:36:30AM

Oh, right... there are two 'machines' involved. I think I was sent off track by the 'when I'm not connected to a network' comment.

A.



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: willjwade on Sep 15, '03 01:07:11PM

No there arent two machines. Its one silly! One is your mac and the other is a "virtual" machine ;)



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: adodd on Sep 15, '03 11:24:47AM

I decided to use an IP on the range VPC gives my guest OS.

For example, I have an NT box, and the preferences in VPC for Networking are for "Shared Networking".

When doing an IPCONFIG from the command line, it shows my IP address (as given my VPC) as:
IP Address . . . . 192.168.131.69
Subnet Mask . . . 255.255.255.0
Default Gateway . . 192.168.131.254

I decided to use .253 since that's not in use inside VPC and unlikely to be chosen by VPC as an address for my guest OS. So, from the Terminal on my OSX box I typed:

sudo ifconfig lo0 inet 192.168.131.253 netmask 255.255.255.0 alias

This just saves me from having to change this whenever I'm on different networks or get a different DHCP reservation.



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: lloydi on May 16, '05 04:19:18AM

I have opened the scripts settings in VPC and set Networking Type to ‘Shared Sockets'

I have run the ifconfig command on Terminal as so:

sudo ifconfig lo0 inet 192.168.131.253 netmask 255.255.255.0 alias

I then tried to type a web address in a browser running on VPC for a site that is served up using Apache running on the Mac (dev.vwkombi.com). This address works when browsing on the Mac, but does work on Virtual PC ("Address cannot be found").

Have I missed any steps?

Note that I am not on a network of any kind – I want to be able to get VPC to access these Mac/Apache hosted sites without me being plugged in anywhere (developing on a laptop)

Thanks



[ Reply to This | # ]
Set the proxy server
Authored by: tow_adam on Sep 15, '03 01:33:15PM

Another option is to set in the http proxy preferences in IE to your computer's IP address.

1. In IE, go to Tools->Internet Options->Connections->LAN Settings
2. Check the box to use a proxy server.
3. Click Advanced and enter your computer's IP address for the HTTP Server address.
4. Click OK/Apply

You may need to turn on the mod_proxy in Apache. I think that's covered in another hint on this web site.

-adam



[ Reply to This | # ]
Set the proxy server
Authored by: lloydi on May 16, '05 04:31:24AM

I'm a little unclear what settings go where. Could you clarify at all by showing the settings you'd put in to proxy and how that relates to VPC or Mac's IP settings? That would be really helpful :-)



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: Twitch on Sep 15, '03 07:54:56PM

ANyone else have problems updating VPC 6? I actually paid for my copy, and I haven't been able to use it since trying to update it. Anyone have a fix?



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: davec on Oct 30, '03 05:36:11PM

New Problem:
Connect Mac & hosted Virtual PC BOTH WAYS without a network?

I'm developing some cross platform software. Using codewarrior I cross-compile, and can remotely debug the windows version nicely, but only when connected to a network. (Using "Virtual Switch").

However, when there is NO network present, VPC refuses to run with Virtual Switch. Is there a way to manually set the IP addresses or futz with the networking somehow, so that I can see the VPC from the Mac when there is no network present? (and presumably vice versa) Kindof like just using an ethernet cable between 2 computers and setting each's IP address manually? This would rock my world.



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: kdkinsey on Nov 06, '03 04:08:34PM

Here's how I do bi-directional communication between VPC 6.1 and OS X while on the road. I've only tested this on Panther on my PBG4 1GHz, and it only works by sharing internet connection from airport card to built-in ethernet (DHCP served from built-in ethernet). The reverse doesn't work - VPC doesn't see the DHCP server running on the wireless interface. Not sure why. I hope this help!

1. Under System Preferences, set up Sharing to share "Airport" internet connection to "Built-in Ethernet." Apparently OS X will allow this, even though the built-in ethernet interface is inactive. A check with 'ifconfig' will confirm what's happening wrt to Panther's DHCP server. Even more amazing is that VPC will use it.

2. Ensure Virtual PC virtual switch is pointing to "built-in ethernet" and crank up (for me, XP Pro) with DHCP under windows.

3. That's it. After that, OS X can ping the VPC instance at the DHCP address assigned to it via internet sharing. VPC can ping the OS X Airport IP address (for me a fixed IP unrelated to any active airport network in the car). The apps communicate brilliantly between one another - no wires/routers/hubs necessary. Quite fast, too!

K



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: raprice on Feb 09, '04 06:31:24PM

You're describing exactly what I need to do (attach to a server running under W2K in VPC from a client on the Mac side -- without a LAN connection; running VPC 6.01, Panther on iBook G4)). However, I cannot get it to work as you describe (i.e. I cannot ping the W2K IP from the Mac). Perhaps some details will help.

1. Under System Preferences, set up Sharing to share "Airport" internet connection to "Built-in Ethernet." Apparently OS X will allow this, even though the built-in ethernet interface is inactive. A check with 'ifconfig' will confirm what's happening wrt to Panther's DHCP server. Even more amazing is that VPC will use it.
**What command & args do I use in terminal to see if this is working. I get
usage: ipconfig <command> <args> the command line in terminal.**


2. Ensure Virtual PC virtual switch is pointing to "built-in ethernet" and crank up (for me, XP Pro) with DHCP under windows.
**Within VPC, Settings: Networking: Virtual Switch, I cannot locate a 'built-in ethernet' option. Where should I be looking? On the W2K side, I get a "DHCP Enabled: Yes" in response to the ipconfi /all command.**

3. That's it. After that, OS X can ping the VPC instance at the DHCP address assigned to it via internet sharing. VPC can ping the OS X Airport IP address (for me a fixed IP unrelated to any active airport network in the car).
**How do you set a fixed Airport IP, i.e. what IP address, subnet and router number should I use? Normally I get these from the isp (to which I plan on NOT being connected).**



[ Reply to This | # ]
Connect Virtual PC to local web server without a network
Authored by: raprice on Feb 09, '04 05:09:05PM

You describe the exact set up I'm trying to use (VPC running a server, trying to connect from the Mac side, but without a LAN hooked up).
Have you been able to solve the problem of no LAN? Does the sudo ifconfig hint from pikupi (starting this thread) work for you?



[ Reply to This | # ]
Communicate on both ways to Virtual PC, Mac OS X or another computer without using a router
Authored by: elgato on May 20, '04 11:52:37PM
To allow a communication on both sides "Mac OS X" & "Virtual PC", I did the following and it worked perfectly, I have a DSL connection and I had to switch the Network location everytime I wanted to connect to VPC or internet. First check if there is any entry for the ethernet/port
 en0 
by typing in the Terminal window:
 ifconfig -a 
it should be in the begining of the line "en0:", in my case I had no entry for "en0". Type the command:
 sudo /sbin/ifconfig en0 alias 192.168.1.2 
to remove:
 sudo /sbin/ifconfig en0 -alias 192.168.1.2 

You can put of course any IP address. ;-)

On VPC I have Windows installed and have set the Network TCP/IP settings as follows (Fixed IP Address):
IP Address: 192.168.1.4
Subnet Mask: 255.255.255.0
Gateway: 192.168.1.2 (I'm not sure if it makes any difference, but I entered the Mac IP Address as mentioned above).

On Virtual PC, you have to set the Networking preferences of the Virtual Machine to "Virtual Switch".

You should be able to communicate on both ways. I have installed a server application on VPC and it worked fine. From the PC I was able to connect to my local Apache Web server.

Additional tip, you can also communicate with a second computer that way. I have a mini network with 2 computers connected via ethernet. The second computer has the address 192.168.1.5. This tip allows me to surf on my Mac via my standard internet connection and connect at the same time on my 2nd PC (not connected to the internet) and to VirtualPC.

I hope this will help some of you.
Best regards



[ Reply to This | # ]