Link to home
Start Free TrialLog in
Avatar of esbfern
esbfern

asked on

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?
Avatar of jgiordano
jgiordano
Flag of United States of America image

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.
Avatar of esbfern
esbfern

ASKER

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.
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

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...
ASKER CERTIFIED SOLUTION
Avatar of esbfern
esbfern

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial