Linux Dialup Configuration Scripts

Here are three scripts I use to log in to an ISP and log back out again. Start right after the line with 'more' in it, ie my command prompt. Stop before the next one...

Each file should be coppied somewhere (I'd suggest /usr/local/bin/)

Then make sure it is executable: chmod a+x [file-name]


For example, if I write something like:
[greear@burrito greear]$ more foo.sh
#/bin/csh
blah blah blah
then the 'file' that I am talking about is simply a text file named foo.sh with:
#/bin/csh
blah blah blah
in it. To create this file (named foo.sh), you could do something like this:
pico foo.sh (this should open the pico editor)
Type in the text, then use ctrl-x to exit. It will prompt you to save (enter Y for yes). Now, you have created the text file...


Some General Linux notes
man [cmd]
usually gives a manual page on a given command, or c/c++ method.
man -k [topic]
lists all man pages dealing with that topic.
There is an unbelievably large amount of info on the web about Linux.
For fun and interesting articles, I'd suggest:  www.slashdot.org
For new program releases:                       www.freshmeat.net

Newsgroups:  comp.os.linux.misc
             comp.os.linux.networking
             comp.os.linux.hardware
(You should get an answer within an hour of posting, but please RTFM
first!! :))

Speaking of which, try searching on someplace like altavista with something like this:
+linux +howto +[yer topic of interest]

Programs of interest for C/C++ programmers: make, g++, xemacs, cc, gdb (debugger). Get the latest JDK from sun, or perhaps www.blackdown.org so you can program java efficiently...

If you want a couple of huge java/c++ code examples, download my mud archive....

Oh, to extract a file that looks like foo.tar.gz, first:
gunzip foo.tar.gz
Then un-tar it:
tar -xvf foo.tar

tar's man page is heinous, yell if you have questions.

Here start the dial-in/out scripts.....
[greear@burrito bin]$ more pn_login 
#!/bin/sh

#  This script achieves:
#  Dial your ISP, create a PPP connection, and establish the PPP
#  connection as your default route.

# NOTE:  I've got a 38400 modem, if you have faster, you may have
#        to use setserial
# NOTE:  mru & mtu can range between about 256 and 1500, if you've got
#        a good stable modem, then you may want to go up to 1500.
#        That also can fix some IP-Masq problems...
# NOTE:  Substitute for the __???__ entries, no _ needed in the final
#        script of course, I just didn't want to give away my passwords!!

# NOTE:  If you get file permission errors, try this as root:
#        chmod a+s /usr/sbin/pppd
#        (or whatever the file is that is bothering you.)  This sets it
#        to be SET-UID root.  May be a _small_ security breach, but at
#        least you don't have to log in as root to log on.  Would
#        want to restrict this if you are sharing your box with strangers.

########################################################################

pppd connect 'chat "" ATDT__PHONE_NUMBER__ ogin: __LOGIN_ID__ word:
__PASSWORD__' \
/dev/modem 38400 asyncmap 0 crtscts defaultroute mru 552 mtu 552



[root@burrito bin]# more rpppd 
#!/bin/sh

#  Use this script to establish a ppp connection (used as a default route)
#  after dialing in to a PPP account by some other means.  For instance,
#  if I dial in to work, I have to interactively answer security
#  verification, so I can't script it.  So, I dial in with minicom,
#  exit (without resetting the modem), and then run this script.

#  You may want to change the 38400 if you have a 56k modem, and if so,
#  you may need to use the setserial program, see it's man pages!

#  You can range the mtu/mru from around 256 up to 1500, go high for
#  a stable modem link, and to fix some IP-Masq problems (unoficial fix btw).

########################################################################

pppd /dev/modem 38400 asyncmap 0 crtscts defaultroute mru 552 mtu 552



[greear@burrito greear]$ more `which killppp`
#/bin/csh

#  This script kills your pppd daemon gracefully, and should re-set your
#  modem.  Ahh, the beauties of scripting and archane unix cmd-line
#  tools!  Beware that the outside quote looking thingies are not the
#  normal single quote.  On my keyboard it's under the ~ (tilde).

kill -15 `ps aux | gawk '$11 == "pppd" {print $2}'`
kill -15 `ps aux | gawk '$11 == "(pppd)" {print $2}'`



    
Ben Greear
Last modified: Fri Jul 2 15:13:03 PDT 2021