--------------------------------Linux Guide---------------------------------- by Ingo Blechschmidt (c) 2002 ----------------------------------------------------------------------------- ------------------------- SLIP unter Linux ------------------------- Die Oct 30 17:36:16 MET 2001 ------------------------- SLIP COM COM1 ttyS1 slattach ifconfig route Mars Juppiter 192.168.50.1 192.168.50.2 inislip stopslip serriell Kabel Verbindung connection Computer Adapter 25_Pol weiblich 9_Pol männlich ----------------------------------------------------------------------------- Sie haben sich einen neuen Computer gekauft, und möchten nun die Daten übertragen. Ein einfaches serielles Kabel und ein paar Befehle erlauben dies, und sogar noch ein wenig mehr... ----------------------------------------------------------------------------- Grund für diesen Artikel war tatsächlich der oben stehende. Ok, man könnte jetzt auch 10 überformatierte Disketten nehmen, alle Dateien mit bzip2 --repetitive-best -vvv komprimiert draufkopieren und dann wieder entpacken... Die technisch viel interessantere Methode ist allerdings eine Kabelverbindung. Bei dieser Methode werden benötigt (ich gehe von einem älteren Quell- und einem neuen Zielrechner aus): * Ein serielles Kabel, 25-Pol.-weiblich (Anschluss an den alten PC) + 9-Pol.-männlich (oder auch 25-Pol.-weiblich, aber dann wird meistens am neuen Computer ein Adapter benötigt), * U.u. (wenn nur ein Kabel mit Ein- und Ausgang 25-Pol.-weiblich im keller liegt) einen Adapter, 25-Pol.-weiblich->9-Pol.-männlich, * die Programme slattach (wenn nötig nachinstallieren), ifconfig (schon vorhanden) und route (ebenfalls schon vorhanden). Hier zwei Skripte für's Verbinden und Trennen der Verbindung, siehe <"down/slip-0.4.tar.bz2">Download siehe <"#unten">1 sl0..." echo "> slattach -v -v -v -p $PROT $TERM" } slattach -d -v -v -v -p $PROT $TERM & sleep 2; # Phase II test "$TIME" != "0" && { echo "Setting up sl0..." echo "> ifconfig sl0 $IP up" } ifconfig sl0 $IP up || { echo "Couldn't set up sl0! Exiting..."; exit 1; } sleep 1; # Phase III test "$TIME" != "0" && { echo "Routing to $RH..." echo "> route add $RIP sl0" } route add $RIP sl0 || { echo "Couldn't route to $RH! Exiting..."; exit 1; } # Phase IV # commented, because if the other computer is down, this fails. #echo "Testing connection..." #echo "> ping $RH -c 1" #ping $RH -c 1 || { echo "Couldn't connect to $RH! Exiting..."; exit 1; } test "$TIME" = "0" && echo " done!"; exit 0; --------/CODE-------- --------CODE--------: stopslip #!/bin/bash # initslip - Sets down the SLIP network. # Copyright (C) Tue Oct 30 14:04:02 MET 2001 - now, # released under the Terms of the GNU General Public License. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # Ingo Blechschmidt # Arberstraße 5 # 86179 Augsburg # E-Mail: iblech@web.de, http://www.way.to/uselinux/ # Tel.: +49 / 821 882955 # # TERM=ttyS1 # The terminal to use (ttyS0=COM1 is in many cases the mouse). TERMD=COM2 # The dos name (for newbies...). TIME=10 # For StarTrek fans only: A countdown. RH=Mars # The Name of the remote machine, planet names are funny... ;-) # Running as a init script? [ -n "$1" ] && { if [ "$1" = "stop" ]; then TIME=0; else TIME=$1; fi; } # Below this there is nothing to change... # The StarTrek countdown. [ "$TIME" != "0" ] && for i in `seq $TIME 0`; do sleep 1; echo -e "\033[1m$i...\033[0m"; done # Find out the IPs, my and hers. RIP=`cat /etc/hosts | grep $RH | cut -f 1` IP=`ping $(hostname) -c 1 | head -n 1 | cut -d \( -f 2 | cut -d \) -f 1` # Running as a init script? test "$TIME" = "0" && echo -n "Stopping SLIP network..."; # Phase III test "$TIME" != "0" && { echo "Un-routing to $RH..." echo "> route del $RIP" } route del $RIP # Pahse II test "$TIME" != "0" && { echo "Setting down sl0..." echo "> ifconfig sl0 down" } ifconfig sl0 down #Phase I test "$TIME" != "0" && { echo "Unattaching $TERMD -> $TERM..." echo "> slattach -v -e -d -p tty $TERM" } slattach -v -v -d -d -p tty $TERM & sleep 2 test "$TIME" = "0" && echo " done!"; exit 0; --------/CODE-------- Bevor Sie diese Skripte ausführen können, müssen Sie allerdings noch ein paar Dateien editieren: Überlegen Sie sich zwei schlöne Hostnamen inklusive Domäne, zum Beispiel Mars.Milch.de und Pluto.Milch.de. Beide benötigen auch noch je eine IP-Adresse. Meine Empfehlung: 192.168.10.1 für Mars und 192.168.10.2 für Pluto. Dann müssen Sie diese Daten auf beiden Rechnern in /etc/hosts eintragen: --------CODE--------: /etc/hosts 192.168.10.1 Mars.Milch.de Mars 192.168.10.2 Pluto.Milch.de Pluto --------/CODE-------- Zum Testen, ob alles geklappt hat, sollten folgende drei Befehle keine Fehlermeldungen ausgeben (wenn Sie das Kabel in DOS-COM1 eingesteckt haben, müssen Sie bei allen Aufrufen ttyS1 durch ttyS0 ersetzen): --------CODE--------: Ein erster Test Auf Mars: Mars:~ # slattach -e -v -d -p cslip ttyS1 cslip started on ttyS1 interface sl0 Mars:~ # ifconfig sl0 192.168.10.1 up Mars:~ # route add Pluto sl0 Auf Pluto: Pluto:~ # slattach -e -v -d -p cslip ttyS1 cslip started on ttyS! interface sl0 Pluto:~ # ifconfig sl0 192.168.10.2 up Pluto:~ # route add Pluto sl0 Auf beiden: Mars/Pluto:~ # ping Pluto/Mars Hitachi:~ # ping Mars -c 7 PING Mars (192.168.50.2): 56 data bytes 64 bytes from 192.168.10.2: icmp_seq=0 ttl=255 time=186.780 ms 64 bytes from 192.168.10.2: icmp_seq=1 ttl=255 time=200.053 ms 64 bytes from 192.168.10.2: icmp_seq=2 ttl=255 time=190.007 ms 64 bytes from 192.168.10.2: icmp_seq=3 ttl=255 time=190.010 ms 64 bytes from 192.168.10.2: icmp_seq=4 ttl=255 time=190.016 ms 64 bytes from 192.168.10.2: icmp_seq=6 ttl=255 time=199.992 ms --- Mars ping statistics --- 7 packets transmitted, 6 packets received, 14% packet loss round-trip min/avg/max = 186.780/192.809/200.053 ms --------/CODE-------- Ist dann die Ausgabe ähnlich der oberen, funktioniert software-seitig alles. Sie müssen nur noch das Kabel fester einstecken. Damit Sie jetzt auch Ihre Daten übertragen können, müssen Sie noch den (r|s)h-Dämon starten. Spätestens jetzt stellt sich die Fragen, ob man die Secure Shell zur Datenübertragung nutzt oder die unsicherere Remote Shell. Die rsh ist verpönt, weil sie so unsicher ist. Wenn Sie aber über beide Rechner physikalische Kontrolle haben, langt meiner Meinung nach dir rsh. In der Datei /etc/inetd.conf muss folgender Eintrag zu finden sein: --------CODE--------: /etc/inetd.conf shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd -w systat stream tcp nowait nobody /usr/sbin/tcpd /bin/ps -auwwx netstat stream tcp nowait root /usr/sbin/tcpd /bin/netstat -a --------/CODE-------- Mit einem killall -HUP inetd wird der Internet-Super-Daemon neu gestartet. Und los gehts... --------CODE--------: rcp Pluto:~ # xnetload sl0 -display :0.0 & Pluto:~ # rcp -r iblech@Mars:/home/iblech /home/iblech [... sehr lange Zeit ...]# --------/CODE-------- Dieser Vorgang kann einige Zeit in Anspruch nehmen (auf meinem Kabel: 1 Stunde == 3 Megs unkomprimiert). Um das ganze zu beschleunigen bietet sich bzip2 an: --------CODE--------: tar -I | rsh Mars:/home # tar --preserve -cIvv iblech | rsh Pluto 'cd /home; tar --prserve -xIv' --------/CODE-------- Mit den folgenden Befehlen (getestest auf S.u.S.E Linux) wird das kleine Netzwerk beim Starten gestartet: --------CODE--------: init.d ändern # cd /etc/init.d/rc2.d # ln -s /usr/local/bin/initslip S60slip # ln -s /usr/local/bin/stopslip K60slip # cd ../rc3.d # ln -s /usr/local/bin/initslip S60slip # ln -s /usr/local/bin/stopslip K60slip # cd ../rc3.d --------/CODE--------

1: Wenn Sie wissen, wie man die Verbindung ttyS1->sl0 wider lösen kann, soll sich bitte bei mir melden: Via siehe <"mailto:iblech@web.de">E-Mail oder siehe <"tel:+49 821 882955">+40 821 882955.
2: Ist ein serielles Kabel wirklich so langsam? 1 KB/s? Wenn Sie wissen, wie man das ganze beschleunigt, dann nehmen Sie bitte mit mir Kontakt auf: Via siehe <"mailto:iblech@web.de">E-Mail oder siehe <"tel:+49 821 882955">+40 821 882955.
Danke im Vorraus. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- This document is distributed under the terms of the GNU Free Documentation License.