LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-26-2012, 12:11 AM   #1
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,432

Rep: Reputation: 110Reputation: 110
Checking if an SSH tunnel is up


I use a notebook for everything, including checking email, including in public wifi spots. As a result, my email and messenger are permanently configured to send and receive email/messages through an SSH tunnel:

Code:
# ssh -q -f -N -C -T -p $port $user@$basehost -L 225:domain.com:25 -L 2110:domain.com:110 -L 2456:messenger.hotmail.com:1863 -L 2459:gateway.messenger.hotmail.com:1863
That thing above is part of a script I run manually about a minute after booting my machine. And I also have to run it manually every two or three hours, because the tunnel goes down after a while.

How can I automate that? I would like to have it:

- run on boot
- check if the (usually wifi) connection is already available
- create the tunnel
- postpone it if no connection is available yet
- do nothing if the tunnel already exists and is up/responsive, so it can be run on cron every 30 or 60 minutes

Honestly, I think I can only go as far as running it on boot. I need help with all the rest. :-\
 
Old 02-26-2012, 02:13 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

I think you need AutoSSH. I've been using it for quite some time now to keep SSH tunnels alive and it works great. It might also be available in the repositories of your distro, just check.

Kind regards,

Eric
 
1 members found this post helpful.
Old 02-26-2012, 02:21 AM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
you could do checking of network connection like in this post #6 and below that
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Initiate ssh tunnel to connect to ssh? brianmcgee Linux - Security 2 09-07-2011 10:07 AM
Checking Proxy for SSL tunnel support ADxD_7 Linux - Networking 3 10-23-2008 06:14 PM
setting up an ssh soxy or local ssh tunnel from within an ssh soxy Mangenius Linux - Networking 0 03-05-2007 03:15 PM
ssh tunnel crep Linux - Networking 2 08-25-2004 08:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration