- Setup the various components:
- Setup the AMIGA Networking
- Setup SLIP Networking on your PC (here with Ubuntu Linux)
1. Amiga Networking
1.1 Patched magPLIP device
- Purpose: patch Aminet magPLIP driver to support features required by plip2slip.
- Input:Â Â magPLIP 38.1 from http://aminet.net/package/comm/net/magPLIP38.1
- Patch:Â Â magplip.patch
- magplip.device.000 # m68000 version
- magplip.device.020 # m68020 version
1.2 Build magPLIP from Source
- Only for advanced users! All others can use the supplied binaries (see above)!
- AMIGA: First setup latest SAS C++ V6.58
- AMIGA: Install AmiTCP SDK (e.g http://aminet.net/package/comm/tcp/AmiTCP-SDK-4.3)
> assign amitcpsdk: <set your sdk path herer>
- Download and extract mapPLIP source from aminet
- On Unix host: Apply patch:
> patch -p0 < magplip.patch
- AMIGA CLI:
> cd magplip/source > assign includeasm: include: > assign netinclude: amitcpsdk:netinclude > smake clean all_opt > list /devs/networks
- The resulting binaries reside in /devs/networks/magplip.device.*
1.3 Setup Network Stack
- I am using AmiTCP (V3.x,4.x) here, but other Network Stacks work similar
- For a very simply setup you can use the “Network Boot Disk for Amiga” and start with this. Insert this disk into your emulator and perform the following steps to prepare the disk.
- Copy patched magplip.device to your AmiTCP. Select the m680x0 version and copy the magplip.device without the .000 or .020 extension to your AmiTCP installation:
> copy magplip.device.000 df0:devs/networks/magplip.device
- Edit the file AmiTCP:db/interfaces and add:
- Adjust your AmiTCP:bin/startnet to setup the interface to magplip0.
- In the network boot disk: Edit df0:s/Prefs/Env-Archive/nbddriver and setÂ magplip0
- In EnvARC:sana2 (Network Boot Disk: df0:s/Prefs/Env-Archive) you can place an optional configuration file calledÂ magplip.config.
- For options see the magPLIP documentation.
- Do not forget to configure the correct DNS server otherwise you won’t be
able to resolve non numeric IP addresses. Have a look at the file
AmiTCP:db/netdb-myhost and adapt the NAMESERVER entry accordingly. With
enabled IP forwarding on your Linux box (see slattch/README) you typically
use the IP of your DSL router as your nameserver (in my setup 192.168.2.1)
2. HOST (PC) Networking with Linux (Ubuntu)
2.1 Patch SLIP Tool slattach for high baud rates
The slattach tool is a utility to setup a serial link as a SLIP device in the Linux Kernel. The tool is distributed in the “net-tools” package.
slattach usually support only the “standard” baud rates up to 115200 baud. In this project we will use higher baud rates up to 500000 baud. To support this baud rate a patch is required. See slattach.patch in the source directory.
Depending on your Linux distributation patching slattach may vary.
The following steps are required for Ubuntu/Debian Linux:
- Prepare source and patch
> sudo apt-get build-dep net-tools > apt-get source net-tools > dpkg-source -x net-tools_1.60-23ubuntu3.dsc > cd net-tools-1.60 > cp slattach.patch debian/patches > echo slattach.patch >> debian/patches/series
- Quick & Dirty slattach compile:
> cd net-tools-1.60 > dpkg-buildpackage -Tbuild > ls slattach
- OR: Build your own patched net-toosl package and install this:
> debuild -us -uc > cd .. ; ls *.deb net-tools_1.60-23ubuntu3_i386.deb > sudo dpkg -i net-tools_1.60-23ubuntu3_i386.deb
2.2 Setup SLIP: Manual Test
- Attach your Arduino with plip2slip firmware flashed
- On Linux a new /dev/ttyUSBx device should appear for the serial adapter (Have a look a dmesg output for details)
- Attach a SLIP network device to the serial port with our new patched slattach command:
> sudo ./slattach -H -p slip -s 500000 /dev/ttyUSB0
- Note: the high baud rate only works with the patched version
- Note2: the -H switch is also added by the patched version. It avoids resetting the Arduino before/after connecting. Otherwise you can’t read out stats from the board later on.
- If you get the following error then you don’t have patched slattach:
slattach: tty_open: cannot set 500000 bps!
- Let this command run all the time you want to have a SLIP device… The serial port is then blocked. If you want to talk with the device by serial or flash the firmware then first kill the slattach (e.g. by CTRL+C)
- Now configure the SLIP network interface: (With slattach still running)
> sudo ifconfig sl0 netmask 255.255.255.0 192.168.0.1 up > ifconfig sl0 sl0Â Â Â Â Â Â Link encap:Serial Line IP inet addr:192.168.0.1Â P-t-P:192.168.0.1Â Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICASTÂ MTU:296Â Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:10 RX bytes:0 (0.0 B)Â TX bytes:0 (0.0 B)
- Ok! Now a ping should work!
> ping 192.168.0.1
- You can alter the MTU of the link with:
> sudo ip link set dev sl0 mtu <size>
2.3 Setup SLIP permamently
- To make these changes permanently open file /etc/network/interfaces as root and add:
iface sl0 inet static address 192.168.0.1 netmask 255.255.255.0 mtu 512 pre-up /usr/local/bin/slattach -H -l -p slip -s 500000 /dev/ttyUSB0 & pre-up sleep 1 post-down kill `cat /var/lock/LCK..ttyUSB0`
- Note: I copied my patched slattach to /usr/local/bin
- Then you can control the interface with:
> sudo ifup sl0 > sudo ifdown sl0
2.4 Configure IP Forwarding
- If you want to reach other hosts than your Linux box from your Amiga then you have to activate IP Forwarding on your Linux box.
- This includes enabling IP forwarding and configuring the iptables to do masquerading as your amiga IP is not known in the outside world.
- I have the following setup on my Linux Box:
- eth0: (192.168.2.x) connected to my DSL Router (192.168.2.1) -> internet
- sl0: (192.168.0.1) SLIP to Amiga
- As root type the following commands:
# sysctl -w net.ipv4.ip_forward=1 # iptables -A FORWARD -o eth0 -i sl0 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT # iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT # iptables -A POSTROUTING -t nat -j MASQUERADE
- See a Linux Network Reference Manual for more details.
- That’s it! Now the Amiga should be able to ping the DSL Router (192.168.2.1) and reach the hosts on the Internet.