[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: making demand dialing NOT available at certain times of the day.



On Monday 12 February 2001 21:18, Terry Williams opined:
> I have 3 linux boxes and 2 windows 98se boxes networked together.  On
> one linux box I have RH7 with NAT configured and demand dialing.
> What I would like to do is make the demand dailing not available from
> 6:30am to 10am M-F.
>
> I have to do this because of the windows boxes and I need my phone line
> available those times.
>
> I appreciate any help including RTFM as long as I'm told what manual to
> read.  I've looked at cron tasks to do ifdown at those times but it
> doesn't work because its not always on at that time.

Yes, crontab is a good choice. But, alternate config files and scripts 
are the other part of the equation. I've done similar (without cron) for 
setting up accounts, changing configs to test demand dial, changing from 
one account to another, etc.

Basically, you need an alternate /etc/ppp/options file if you want it 
dialable at all. If not, removing it completely (after backing it up of 
course) is a good idea. Also, you'll need a replacement for 
/etc/sysconfig/network-scripts/ifcfg-ppp0 (I presume you use ppp0 as your 
default dialup - if not, change the last part accordingly).

You place copies of each file in a safe place, with names that make sure 
they don't write over each other (like options.demand/options.manual and 
ifcfg-ppp0.demand/ifcfg-ppp0.manual). Then you just need scripts that can 
copy them back and forth, then restart networking. Here's an idea (I'm 
not scripting genius, so critique away):

#!/bin/bash
cp -a /etc/backup/options.manual /etc/ppp/options 
cp -a /etc/backup/ifcfg-ppp0.manual \
/etc/sysconfig/network-scripts/ifcfg-ppp0
/etc/rc.d/init.d/network restart
exit 0

(If you or someone else doesn't know, the line break on the second line 
isn't necessary - the mailer made a break and I signified with the "\" 
which is how it would look going to the end of a line and wrapping around 
to the next.)

This would copy the *.manual items in a folder /etc/backup and place them 
in the proper places, then restart the network. A crontab entry for 
6:30am to call the above script would take care of it. Just make sure the 
script is executable.

A similar script could be written to reverse the process at 10am , which 
would put you back in business.

Feel free to modify/improve accordingly.

-- 
If Bill Gates had a dime for every time a Windows box crashed...
         
    ...Oh, wait a minute, he already does.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]