{"id":324,"date":"2011-08-14T18:38:02","date_gmt":"2011-08-14T16:38:02","guid":{"rendered":"http:\/\/lallafa.de\/blog\/?page_id=324"},"modified":"2011-08-28T11:15:51","modified_gmt":"2011-08-28T09:15:51","slug":"plip2slip-setup","status":"publish","type":"page","link":"https:\/\/lallafa.de\/blog\/amiga-projects\/plip2slip\/plip2slip-setup\/","title":{"rendered":"plip2slip Setup"},"content":{"rendered":"<ul>\n<li>Setup the various components:\n<ul>\n<li>Setup the AMIGA Networking<\/li>\n<li>Setup SLIP Networking on your PC (here with Ubuntu Linux)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>1. Amiga Networking<\/h3>\n<h4>1.1 Patched magPLIP device<\/h4>\n<ul>\n<li>Purpose: patch Aminet magPLIP driver to support features required by plip2slip.<\/li>\n<li>Input:\u00c2\u00a0\u00c2\u00a0 magPLIP 38.1 from <a href=\"http:\/\/aminet.net\/package\/comm\/net\/magPLIP38.1\">http:\/\/aminet.net\/package\/comm\/net\/magPLIP38.1<\/a><\/li>\n<li>Patch:\u00c2\u00a0\u00c2\u00a0 <a href=\"https:\/\/raw.github.com\/cnvogelg\/plip2slip\/master\/contrib\/magplip\/magplip.patch\">magplip.patch<\/a><\/li>\n<li>Output:\n<ul>\n<li><a href=\"https:\/\/raw.github.com\/cnvogelg\/plip2slip\/master\/contrib\/magplip\/magplip.device.000\">magplip.device.000<\/a> # m68000 version<\/li>\n<li><a href=\"https:\/\/raw.github.com\/cnvogelg\/plip2slip\/master\/contrib\/magplip\/magplip.device.020\">magplip.device.020<\/a> # m68020 version<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>1.2 Build magPLIP from Source<\/h4>\n<ul>\n<li>Only for advanced users! All others can use the supplied binaries (see above)!<\/li>\n<li>AMIGA: First setup latest SAS C++ V6.58<\/li>\n<li>AMIGA: Install AmiTCP SDK (e.g <a href=\"http:\/\/aminet.net\/package\/comm\/tcp\/AmiTCP-SDK-4.3\">http:\/\/aminet.net\/package\/comm\/tcp\/AmiTCP-SDK-4.3<\/a>)<\/li>\n<\/ul>\n<pre>&gt; assign amitcpsdk: &lt;set your sdk path herer&gt;<\/pre>\n<ul>\n<li> Download and extract mapPLIP source from aminet<\/li>\n<li>On Unix host: Apply patch:<\/li>\n<\/ul>\n<pre>&gt; patch -p0 &lt; magplip.patch<\/pre>\n<ul>\n<li> AMIGA CLI:<\/li>\n<\/ul>\n<pre>&gt; cd magplip\/source\r\n&gt; assign includeasm: include:\r\n&gt; assign netinclude: amitcpsdk:netinclude\r\n&gt; smake clean all_opt\r\n&gt; list \/devs\/networks<\/pre>\n<ul>\n<li> The resulting binaries reside in \/devs\/networks\/magplip.device.*<\/li>\n<\/ul>\n<h4>1.3 Setup Network Stack<\/h4>\n<ul>\n<li>I am using AmiTCP (V3.x,4.x) here, but other Network Stacks work similar<\/li>\n<li>For a very simply setup you can use the &#8220;<a href=\"http:\/\/jpv.wmhost.com\/NetworkBootDisk\/\">Network Boot Disk for Amiga<\/a>&#8221; and start with this. Insert this disk into your emulator and perform the following steps to prepare the disk.<\/li>\n<li>Copy patched <strong>magplip.device<\/strong> to your AmiTCP. Select the m680x0 version and copy the magplip.device without the .000 or .020 extension to your AmiTCP installation:<\/li>\n<\/ul>\n<pre>&gt; copy magplip.device.000 df0:devs\/networks\/magplip.device<\/pre>\n<ul>\n<li> Edit the file <strong>AmiTCP:db\/interfaces<\/strong> and add:<\/li>\n<\/ul>\n<pre>magplip dev=devs:networks\/magplip.device<\/pre>\n<ul>\n<li> Adjust your <strong>AmiTCP:bin\/startnet<\/strong> to setup the interface to <strong>magplip0<\/strong>.<\/li>\n<li> In the network boot disk: Edit <strong>df0:s\/Prefs\/Env-Archive\/nbddriver<\/strong> and set\u00c2\u00a0<strong>magplip0<\/strong><\/li>\n<li>In <strong>EnvARC:sana2<\/strong> (Network Boot Disk: <strong>df0:s\/Prefs\/Env-Archive<\/strong>) you can place an optional configuration file called\u00c2\u00a0<strong>magplip.config<\/strong>.<\/li>\n<li>For options see the magPLIP documentation.<\/li>\n<li>Do not forget to configure the correct <strong>DNS server<\/strong> otherwise you won&#8217;t be<br \/>\nable to resolve non numeric IP addresses. Have a look at the file<br \/>\n<strong>AmiTCP:db\/netdb-myhost<\/strong> and adapt the <strong>NAMESERVER<\/strong> entry accordingly. With<br \/>\nenabled IP forwarding on your Linux box (see slattch\/README) you typically<br \/>\nuse the IP of your DSL router as your nameserver (in my setup 192.168.2.1)<\/li>\n<\/ul>\n<h3>2. HOST (PC) Networking with Linux (Ubuntu)<\/h3>\n<h4>2.1 Patch SLIP Tool slattach for high baud rates<\/h4>\n<p>The <strong>slattach<\/strong> tool is a utility to setup a serial link as a SLIP device in the Linux Kernel. The tool is distributed in the &#8220;net-tools&#8221; package.<\/p>\n<p>slattach usually support only the &#8220;standard&#8221; 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 <a href=\"https:\/\/raw.github.com\/cnvogelg\/plip2slip\/master\/contrib\/slattach\/slattach.patch\">slattach.patch<\/a> in the source directory.<\/p>\n<p>Depending on your Linux distributation patching slattach may vary.<\/p>\n<p>The following steps are required for Ubuntu\/Debian Linux:<\/p>\n<ul>\n<li>Prepare source and patch<\/li>\n<\/ul>\n<pre>&gt; sudo apt-get build-dep net-tools\r\n&gt; apt-get source net-tools\r\n&gt; dpkg-source -x net-tools_1.60-23ubuntu3.dsc\r\n&gt; cd net-tools-1.60\r\n&gt; cp slattach.patch debian\/patches\r\n&gt; echo slattach.patch &gt;&gt; debian\/patches\/series<\/pre>\n<ul>\n<li> Quick &amp; Dirty slattach compile:<\/li>\n<\/ul>\n<pre>&gt; cd net-tools-1.60\r\n&gt; dpkg-buildpackage -Tbuild\r\n&gt; ls slattach<\/pre>\n<ul>\n<li>OR: Build your own patched net-toosl package and install this:<\/li>\n<\/ul>\n<pre>&gt; debuild -us -uc\r\n&gt; cd .. ; ls *.deb\r\nnet-tools_1.60-23ubuntu3_i386.deb\r\n&gt; sudo dpkg -i net-tools_1.60-23ubuntu3_i386.deb<\/pre>\n<h4>2.2 Setup SLIP: Manual Test<\/h4>\n<ul>\n<li>Attach your Arduino with plip2slip firmware flashed<\/li>\n<li>On Linux a new <strong>\/dev\/ttyUSBx<\/strong> device should appear for the serial adapter (Have a look a dmesg output for details)<\/li>\n<li>Attach a SLIP network device to the serial port with our new patched slattach command:<\/li>\n<\/ul>\n<pre>&gt; sudo .\/slattach -H -p slip -s 500000 \/dev\/ttyUSB0<\/pre>\n<ul>\n<li>\n<ul>\n<li>Note: the high baud rate only works with the patched version<\/li>\n<li>Note2: the <strong>-H<\/strong> switch is also added by the patched version. It avoids resetting the Arduino before\/after connecting. Otherwise you can&#8217;t read out stats from the board later on.<\/li>\n<\/ul>\n<\/li>\n<li>If you get the following error then you don&#8217;t have patched slattach:<\/li>\n<\/ul>\n<pre>slattach: tty_open: cannot set 500000 bps!<\/pre>\n<ul>\n<li>Let this command run all the time you want to have a SLIP device&#8230; 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)<\/li>\n<\/ul>\n<ul>\n<li>Now configure the SLIP network interface: (With slattach still running)<\/li>\n<\/ul>\n<pre>&gt; sudo ifconfig sl0 netmask 255.255.255.0 192.168.0.1 up\r\n&gt; ifconfig sl0\r\nsl0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 Link encap:Serial Line IP\r\ninet addr:192.168.0.1\u00c2\u00a0 P-t-P:192.168.0.1\u00c2\u00a0 Mask:255.255.255.255\r\nUP POINTOPOINT RUNNING NOARP MULTICAST\u00c2\u00a0 MTU:296\u00c2\u00a0 Metric:1\r\nRX packets:0 errors:0 dropped:0 overruns:0 frame:0\r\nTX packets:0 errors:0 dropped:0 overruns:0 carrier:0\r\ncollisions:0 txqueuelen:10\r\nRX bytes:0 (0.0 B)\u00c2\u00a0 TX bytes:0 (0.0 B)<\/pre>\n<ul>\n<li> Ok! Now a ping should work!<\/li>\n<\/ul>\n<pre>&gt; ping 192.168.0.1<\/pre>\n<ul>\n<li>You can alter the MTU of the link with:<\/li>\n<\/ul>\n<pre>&gt; sudo ip link set dev sl0 mtu &lt;size&gt;<\/pre>\n<h4>2.3 Setup SLIP permamently<\/h4>\n<ul>\n<li>To make these changes permanently open file  <strong>\/etc\/network\/interfaces<\/strong> as root and add:<\/li>\n<\/ul>\n<pre>iface sl0 inet static\r\naddress 192.168.0.1\r\nnetmask 255.255.255.0\r\nmtu 512\r\npre-up \/usr\/local\/bin\/slattach -H -l -p slip -s 500000 \/dev\/ttyUSB0 &amp;\r\npre-up sleep 1\r\npost-down kill `cat \/var\/lock\/LCK..ttyUSB0`<\/pre>\n<ul>\n<li>Note: I copied my patched slattach to \/usr\/local\/bin<\/li>\n<li>Then you can control the interface with:<\/li>\n<\/ul>\n<pre>&gt; sudo ifup sl0\r\n&gt; sudo ifdown sl0<\/pre>\n<h4>2.4 Configure IP Forwarding<\/h4>\n<ul>\n<li>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.<\/li>\n<li>This includes enabling IP forwarding and configuring the iptables to do masquerading as your amiga IP is not known in the outside world.<\/li>\n<li>I have the following setup on my Linux Box:\n<ul>\n<li>eth0: (192.168.2.x) connected to my DSL Router (192.168.2.1) -&gt; internet<\/li>\n<li>sl0: (192.168.0.1) SLIP to Amiga<\/li>\n<\/ul>\n<\/li>\n<li>As root type the following commands:<\/li>\n<\/ul>\n<pre># sysctl -w net.ipv4.ip_forward=1\r\n# iptables -A FORWARD -o eth0 -i sl0 -s 192.168.0.0\/24 -m conntrack --ctstate NEW -j ACCEPT\r\n# iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT\r\n# iptables -A POSTROUTING -t nat -j MASQUERADE<\/pre>\n<ul>\n<li>See a Linux Network Reference Manual for more details.<\/li>\n<li>That&#8217;s it! Now the Amiga should be able to ping the DSL Router (192.168.2.1) and reach the hosts on the Internet.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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:\u00c2\u00a0\u00c2\u00a0 magPLIP 38.1 from &hellip; <a href=\"https:\/\/lallafa.de\/blog\/amiga-projects\/plip2slip\/plip2slip-setup\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":303,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-324","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/PiBMF-5e","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/pages\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":17,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/pages\/324\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/pages\/324\/revisions\/338"}],"up":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/pages\/303"}],"wp:attachment":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/media?parent=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}