linux-l: wie tcp verbindung killen
Martin Peikert
news-list.linux.belug at innominate.de
Di Aug 28 13:08:14 CEST 2001
Steffen Dettmer <steffen at dett.de> wrote:
> * Martin Peikert wrote on Tue, Aug 28, 2001 at 06:57 +0000:
>> Robert Sander <belug at gurubert.myip.org> wrote:
>> > ifconfig down macht sich remote immer so schlecht.
>>
>> Probier's doch einfach mit
>> remote:~# ifconfig down interface && sleep 10; ifconfig up interface
>> - das geht auch wunderbar remote ;-)
>
> Nein. Sowas sollte man lieber lassen :)
>
> Es kann nämlich passieren, daß nach dem down jemand was senden
> will, was nicht klappt, weil das Interface ja platt ist. Damit
> wird der sshd process (oder was auch immer) die connection
> verlieren und sich beenden. Dabei kriegt die Shell natürlich ein
> HUP und beendet den/die aktuellen Prozeß(e). Also braucht man
> noch sowas wie nohup (oder ein trap im Script).
Dein Einwand mag richtig sein: es _kann_ passieren. Aber: die Erfahrung
zeigt ein anderes Bild. Ich hab das mal schnell ausprobiert: Der sshd
verliert die Connection nicht.
tino at nobrain ~ # ls -l testfile
-rw-r--r-- 1 tino users 18895848 Aug 28 12:51 testfile
tino at nobrain ~ # ssh tino at nopain
tino at nopain's password:
Last login: Tue Aug 28 10:11:45 2001 from nobrain
Have a lot of fun...
tino at nopain:~ > su
Password:
root at nopain:/home/tino > scp tino at nobrain:/home/tino/testfile .
tino at nobrain's password:
testfile 9% |** | 1832 KB 00:18 ETA
[1]+ Stopped scp -r tino at nobrain:/home/tino/testfile .
root at nopain:/home/tino > bg
[1]+ scp -r tino at nobrain:/home/tino/testfile . &
root at nopain:/home/tino > ifconfig eth0 down && sleep 10 ; ifconfig eth0 up
root at nopain:/home/tino > fg
scp -r tino at nobrain:/home/tino/testfile .
testfile 100% |*****************************| 18452 KB 00:14
root at nopain:/home/tino > ls -l testfile
-rw-r--r-- 1 tino users 18895848 Aug 28 13.00 testfile
root at nopain:/home/tino > sshd -v
sshd: invalid option -- v
sshd version OpenSSH_2.9p1
root at nopain:/home/tino >
> Weiterhin löscht das down/up die Routen über das Interface. Ohne
> defaultroute kommt man danach nur noch aus dem selben Subnetz
> ran. Das geht vielleicht nicht immer, also auch routing nach
> Netzwerk konfigurieren.
Da muss ich zustimmen. Das war kurzsichtig von mir - die Rechner sind
alle in einem Subnetz. Unter Debian ist dann wohl
remote:~# ipdown interface && sleep 10 ; ifup interface
die besere Wahl.
> Und das nur, weil da zwei 4KB Buffer verschwendet werden?! Würde
> ich lieber mit Leben :)
ACK. :)
Martin
--
martin.peikert at innominate.com
innominate AG
http://www.innominate.com
tel: +49.30.308806-0 fax: -77 gpg: http://innominate.org/gpg/mpe.gpg
Mehr Informationen über die Mailingliste linux-l