Operating System - Linux
1832789 Members
3394 Online
110045 Solutions
New Discussion

Re: backup dial-up connection

 
kcpant
Trusted Contributor

backup dial-up connection

Hi friends,

One of my site have a cable connection for Internet. I want to configure a dial-up modem as a backup connetion in such a way that whenever the cable modem's link goes down, the dial-up connection should get activated automatically, and all services but mailing should stop, since the dial-up connections are low-bandwidth connections, and when the server works on dial-up modem, only mailing services ( sendmail and fetchmail) should work. Please let me know how I can get it configured successfully. cable modem is connected to Linux server through RJ-45 connection.
One more suggestion I want from you all, is using sendmail+ FC4+MailScanner+ ClamAV looks inferior than a qmail/ postfix based solution? I prefer to use sendmail based solution because of it's flexibility.
Thanks In advance.
PreSales Specialist
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: backup dial-up connection

I would suggest a script based solution.

Components:

1) Check the cable modem connection. Do the next steps only if its down.

2) If cable modem down:

service sendmail stop
# stops most incoming sendmail connections. Does nothing about outbound. Outbound mail will simply queue up, waiting to go out if /etc/resolv.conf does not allow for host name resolution on the dial up ip address.

If you want the mail services to work, then the script needs to use an alternate /etc/resolv.conf file based on the host name resolution provided by the dial up provider. Alternately you can have secondary and/or teritiary entries in /etc/resolv.conf to allow resolution.

Mail will work, slowly outbound if you have host name resolution. Thats pretty much all sendmail is going to care about.

For inbound mail, you would need a line in /etc/mail/sendmail.cf or your sendmail.mc file allowing the daemon to listen on the dial up ip address. Thats probably not worth the hassle, but if you want it, see this website for some sendmail.mc macro tools and scripts: http://www.hpux.ws

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Gopi Sekar
Honored Contributor

Re: backup dial-up connection


Write a small script which can handle this:

* Check for cable modem availabiliy (Try pinging some known global machine)
* If it is down, bring up the dialup connection (use wvdial for script based dialup)
* Stop all services (if it is default internet gateway then disable ip_forwarding)
* Bring up sendmail and fetchmail services alone.

Regards,
Gopi
Never Never Never Giveup
kcpant
Trusted Contributor

Re: backup dial-up connection

Thanks SEP & Gopi,

Now I have a brief outline on how to do that. But you haven't answered my second question (required suggestion wether to use sendmail+other components or qmail/ postfix)?
Thanx in adv
PreSales Specialist
Gopi Sekar
Honored Contributor

Re: backup dial-up connection


All the MTA's does the same job, each one has advantage over others. sendmail is more flexible interms of features and configurations but has its own drawback of speed and security (compared to other MTAs). qmail/postfix do offer better security and robustness over sendmail but they lack features(as I remember).

So its all your call whether you want to sacrifice security and speed for feature or otherway around.

It is same as Gnome vs KDE, both of them offer same functionality but in different ways. Gnome concentrates more on functionality and KDE towards the user interface.

Hope this helps,
Gopi
Never Never Never Giveup
kcpant
Trusted Contributor

Re: backup dial-up connection

Thanks Gopi,

Now I have made a tiny script to check the connectivity through cable-modem ( forgive me if it looks bad, I don't have much experience of scripting!). If I run it through terminal , it works well, but if I make a cron entry into /etc/crontab to invoke this script every 2 minutes, I (means root) get an error-mail "TERM environment variable not set" for this entry. Please tell me what is the thing I skipped. Also suggest me to make this script better way.

thanks in advance.
PS: script is attached.
PreSales Specialist
Gopi Sekar
Honored Contributor

Re: backup dial-up connection


your problem looks like you are trying to open xterm program which requires running X. Also you need to export DISPLAY variable for xterm to work.

I have attached the updated script which contains suggestions for handling this.

Regards,
Gopi
Never Never Never Giveup
kcpant
Trusted Contributor

Re: backup dial-up connection

thanks Gopi,

Your suggestions helped me to understand what's wrong. But I want to get a display on standard output device (monitor) instead of mails. I have tried to set TERM & DISPLAY variables in this script , but no luck. Is there any other way round to get the disconnection error msg instantly displayed on the current display?

thanks in advance
PreSales Specialist
Gopi Sekar
Honored Contributor

Re: backup dial-up connection


I believe you want GUI based alert message. for that you need to have the localhost added using xhost. and also the cron job should be executed as the same user as who is logged on the X.

if you want to send message to a particular console terminal (tty1 to 12) then you can use write command. check 'man write' for more info.

if you want to send messages to all the terminals (including remote logins) then use wall command. check 'man wall' for information on this. run wall as root and you will get the message displayed to all the users who are logged on.

Regards,
Gopi
Never Never Never Giveup
kcpant
Trusted Contributor

Re: backup dial-up connection

Closing threads open from a long time....
PreSales Specialist