How can I configure the network interface on Linux to automatically reconnect if the cable was disconnected.?

I have my Red Hat Enterprise 5 workstation set up to use Active Directory authentication.  I also have it configured to lock the screen after 30 minutes of inactivity.  The problem is - if someone disconnects my network cable even momentarily while the screen is locked, I can't authenticate and unlock the screen because the network interface is inactive (so it can't communicate with AD).  Is there a way to configure the system to automatically activate the network interface once the cable is reconnected?
esbfernAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jgiordanoCommented:
Are you talking about reconnecting to the network or re-authenticating with AD?

If you are using a static IP it will reconnect instantly  when the cable is plugged back in.

I am not sure about how AD handles lost connections.
0
esbfernAuthor Commented:
I am talking about reconnecting to the network.  I am set up to use DHCP and if I disconnect the cable then reconnect it, I have to manually activate the connection again.  I am wondering if there is a way to have the OS auto reconnect to the network.  The AD part is only related in the sense that I can't log back in and manually activate the network interface because my AD credentials can't be authenticated since AD is unreachable.   I hope this explanation is clear.
0
jgiordanoCommented:
you might want to taking a look @ dhclient.conf

here is some information on users having issues switching between connections -

http://ubuntuforums.org/archive/index.php/t-43766.html
0
dennisonzCommented:

You may want to try running a script to check network connectivity every minute:

#!/bin/bash
if ! `ping -c5 192.168.1.1 >/dev/null 2>&1` ; then
/etc/rc.d/init.d/network restart
fi
exit 0

This would perform 5 ping test and if it fails, it will restart the network.

You can save it in /usr/bin/pingtest then chmod 775 /usr/bin/pingtest to make it executable

Using crontab -e, input:

* * * * *  /usr/bin/pingtest

Verify that the script is working, once verified, stay logged in first then unplug your network cable then plug it again...
0
esbfernAuthor Commented:
The solution to this issue was to enable the NetworkManager service and to modify the startup so this service would run by default.  The service checks the connection to the network and attempts to activate the network interface if it is inactive.  It is only needed when you're running DHCP.  

To start the service: sudo service NetworkManager start
To make it persistent (survive reboots): sudo chkconfig NetworkManager on

This doesn't mean that the suggestions offered earlier aren't valid, but this is the method suggested by Red Hat.  My thanks to all of you.

Bob Reed
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.