SheepShaver/BasiliskII and TAP devices

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
afberendsen
Inquisitive Elf
Posts: 27
Joined: Fri Jul 21, 2017 3:27 am
Location: Berlin, Germany

SheepShaver/BasiliskII and TAP devices

Post by afberendsen »

I cannot find a topic where to add this information. So, please forgive me if this is already recorded somewhere else.
After few hours of investigations, I managed to setup SheepShaver and Basilik II to use network TAPdevices with Windows 10
It is still a crude process that need some more investigations.
In the _prefs file (.sheepshaver_prefs for U*X and SheepShaver_prefs for BeOS and Windows), add the following lines

Code: Select all

ether tap
etherguid {9D4A41C0-6062-482B-858F-A60B829BA835}
etherfakeaddress 525400123458
  • ether tap indicates that the configuration should use TAP
  • etherfakeaddress indicates that the MAC address to be used by the SheepShaver/basiliskII guest. It should *not* contain any colons. It needs to be 12 characters long exactly.
  • etherguid indicates that the TAP device UUID to be used. The biggest problem is the string for etherguid. The only way I managed to find what is the correct value to use was to dig into RegEdit. My TAP devices are all under

    Code: Select all

    Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Network\
On the guest side, I left the TCP configuration to "DHCP". I tested with Mac OS 9 and 8 and it worked very well. Next step is Mac OS 7....
Each guest, as with QEmu, has to use a unique TAP device. So, I created few TAP devices and renamed them to "mytap??????", where ???? are the last 4 characters for the MAC address. Easy to track who is who.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: SheepShaver/BasiliskII and TAP devices

Post by Cat_7 »

Hi,

This still surprises me. Which Basilisk/SheepShaver builds are you running?
The GUIs included in the latest ones we provide detect the tap devices that have been installed. In my case, I have two that were renamed to: tap0 and tap1. I always have these two inactive tap devices bridged with my default wired ethernet connection.

After selecting tap0 in the Basilisk GUI and tap1 in the SheepShaver GUI and starting both the tap devices are activated. The prefs get updated with the etherguid entry and the unique strings identifying the tap devices are added automatically.
These entries are also cleanly deleted again when I select slirp for networking.

Basilisk and SheepShaver can appletalk to each other in this setup.
No need for the fake mac address over here.

What might be the difference between our situations? Are you attempting to run some other network functionality besides appletalk? I provided you with the details of my tap/openvpn installation earlier.

Best,
Cat_7
afberendsen
Inquisitive Elf
Posts: 27
Joined: Fri Jul 21, 2017 3:27 am
Location: Berlin, Germany

Re: SheepShaver/BasiliskII and TAP devices

Post by afberendsen »

The default MAC address for SheepShaver and BasiliskII, is the same as for QEmu: 52:54:00:12:34:56
With the default set-up, you cannot have more than one Basilisk/SheepShaver/QEmu instance running using TAP since it will conflict with the MAC address and ARP tables will be invalidated.
As for QEmu, using the

Code: Select all

-netdev tap,ifname=mytap3322,id=mynet0 -device sungem,netdev=mynet0,mac=52:54:00:12:33:22 \

to change the internal NIC MAC address, for SheepShaver and BsiliskII, I had to use

Code: Select all

ether tap
etherguid {FA628DBA-0CB5-495B-97CE-2AE513F9E4A4}
etherfakeaddress 525400123384
for the same purpose.
With my set-up, using the plain product configuration, I can have as many instances of those three emulators running, bridged into the real network, with full access in all directions.
All emulators are the latest binary available from emaculation.
Next step is to find a way to use the TAP name instead of the TAP UUID. However, the SheepShaver/BasiliskII paramater is called EtherGUID for some reason....
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: SheepShaver/BasiliskII and TAP devices

Post by Cat_7 »

Hi,

Yes, I understand what you are doing. What I don't understand is that I don't need the fake address to get Basilisk/SheepShaver to use two different tap devices and have an appletalk connection.
The GUIs in your Basilisk and SheepShaver downloads do not list the tap devices when you select an Ethernet interface at the network tab?

For Qemu you are right, a different mac addresses is needed for every tap device.
From the guide:
To allow two qemu instances to “see” each other on the network and also have internet access, you can install a second tap device and bridge both tap devices with the default network connection. You must then also use different mac addresses for each connection. Note that the tap devices should have different names.

-netdev tap,ifname=TapEthernet1,id=network01 -device sungem,netdev=network01,mac=52:54:00:12:34:56
-netdev tap,ifname=TapEthernet2,id=network01 -device sungem,netdev=network01,mac=52:54:00:12:34:66

This might point to this being required for Basilisk/SheepShaver too, but I haven't had issues related to the mac address.
I could be wrong but the tap-enabling etherhelper code might be included in the source and I seem to remember it will create different mac addresses for these two each time they are launched.

Best,
Cat_7
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: SheepShaver/BasiliskII and TAP devices

Post by adespoton »

Cat_7 wrote: Wed Nov 18, 2020 1:35 pm I could be wrong but the tap-enabling etherhelper code might be included in the source and I seem to remember it will create different mac addresses for these two each time they are launched.

Best,
Cat_7
Where is the etherhelper source hosted? I don't see it in the cebix repo.

The ether.cpp code appears to just use whatever MAC ID is presented by the Ethernet device. If two emulators use the same MAC, I'd guess that everything would work fine unless two packets end up with the same ID, in which case there'd be a collision, the checksum would fail, and the packet would be dropped with a reset request. Kind of like running an Ethernet device in promiscuous mode.
afberendsen
Inquisitive Elf
Posts: 27
Joined: Fri Jul 21, 2017 3:27 am
Location: Berlin, Germany

Re: SheepShaver/BasiliskII and TAP devices

Post by afberendsen »

The code in SheepShaver/Bsilisk II do creates a pseudo-random MAC address. In fact, it simply uses the memory leftovers from anything that was there before. In other words, it allocates a 6 byte array and fill in the first 3 bytes. The remaining 3 positions are garbage produced by the normal computer operation. However, there is no control about the address creation. So, you can easily have duplicated MAC addresses. This is why the code author added

Code: Select all

               const char *ether_fake_address;
                ether_fake_address = PrefsFindString("etherfakeaddress");
                if (ether_fake_address && strlen(ether_fake_address) == 12) {
                        char sm[10];
                        strcpy( sm, "0x00" );
                        for( int i=0; i<6; i++ ) {
                                sm[2] = ether_fake_address[i*2];
                                sm[3] = ether_fake_address[i*2+1];
                                ether_addr[i] = (uint8)strtoul(sm,0,0);
                        }
                }
#if 1
                /*
                  If we bridge the underlying ethernet connection and the TAP
                  device altogether, we have to use a fake address.
                 */
                else {
                        ether_addr[0] = 0x52;
                        ether_addr[1] = 0x54;
                        ether_addr[2] = 0x00;
                }
The TAP code also, connects to Win32 using

Code: Select all

        TCHAR dev_path[MAX_PATH];
        _sntprintf(dev_path, lengthof(dev_path),
                         TEXT("\\\\.\\Global\\%s.tap"), dev_name);
This piece of code does not look for the tap device name and use the GUUID. As user, you need to provide the GUUID. The QEmu code is doing a lookup for the GUUID.
User avatar
KnuddlMac
Granny Smith
Posts: 123
Joined: Thu Apr 06, 2017 9:32 am
Location: Southern Bavaria

Re: SheepShaver/BasiliskII and TAP devices

Post by KnuddlMac »

Uoops!


Dear gents,

I started to scratch my head as since of this summer I am happy to run "etherhelper/en0" (w/o quotes) with BAII and SheepShaver. Do I break the rules not going via a bridge plus tap?

Here I am lacking more recent documentation getting Catalina and later even Big Sur to support our AppleTalk needs.
At least on a Late 2013 MBP, WiFi access and AppleTalk work nicely with a distributed FoxPro 2.5 database app.

Any hint appreciated,
-Knuddlmac
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: SheepShaver/BasiliskII and TAP devices

Post by Cat_7 »

Where is the etherhelper source hosted? I don't see it in the cebix repo.
The etherhelper was designed by dsumorok. https://www.github.com/dsumorok/macemu
See discussion here ;-) https://github.com/dsumorok/macemu/wiki/OSX-Networking
It is now also in the kanjitalk755 repo.

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: SheepShaver/BasiliskII and TAP devices

Post by Cat_7 »

@knuddlemac:

It's hard to keep track of all appletalk configurations for various OSX versions... If you are using the etherhelper/en0 solution you are actually using a package filter solution under the surface. Using that, my normal internet connection gets blocked (in Sierra).
The tap device required could be installed with tuntaposx but that was no longer working in Catalina, so an installation of Tunnelblick with their tap devices was needed. See the forum for some sketchy remarks on how to implement that.
Their solution now no longer seems to work with Big Sur. You can read up on their status and their position on getting Tunnelblick to work in Big Sur on their website. Long story short: they are not going to humor Apple by following Apple's new guidelines.

Bottom line: for now I know of no way to get appletalk running in Big Sur.

Best,
Cat_7
User avatar
KnuddlMac
Granny Smith
Posts: 123
Joined: Thu Apr 06, 2017 9:32 am
Location: Southern Bavaria

Re: SheepShaver/BasiliskII and TAP devices

Post by KnuddlMac »

@Cat_7:

Thank you for your thoughts about Big Sur. I followed the forum link above and also read the scary analysis of the developer version.
Similar to all things in life: By the time you reach your goal, a new one gets defined. - So we will get our next challenge. J

I followed your tutorials and were in contact with a couple of contributors over the course of this year. All information is available, but scattered all over the places. With Catalina SIP and handling of kernel extensions became necessary and thanks to tuntaposx (I think they are also notarized by now?) and Tunnelblick we have what we need.

Maybe for the future on Big Sur another approach containerized or on a virtual machine. - Let's see.


Don't spend all your weekend tinkering like me, you might miss the real world outside! :shock:

Best,
Knuddlmac
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: SheepShaver/BasiliskII and TAP devices

Post by Cat_7 »

Haha, thank you.

But what to do during lock down?
I would have expected much more tinkering from more people now that they are mostly confined to the indoors.

btw: about tinkering: I just installed SheepShaver in a vm running Big Sur and it seems the etherhelper/en0 option works fine there.
But for now I cannot get both SheepShaver and Basilisk use that same configuration.

I guess I'm off to tinker with a motorbike I'm restoring...

Best,
Cat_7
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: SheepShaver/BasiliskII and TAP devices

Post by adespoton »

Cat_7 wrote: Sat Nov 21, 2020 8:56 am Haha, thank you.

But what to do during lock down?
I would have expected much more tinkering from more people now that they are mostly confined to the indoors.

btw: about tinkering: I just installed SheepShaver in a vm running Big Sur and it seems the etherhelper/en0 option works fine there.
But for now I cannot get both SheepShaver and Basilisk use that same configuration.

I guess I'm off to tinker with a motorbike I'm restoring...

Best,
Cat_7
It's funny... I find I've got less time in lockdown; WFH with the rest of the family around leaves less personal time than when everyone has the freedom to go somewhere else.

But if I get a chance, I'll dig into etherhelper and see what's needed to spin up a unique MAC for each client using it -- or if we need a unique etherhelper instance for each emulator.
User avatar
KnuddlMac
Granny Smith
Posts: 123
Joined: Thu Apr 06, 2017 9:32 am
Location: Southern Bavaria

Re: SheepShaver/BasiliskII and TAP devices

Post by KnuddlMac »

I second this! - WFH suddenly discovers, that we're always sitting in front of our monitors.
When my wife comes in and BAII or SheepShaver is on the screen, the obvious question is: "...is that for work?!" :oops:
So we're supposed to spend our leisure time off the system, w/o monitor, keyboard and mouse.

I'd love to tinker on something non Macish.. - Am I already addicted after 25 years?

[[Etherhelper]] If etherhelper already works with Big Sur, that would safe my invest (not US$$s, but time-wise) setting up my Apple Shares and printing. Maybe there is a MAC address, that could be tied to an etherhelper instance?
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: SheepShaver/BasiliskII and TAP devices

Post by adespoton »

KnuddlMac wrote: Wed Nov 25, 2020 3:42 pm I second this! - WFH suddenly discovers, that we're always sitting in front of our monitors.
When my wife comes in and BAII or SheepShaver is on the screen, the obvious question is: "...is that for work?!" :oops:
So we're supposed to spend our leisure time off the system, w/o monitor, keyboard and mouse.

I'd love to tinker on something non Macish.. - Am I already addicted after 25 years?

[[Etherhelper]] If etherhelper already works with Big Sur, that would safe my invest (not US$$s, but time-wise) setting up my Apple Shares and printing. Maybe there is a MAC address, that could be tied to an etherhelper instance?
Yes to all that! Thankfully for me, there's overlap with work on QEMU -- so the answer there is often "why yes, it is!"

No such luck with older emulators though. And the follow-up question is always "you shouldn't still be working, should you?"

But etherhelper appears to be userspace-friendly, so I think we do just need to sort out MAC handling when multiple etherhelper instances are spun up. Still haven't had a chance to look a the code (or the computer holding the code) though.
User avatar
KnuddlMac
Granny Smith
Posts: 123
Joined: Thu Apr 06, 2017 9:32 am
Location: Southern Bavaria

Re: SheepShaver/BasiliskII and TAP devices

Post by KnuddlMac »

Funny to read, that you both are in the same situation.
I should speed-up my work for the planned Bolo server to provide us with some distraction between things. J

Right now my country-side ethernet uplink might be too weak. But around springtime I should have necessary bandwidth with 'fibre to the home' available.
rakslice
Student Driver
Posts: 22
Joined: Sun Jun 27, 2004 12:50 am

Re: SheepShaver/BasiliskII and TAP devices

Post by rakslice »

@afberendsen If you're thinking uninitialized memory values are going into the MAC address, are you getting the error "Could not get hardware address of device" etc. when it tries to put the MAC address of the TAP adapter into ether_addr, that you can see in the code immediately before the code block you most recently pasted?

In any case you rightly point out that if Windows' built-in bridging is changing the bridged adapters addresses to a common bridge address -- what would require changing the MAC address of the emulated Mac to not conflict with the host -- then there's another problem. If you're running multiple BII/SS instances on the same machine, even if they are put on separate TAP adapters, because the TAP adapters all get changed to the bridge address by the bridge, each changes the OUI prefix of that address to 52:54:00, and they still end up all having the same address as each other.
rakslice
Student Driver
Posts: 22
Joined: Sun Jun 27, 2004 12:50 am

Re: SheepShaver/BasiliskII and TAP devices

Post by rakslice »

Also, for the benefit of @afberendsen and anyone else out there, I should note that if you find you have a Windows tap driver version that works when configured by hand using etherguid, but that isn't detected by a current build of BasiliskIIGUI/SheepShaverGUI (i.e. it doesn't show up as an item in the "Ethernet Interface" drop down), feel free to share its ComponentId string value from the registry key for the tap network adapter underneath

Code: Select all

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}
so that it can be added to the matching list in util_windows.cpp.
rakslice
Student Driver
Posts: 22
Joined: Sun Jun 27, 2004 12:50 am

Re: SheepShaver/BasiliskII and TAP devices

Post by rakslice »

rakslice wrote: Tue Dec 01, 2020 2:52 am In any case you rightly point out that if Windows' built-in bridging is changing the bridged adapters addresses to a common bridge address -- what would require changing the MAC address of the emulated Mac to not conflict with the host -- then there's another problem.
But actually that isn't what happens when I test with Windows 10 x64 v 2004 and OpenVPN TAP-Windows driver 9.24.2.601. BII/SS correctly chooses a MAC address based on the address of the specific tap adapter it is configured to use, regardless of what address the bridge uses.

The possible conflict with the host isn't because the tap adapters are changing addresses, it is because the bridge is changing addresses to the address of one of the adapters, and the host uses the bridge MAC address as its own address. If each BII/SS instance is set to use a separate tap adapter, and those adapters' MAC addresses are different in the last 3 bytes, the BII/SS instances get different MAC addresses.
Post Reply