Guest to Guest network

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Guest to Guest network

Post by captainmatt29 »

Hi There

So far I’ve got 2x Mac OS 9.2.2 VMs setup working and with internet access but the machines can’t reach each other despite sharing the same subnet.

Is there a simple way for me to get them to see each other? I’m very new to this side of things and virtualisation so a walkthrough would be useful.

I’m so close to reaching my goal but this last bit I can’t work out.
User avatar
adespoton
Forum All-Star
Posts: 4277
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Guest to Guest network

Post by adespoton »

https://wiki.qemu.org/Documentation/Networking

By default, you're using the SLIrP option.

You don't say what your host OS is, so there's not too much we can do beyond pointing you at this documentation.

Your options are to punch ports through to the host over SLIrP, use a tap device, or use a socket device.

For two guests running on the same host, socket is the best solution.

Your problem stems from the fact that every instance of QEMU is its own virtual network; each one provides a subnet to the guest, using the same address, but they are different networks (just like many people use the same subnet of 192.168 for their home network).

If you're running QEMU on multiple computers, you'll need to use port forwarding or tap devices instead.
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Re: Guest to Guest network

Post by captainmatt29 »

Mac OS Catalina is the host I’m using.

So what would I need to do to get two machines talking or is there another option for virtualising Mac OS 9.2 that would be easier to work with as SheepShaver stops at support for 9.0.4 and I need 9.2 for the software I’m using.
User avatar
adespoton
Forum All-Star
Posts: 4277
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Guest to Guest network

Post by adespoton »

captainmatt29 wrote:So what would I need to do to get two machines talking
adespoton wrote:If you're running QEMU on multiple computers, you'll need to use port forwarding or tap devices
To get a tap device working, you can follow the instructions for BII and SheepShaver, and then bring the tap device with QEMU instead. This is NOT going to be a simple thing to do on Catalina.

Easier to just open the ports you need and let the devices talk to each other; the host is essentially the router here, and your guests are NATed on their own subnets.
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Re: Guest to Guest network

Post by captainmatt29 »

Im happy go go the easiest routes so they can talk to each other I just need to learn how to do that.

Im running QEMU on one computer running 3 virtual instances of OS 9.2
User avatar
adespoton
Forum All-Star
Posts: 4277
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Guest to Guest network

Post by adespoton »

captainmatt29 wrote:Im happy go go the easiest routes so they can talk to each other I just need to learn how to do that.

Im running QEMU on one computer running 3 virtual instances of OS 9.2
adespoton wrote:For two guests running on the same host, socket is the best solution.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7832
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Guest to Guest network

Post by Ronald P. Regensburg »

adespoton wrote:
adespoton wrote:For two guests running on the same host, socket is the best solution.
I think captainmatt29 is asking for instructions how to do that.
User avatar
adespoton
Forum All-Star
Posts: 4277
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Guest to Guest network

Post by adespoton »

Might as well duplicate it here :)
Socket
The socket networking backend allows you to create a network of guests that can see each other. It's primarily useful in extending the network created by the SLIRP backend to multiple virtual machines. In general, if you want to have multiple guests communicate, the tap backend is a better choice unless you do not have root access to the host environment.

-netdev socket,id=mynet0,listen=:1234
-netdev socket,id=mynet0,connect=:1234
So you'd set one QEMU instance to be the host, and put the listen line on it, and all the other QEMU instances would use the connect line. You can also put an IP/domain in front of the colon; the absence there implies 127.0.0.1 or localhost as the interface being communicated over.

I suppose you could also spin up QEMU on a Linux server on the network, configure it with Tap access to everything else, and slave the macOS QEMU to its network, thereby (slowly) bypassing all the macOS networking issues.
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Re: Guest to Guest network

Post by captainmatt29 »

So I added this

-netdev socket,id=mynet0,listen=:1234

To the command file I launch the vm from and there isn't another adapter showing in OS9 along side the existing network adapter see below ... do I need to change the 1234 ? It would be good if I could get the Mac to see itself in a localhost format to test.

I tried to see if it could connect to a lamp install own itself and it could not.

./qemu-system-ppc -L pc-bios -cpu "g4" -boot c -M mac99 -m 768 -hda EXTRA.img -cdrom 9.2.2.iso \
-netdev user,id=mynet0 -device sungem,netdev=mynet0
-netdev socket,id=mynet0,listen=:1234
User avatar
Cat_7
Expert User
Posts: 6172
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Guest to Guest network

Post by Cat_7 »

You need to set specific ports to connect to. And you need to set the tcp/ip address of host and guest manually.
This will work for connecting http (port 80) traffic to a guest:

On the host machine:
-device sungem,netdev=net1,mac=52:54:00:12:34:56 -netdev socket,id=net1,listen=:80

On the guest machine:
-device sungem,netdev=net2,mac=52:54:00:12:34:54 -netdev socket,id=net2,connect=127.0.0.1:80

If you then enable e.g. personal web sharing on the host (listener), you can connect from the guest by entering the host ip address in the browser.
File sharing will also work if set over tcp/ip.

Best,
Cat_7
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Re: Guest to Guest network

Post by captainmatt29 »

Cat_7 wrote:You need to set specific ports to connect to. And you need to set the tcp/ip address of host and guest manually.
This will work for connecting http (port 80) traffic to a guest:

On the host machine:
-device sungem,netdev=net1,mac=52:54:00:12:34:56 -netdev socket,id=net1,listen=:80

On the guest machine:
-device sungem,netdev=net2,mac=52:54:00:12:34:54 -netdev socket,id=net2,connect=127.0.0.1:80

If you then enable e.g. personal web sharing on the host (listener), you can connect from the guest by entering the host ip address in the browser.
File sharing will also work if set over tcp/ip.

Best,
Cat_7
I did add these to the command files for each and neither of them can communicate still also on the host it runs a Macintosh manager server which can't even see itself :-O Is this because I need to open specific ports by any chance but also allow them to see themselves as well as the guest ?

Sorry for the dumb questions this is something way above my usual.

I don't feel like this works;

./qemu-system-ppc -L pc-bios -cpu "g4" -boot c -M mac99 -m 768 -hda EXTRA.img -cdrom 9.2.2.iso \
-netdev user,id=mynet0 -device sungem,netdev=mynet0
-device sungem,netdev=net1,mac=52:54:00:12:34:56 -netdev socket,id=net1,listen=:80

Both machines now have the MAC as per the one above but no connectivity to each other.
User avatar
Cat_7
Expert User
Posts: 6172
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Guest to Guest network

Post by Cat_7 »

If that is your exact command line, then I can tell you exactly what is wrong:
The third line is not read if you do not close the second with a "\". ;-)

This is what works over here (in windows, so replace ^ with \ and adjust executable name, etc)

Host:
qemu-system-ppc.exe ^
-L pc-bios ^
-boot c ^
-m 512 ^
-M mac99,via=pmu ^
-sdl ^
-drive file=c:\Mac-disks\9.2.img ^
-device sungem,netdev=net1,mac=52:54:00:12:34:56 ^
-netdev socket,id=net1,listen=:80

Guest:
qemu-system-ppc.exe ^
-L pc-bios ^
-boot c ^
-m 512 ^
-M mac99,via=pmu ^
-sdl ^
-drive file=c:\Mac-disks\9.1.qcow ^
-device sungem,netdev=net2,mac=52:54:00:12:34:54 ^
-netdev socket,id=net2,connect=127.0.0.1:80

Remember to set tcp/ip in both Mac OS's to manual and give them different free ip addresses fitting to your network. In my case my DCHP server issues ip addresses from 192.168.0.2 to 192.168.0.49, so I used the free 192.168.0.51 and 192.168.0.52 addresses and subnet 255.255.255.0 for both.

Oh, and there is no internet from both Mac OS, only traffic between the two Mac OS's.

Best,
Cat_7
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Re: Guest to Guest network

Post by captainmatt29 »

Oooooooh!

Is there a way to have Internet access too?

It’s not compulsory obviously, I’m using static IPs at the moment

Host 10.0.2.15
Guest 10.0.2.16

But using the DHCP supplied DNS and router addresses.
captainmatt29
Student Driver
Posts: 10
Joined: Fri May 15, 2020 4:55 pm

Re: Guest to Guest network

Post by captainmatt29 »

Cat_7 wrote:If that is your exact command line, then I can tell you exactly what is wrong:
The third line is not read if you do not close the second with a "\". ;-)

This is what works over here (in windows, so replace ^ with \ and adjust executable name, etc)

Host:
qemu-system-ppc.exe ^
-L pc-bios ^
-boot c ^
-m 512 ^
-M mac99,via=pmu ^
-sdl ^
-drive file=c:\Mac-disks\9.2.img ^
-device sungem,netdev=net1,mac=52:54:00:12:34:56 ^
-netdev socket,id=net1,listen=:80

Guest:
qemu-system-ppc.exe ^
-L pc-bios ^
-boot c ^
-m 512 ^
-M mac99,via=pmu ^
-sdl ^
-drive file=c:\Mac-disks\9.1.qcow ^
-device sungem,netdev=net2,mac=52:54:00:12:34:54 ^
-netdev socket,id=net2,connect=127.0.0.1:80

Remember to set tcp/ip in both Mac OS's to manual and give them different free ip addresses fitting to your network. In my case my DCHP server issues ip addresses from 192.168.0.2 to 192.168.0.49, so I used the free 192.168.0.51 and 192.168.0.52 addresses and subnet 255.255.255.0 for both.

Oh, and there is no internet from both Mac OS, only traffic between the two Mac OS's.

Best,
Cat_7
I'm afraid this doesn't work, it throws an error and won't start

qemu-system-ppc: -device sungem,netdev=net1,mac=52:54:00:12:34:56: Property 'sungem.netdev' can't find value 'net1'
/Users/mattblackwood/Downloads/Qemu-4.2-OSX-Catalina-21-12-2019/qemu.command: line 6: -netdev: command not found

The format is also not supported on the Mac too it must follow as per my entry above due to spacing and random characters
User avatar
Cat_7
Expert User
Posts: 6172
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Guest to Guest network

Post by Cat_7 »

This is all very surprising, I don't know what you are doing wrong. Check your text editor to not replace dashes and do other "smart" stuff.

This works on my Catalina VM (copied from textedit):

#!/bin/bash
cd "$(dirname "$0")"

./qemu-system-ppc -L pc-bios -M mac99,via=pmu -m 128 \
-drive file=~/Mac-disks/9.2.img,format=raw,media=disk \
-device sungem,netdev=net1,mac=52:54:00:12:34:54 \
-netdev socket,id=net1,listen=:80

Best,
Cat_7
Post Reply