Connect ADSL Automatically and Email You Network Information

It’s time to enjoy winter holidays. However, teachers will be working for another two weeks. I’d like to use the computers in the lab when I am at home. I need to create an automatic job to do this work. The job works on Linux systems (Fedora 12 and Redhat EL 5) with pppoe, sendmail, cron. Here is the steps.

1. create an ADSL account, name it as adsl

2. make a new file adsl.up,

$vi adsl.up

commands in the file as

ifup adsl
ifconfig ppp0 | mail -s IPaddress [email protected]

the 1st line is to connect ADSL with adsl profile
the 2nd line is to get the ADSL (ppp0) connection infomation and to email you

A more complicated commands, with if-then, which could avoid to email nothing or to run mail wrong if the connection is not successful.

ifup adsl
PPPSTATUS='ifconfig ppp0'
  ifconfig ppp0 | mail -s IPaddress [email protected]

3. change it mode to allow it executable

$chmod +x adsl.up

4. add the following line to the end of /etc/crontab file:

00 21 * * * user PATH/adsl.up

this line means the machine will run adsl.up at 21:00 everyday.

5. for saving the time of online, make a disconnecting file adsl.down
and make it executable

ifdown adsl

add the following line to the end of /etc/crontab file:

00 01 * * * user PATH/adsl.down

this line means the machine will run adsl.down at 01:00 everyday.

Ok, it’s alright, but the sendmail configuration need detail
1. edit /etc/mail/

$vi /etc/mail/

find the following line

DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl

and change to, means to find the domain on the internet.

2. Senmail SMTP authorizing

$vi /etc/mail/

find the lines


delete the dnl in the begining of the lines, since dnl means comment this line in sendmail configuration file. Deleting it can make the line work.

3. add adequate nameservers

$vi  /etc/resolv.conf

add and as your nameservers

    ; generated by /sbin/dhclient-script

4. restart the sendmail service

$service sendmail restart

Finally, it works. I can use the lab computers in the winter holidays.

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see


This site uses Akismet to reduce spam. Learn how your comment data is processed.