Article View: at.fido.linux
Article #2080Re: dip
From: Franz Schaefer
Date: Wed, 03 Jan 1996 00:00
Date: Wed, 03 Jan 1996 00:00
154 lines
4155 bytes
4155 bytes
hallo martina,
das problem mit den besetzten tu leitungen hatte ich auch. da ich aber
lieber ppp als slip verwende und die beim ppp packet beiligende
scriptsprache nicht sehr maechtig ist habe ich mir eine eigen loesung
gebastetl. mit einem "expect" (tcl basierte sprache) script. ein script das
aller 3 nummern nach der reihe und ohne pause durchpobiert: (die post hat
damit sicher keine freude ;-))
tu.expect:
~~~~~~~~~~~~~~~~~~~schnipp~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/local/bin/expect -f
log_file "/usr/adm/expect.log"
set phone(0) "ATDT5867578\r"
set phone(1) "ATDT5874692\r"
set phone(2) "ATDT5874695\r"
set phonen 3
#
set username "e9988777@stud1.tuwien.ac.at\r"
set password "streng_geheim\r"
#
# i do not like the stored profiles (ATZ)
# everytime i make a connection i reset the modem to firmware status
# and then initialize it:
#
set modemreset "AT&f2\r"
set modeminit "ATQ0V1E1X4L1M1&a\r"
# begin with a "random" number
set phnext [expr [pid] % $phonen]
set _connected 0
# maximum number of "hot" CONNECTs
# the number of "BUSY" retrys is not limited
set maxconnect 3
###########################################################
set concnt 0
proc hang_up {} {
send "\r"
sleep 1
send "+++"
sleep 1
send "ATH0\r"
}
proc login_proc {} {
global _connected
global username
global password
set timeout 15
expect {
name: {
send $username
exp_continue
}
word: {
send $password
exp_continue
}
-re "edvts.*>|TS>" {
send "ppp\r"
set _connected 1
}
timeout {
send_log "timed out while loging in\n"
hang_up
}
}
}
trap {
send_log "SIG received\n"
hang_up
exit 2
} {SIGINT SIGTERM}
set timeout 3
send $modemreset
expect OK
send $modeminit
expect {
OK {
while {! $_connected } {
if {$concnt >= $maxconnect } break
send $phone($phnext);
set phnext [expr ($phnext+1) % $phonen ]
set timeout 45
expect {
CONNECT {
set concnt [expr $concnt +1 ]
login_proc
}
DIALTONE {
send_log "No Dialtone\n"
}
BUSY {
send_log "LINE BUSY...\n"
}
ERROR {
send_log "MODEM ERROR....\n"
}
timeout {
send_log "timed out\n"
}
}
sleep 1
send_log "retry\n"
}
}
timeout {
send_log "timed out\n"
}
}
if $_connected {
exit 0
} else {
hang_up
send_log "aborted\n"
exit 1
}
~~~~~~~~~~~~~~~~~schnapp~~~~~~~~~~~~~~~~~~~~~~~~~~~~
und hier noch das zugehoerige script fuer den aufruf von ppp:
~~~~~~schnipp~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/bash
echo nameserver 128.130.2.3 >/etc/resolv.conf
cd /usr/lib/ppp
pppd debug connect '/root/tu.expect' cua1 38400 crtscts modem defaultroute :
~~~~~~~~~~~~schnapp~~~~~~~~~~~~~~~~~~
und noch ein kleiner tip: der pppd fuehrt nach erfolgereicher herstellung
der verbindung das script file /etc/ppp/ip-up mit der erhaltenen IP addresse
und der verwendeten seriellen aus. dort kann man alle dinge reinschreiben
die man nach dem verbindungsaufbau ausgefuehrt haben will. da ich auch
keinen nameserver laufen habe trage ich dort z.b. die erhaltene IP addresse
in mein hosts file ein. (da muesste eigenlich nicht sein. das meiste
funktioniert auch so. blos das kranke "talk" will unbedingt den eintrag)
...mfg franzi. (schaefer@ping.at)
Technical Details
Message-ID:
<4cdpu6$iu@mondbasis.site8.ping.at>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<MSGID_2=3A310=2F81.81_0e9cc350@fidonet>Show Full Headers
Complete Article Headers
X-Google-Language: GERMAN,ASCII-7-bit X-Google-Thread: 109314,e8be88bb2a3b30a8 X-Google-Attributes: gid109314,public From: schaefer@ping.at (Franz Schaefer) Subject: Re: dip Date: 1996/01/03 Message-ID: <4cdpu6$iu@mondbasis.site8.ping.at> X-Deja-AN: 133825745 x-ftn-origin: Franzis Linux Box, Vienna, Austria. (2:310/150.34@fidonet) references: <MSGID_2=3A310=2F81.81_0e9cc350@fidonet> x-comment-to: (Martina Umlauft) x-ftn-tearline: ifmail v.2.8 organization: Fido-Internet Gateway. Email to gateinfo@st.co.at for info. x-gateway: FIDO .. st.co.at [FIDOGATE 3.9.5] newsgroups: at.fido.linux