----- Networking with BasiliskII ----- | | | || / ___ | | | | // ||| // / \__/ | | | | // | |/ / || | | | | _/_ / | / // \ \__ | | _|_|_ (-\@ \ |/ /_/ \___ \ _|_|_ | |________ \ \\_/ /_ /__ \ \ ________| | | WWW |_________ \ \/ /_ / \ | | ________| @ | |_____| \ \ --/__ \___/ / |_____| | | \_\_ _/ \______/ | | | | _ /_/\_\ | | | | ((\==// \\ | | | | ) _//_ | | (( ( ) A bit of a crucial issue for a VM to be used as a server. BasiliskII has three (3) ways that I know to network the emulated system. 1 - SLIRP. This is the default, and specified by this line in the BasiliskII prefs file : ether slirp This method basically work like the emulator creating his own virtual router on the host system through Slirp. So your emulated system is completely out of your local network subnet and has to use specific IP address, DNS... ect, provided by Slirp. works like this : Your R-Pi (local IP, say.. 192.168.1.55) <-----> Real router <----->Internet running... | | Slirp Basilisk II <------> Firewall/DHCP virtual router (must be 10.0.2.x) | (is always 10.0.2.2) | ----> DNS server (is always 10.0.2.3) | ----> SMB server (is always 10.0.2.4) It's very simple and efficient, works very well for outgoing connections, but the emulated system is completely invisible from the outside, ie from other computers on your network or the internet. So, no incoming connection by default. bad for a server. there is a trick though... there is a way to forward ports for the host to the guest, by adding something like this in the prefs file, just after the "ether slirp" line : redir tcp:8000:10.0.2.15:80 On this example we have a web http server (port 80) running on BasiliskII/Mac OS with IP address 10.0.2.15 forwarded to the host with IP address 192.168.1.55 to port 8000. So to access the BasiliskII/Mac OS http server form inside your local network, you would point to the host address on port 8000, like so : http://192.168.1.55:8000 Works for other protocols, say for a Gopher server running on the MacOS VM, it could be : redir tcp:70:10.0.2.15:70 And the address to get there from inside the local network : gopher://192.168.1.55:70 ie the Host address at port 70. From the BasiliskII documentation, this redir setting should work with both tcp and udp. So a Protocol using udp should work. But so far I tried it only for setting up Timbuktu (http://macintoshgarden.org/apps/timbuktu-pro-30), which versions on 68k works only in udp... without success. Very possible because Timbuktu use port 407 (and one can't change it when connecting), and as the host runs on a Linux, ports numbers under 1024 are reserved to be used by root user (Thks to Cat_7 on the Emaculation forum for pointing that). So maybe launching BasiliskII as root could solve that. Note it is possible to put several redirection settings,like so : redir tcp:80:10.0.2.15:80 redir tcp:21:10.0.2.15:21 redir tcp:70:10.0.2.15:70 And there you get http (port 80), FTP (port 21) and Gopher (port 70) forwarded from the host to the guest. of course if you already have, say, an FTP server running on default port 21 on the host, you'll run into problems. In that case one can do : redir tcp:2121:10.0.2.15:21 Which redirect host port 2121 to guest port 21. And to connect to the ftp running in BasiliskII/Mac OS from the local network, the address would be : 192.168.1.55:2121 (the host R-pi addr.):(the forwarded port) To set the guest VM System 7 to use this network method, one as to have Apple's Open Transport installed, can get it here : http://macintoshgarden.org/apps/open-transport-131-update-open-transport-13-68k MacTCP works too, but Open Transport is clearly better. And as mentioned ealier, it has to be set to specific IP addresses. So open the TCP/IP control panel, and choose : Connect via : Ethernet Configure : Manually IP Address : 10.0.2.x (I've tried setting x to 5 or 15 both works...) Subnet Mask : 255.255.255.0 Router Address : 10.0.2.2 Name Server Address : 10.0.2.3 And the guest should be networked. All fine, but what if one wants the BasiliskII/Mac OS VM to have her own local IP given directly by the real router on the local network, and thus directly "visible" on it, without all these ports forwarding shenanigans ? Plus the added security of exposing only the VM to the internet jungle... Here come the second method : 2 - The NetDriver. it is how my setup is networked. This is a kernel module called "sheep_net", and has to be compiled and installed. the sources are located in : macemu/BasiliskII/src/Unix/Linux/NetDriver. For compiling a kernel module, one needs the Linux Sources and Headers of the host Linux operating system installed ( + the usual compiling apps of course, like Make, GCC and other... but if building fails, it usually shouts out what Lib or app it misses, then can be installed). I've had difficulties finding the correct Linux sources and headers back when my R-Pi was running Raspbian 8 Jessie, even though these can usually be found through apt or Synaptic packages managers. There is a very convenient tool to get the exact sources for you Linux kernel, rpi-source : https://github.com/RPi-Distro/rpi-source to get it : git clone https://github.com/RPi-Distro/rpi-source will download it in your home folder, and you can run it with : ./rpi-source. That will check your kernel version, check for the corresponding sources and headers to download, ask for your password, then download required sources and headers to your home folder. Now you have everything to build a kernel module, get into the NetDriver source folder, like so : cd macemu/BasiliskII/src/Unix/Linux/NetDriver and do ( <--- are comments, don't type these ) : make <--- to compile the driver sudo make install <--- to install the driver sudo chown [YOUR USER NAME] /dev/sheep_net <--- to make you the owner sudo modprobe sheep_net <--- to load the driver, make it run There you have your NetDriver build, installed and loaded on the Linux Host. For BasiliskII to use it, the ethernet line in the ".basilisk_ii_prefs" preferences file needs to be changed to : ether eth0 Then configure Your MacOS/System 7 network setting to Ethernet in the TCP/IP control panel as you would do with any real Macintosh, your Router will assign it a local IP within your local subnet network. Can be DHCP, or one can choose a fixed address (preferred, its gonna be a server) not already assigned on the network. The beauty of this is that your BasiliskII/Mac OS VM shows on your network like a true machine, and incoming connections works flawlessly, be it Timbuktu, FTP, HTTP ... ect. Tried to show the thing like this : Your R-Pi <------------- (local IP, say.. 192.168.1.55) | running... | | | | Your real router <----->Internet | | | | | | Basilisk II <------> The NetDriver <------------- (now as an IP directly assigned by your real router, or a fixed one, say 192.168.1.27) Some caveats though. The NetDriver has to be "re-owned" to your Linux user, and loaded each time you reboot the R-Pi, as root, before using BasiliskII, with the command line listed above. So I've made myself a bash script that I launch as root after each reboot (which is not very often) , goes like this : #!/bin/bash modprobe sheep_net chown galgot /dev/sheep_net Save it as "sheep_net_startup.sh" (or what ever you want to call it) in your home directory. make it executable with: sudo chmod +x sheep_net_startup.sh and it can be launched after reboot like so : sudo ./sheep_net_startup.sh There certainly are ways to load the NetDriver automatically at boot up, but never really checked for that, as I reboot my R-Pi quite rarely. The other thing is that the host and the guest won't "see" each other. For example, having an ftp server running on the BasiliskII/Mac OS, you can't connect to it from the host via her local address. And vice versa, you can't connect to the host from the guest. You can however connect from the host to the guest, by using the domain or public IP to which the VM local IP is forwarded. But more on that later, when come time to open the thing to the internet. Btw, this same NetDriver will work for SheepShaver too (it's named "sheep_net). So once compiled/installed and loaded, you can have BasiliskII and SheepShaver run at the same time on the R-Pi, each with their own local IP on the local network, pretty neat. The Third method to network BasiliskII, of which I know very little about is... 3 - TUN TAP. This third method enable having an IP address on the local network too, but I've never tried it... sorry :p One reason is that it seem mostly used on MaxOSX (now MacOS) hosts, for which the NetDriver can't work. And as my host is a Linux, and the two methods described above suit my needs so far, I didn't investigate further. That said Tun/Tap exist on Linux so it should be possible, and certainly have been done before. Check these pages for more infos related to the TUN TAP method : https://www.emaculation.com/forum/viewtopic.php?t-8067 https://www.emaculation.com/doku.php/appletalk_for_sheepshaver https://www.emaculation.com/doku.php/bridged_openvpn_server_setup In general the Emaculation.com Wiki and forums are a wealth of infos : https://www.emaculation.com/doku.php/more_guides and https://www.emaculation.com/forum/ Voila, next, part IV, setting up the server on the guest OS, ---