View previous topic :: View next topic |
Author |
Message |
Apreche Guru
Joined: 18 Sep 2003 Posts: 506 Location: Beacon, NY
|
Posted: Sat Mar 27, 2004 2:49 pm Post subject: bring network back up automatically? |
|
|
Ok, so I have a server in the bedroom, it connects with dhcp over ethernet, it's very standard. There is no KVM for this server, and it would be a pain in the ass to drag some over there. The server is super stable and never goes down (so far), mad props to the gs sources. But the other day the network cable got unplugged. I plugged it back in, but the network didn't come back up. The only way I know of making it come back up is to do ifup eth0. But that would only be possible by bringing over a keyboard and monitor, not worth the effort, when pushing the restart button does the same thing. So my precious multi-month uptime was killed, sorrow. Anyway, is there any sort of program that will automatically do the ifup and ifdown when the cable gets unplugged and re-plugged? I couldn't find anything by doing emerge search. Please help, thanks. |
|
Back to top |
|
|
agent_jdh Veteran
Joined: 08 Aug 2002 Posts: 1783 Location: Scotland
|
Posted: Sat Mar 27, 2004 3:24 pm Post subject: |
|
|
It's always a good idea to have the ability to ssh into a server or other box with no keyboard. This way you can take care of maintenance stuff like that (and the odd upgrade) easily from your workstation.
You could also use your hosts.allow/deny files to control ssh access to the server from one ip address (i.e. your workstation) only if you have security concerns. _________________ Jingle Jangle Jewellery |
|
Back to top |
|
|
gabe-kai n00b
Joined: 03 Sep 2003 Posts: 63 Location: Michigan, USA
|
Posted: Sat Mar 27, 2004 4:11 pm Post subject: ssh needs network connection. |
|
|
That would work if he had a network connection at that point, but after the cable was plugged back in his network connection was still not connected enough to use SSH.
A kluge solution would be to simply set a cron job to restart the network at regular intervals.
An only slightly more elegent solution would be to write a batch file to periodically send out a small ping, and if it's not returned then restart the network.
However I agree that there has to be a better way, something that is perhaps a standard method of detecting and re-enabling network connectivity as the cable is unplugged and replugged. I'll be looking for this with you, and if I find it I'll post it back here for you. _________________ "People demand freedom of speech to make up for the freedom of thought which they avoid."
- Soren Aabye Kierkegaard |
|
Back to top |
|
|
agent_jdh Veteran
Joined: 08 Aug 2002 Posts: 1783 Location: Scotland
|
Posted: Sat Mar 27, 2004 4:42 pm Post subject: Re: ssh needs network connection. |
|
|
gabe-kai wrote: | That would work if he had a network connection at that point, but after the cable was plugged back in his network connection was still not connected enough to use SSH.
A kluge solution would be to simply set a cron job to restart the network at regular intervals.
An only slightly more elegent solution would be to write a batch file to periodically send out a small ping, and if it's not returned then restart the network.
However I agree that there has to be a better way, something that is perhaps a standard method of detecting and re-enabling network connectivity as the cable is unplugged and replugged. I'll be looking for this with you, and if I find it I'll post it back here for you. |
Oh larf. I can't believe I didn't think of that. Serves me right for posting here before having any caffeine. _________________ Jingle Jangle Jewellery |
|
Back to top |
|
|
Apreche Guru
Joined: 18 Sep 2003 Posts: 506 Location: Beacon, NY
|
Posted: Sat Mar 27, 2004 5:16 pm Post subject: |
|
|
SOLUTION!!!
Code: | emerge search ifplugd
rc-update add ifplugd default
/etc/init.d/ifplugd start |
Why isn't something like this built into the system? I mean even Windows does it right. It's nice to know it exists, and it does work well, but you really shouldn't need a seperate daemon running to do this. The functionality should be implemented on a lower level, possibly the same level as usb hot plugging.
Just emerged it and started it. Wow, it even makes a nice beeping sound every time you unplug/plug in the cable. |
|
Back to top |
|
|
agent_jdh Veteran
Joined: 08 Aug 2002 Posts: 1783 Location: Scotland
|
Posted: Sat Mar 27, 2004 6:24 pm Post subject: |
|
|
Well done that man. Think I'll start using it myself on my server box, you never know... _________________ Jingle Jangle Jewellery |
|
Back to top |
|
|
|