LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-11-2014, 11:38 AM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Rep: Reputation: 49
How to schedule a restart of networking after a reboot


I have two machines where upon reboot, sometimes eth0 will go down once the logon prompt appears. Based on constant pings, it does come up during the boot process but then something happens around when the logon screen appears to makes it stop responding. And this doesn't happen at every boot, but enough to where it's caused issues/pain.

I've never been able to figure out why, but I'm wondering if there's some sort of workaround I can do by maybe scheduling a cron job to start/restart eth0 like a minute or two after reboot, that way regardless it will be up after that.

I know, very cheesy and not ideal, but it would get me through till those machines are retired.
 
Old 08-11-2014, 02:58 PM   #2
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
You can typically run a cronjob at reboot. @reboot in a crontab is something that I have used quite a bit to run something after we have rebooted a server.
 
1 members found this post helpful.
Old 08-11-2014, 03:55 PM   #3
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
Sounds like exactly what I need. thanks!
 
Old 08-12-2014, 09:52 PM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,742

Rep: Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300
I think it depends on the distribution.

Gnome makes an assumption that the network shouldn't be available until a user logs in. This can usually be corrected by marking the inteface "not configurable by users".
 
Old 08-13-2014, 09:13 AM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
These machines are RHEL, not sure how they handle it.
 
Old 08-13-2014, 10:07 AM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,742

Rep: Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300
RH is basically the same as Fedora.

Their default is gnome - so if you are using gnome then you likely have the problem that Gnome is turning the network OFF under the assumption that only the logged in user will turn it on.

The final symptom is that if the user logs out, the network is again disabled...
 
1 members found this post helpful.
Old 08-13-2014, 10:11 AM   #7
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
Maybe that's it. My server boots to a CLI logon prompt though, but maybe gnome is running/installed?

Although the network never turns itself off after I manually restart it if it dies when the logon prompt appears. Unless maybe that's because some system account "logs in" but never logs out due to running processes?
 
Old 08-13-2014, 10:44 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,742

Rep: Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300
Gnome shouldn't be running...

but it is possible that the elements required by Gnome are. Things like the credential managment crap, logind, and some others that got grafted into the system. These are useful in some areas, but just cause more problems most of the time for servers.

Just more complex than it needs to be.

Whether that gets the root login identified as never logging out I'm not sure. But marking the interface "not under user control" should stop it from shutting the network down.

BTW, the cron restart might fix it... and it might not. Cron is usually started at the same time as the interactive logins. If it happens to run first, I would expect it to fail as the network would still be up. And then be shutdown by whatever is doing it now.

Last edited by jpollard; 08-13-2014 at 10:48 AM.
 
1 members found this post helpful.
Old 08-13-2014, 11:24 AM   #9
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
So how do I do that "not under user control" thing from the command line?
 
Old 08-13-2014, 11:48 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,742

Rep: Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300
On my system I have the /etc/sysconfig/network-scripts/ifcfg-eth0 (or whatever you name it marked as "NM_CONTROLED=no", and "ONBOOT=yes".

What I'm not sure of is how much NetworkManager does with this. I gave up on it, and use the legacy network startup. But that is just because I don't remember. I think the network is started anyway, but once started, it is ignored by NetworkManager - thus it isn't under user control.
 
Old 08-13-2014, 12:29 PM   #11
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
in my ifcfg-eth0 is have ONBOOT=yes but I don't even have a NM_CONTROLLED listed in it, not sure what that means.
 
Old 08-13-2014, 04:46 PM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,742

Rep: Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300Reputation: 1300
All of the current RH releases have been using NetworkManager to handle the startup/shutdown of networks, and to provide a service daemon that users can interact with to start/stop those they are permitted to control.

Without that entry (being specifically set to "no"), I think NetworkManager assumes control.
 
Old 08-13-2014, 04:49 PM   #13
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
My servers kinda old, is there a way to tell if mine uses that setting? I tried man ifcfg but it said a man page didn't exist.
 
Old 08-13-2014, 05:35 PM   #14
Stvrosky
LQ Newbie
 
Registered: Aug 2014
Location: Chile
Distribution: RHEL 6.5 x86_64
Posts: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by rjo98 View Post
My servers kinda old, is there a way to tell if mine uses that setting? I tried man ifcfg but it said a man page didn't exist.
NM_CONTROLLED appears since RHEL 6.X, it doesn't appears in earlier versions of RHEL.
You check the ifcfg-eth0 configuration, is ok? Do you review the dmesg/messages/boot files in /var/log/?
Maybe a work around, it would be put a crontab with a script that will check the networks and when something is wrong (link down), it can restart the network service. Anyway the case is really strange, because the network service starts after the file system check.

Last edited by Stvrosky; 08-13-2014 at 05:37 PM. Reason: Add information
 
Old 08-13-2014, 05:45 PM   #15
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,748

Original Poster
Rep: Reputation: 49
I'm only running 5.4. Nothing I noticed in /var/log that gave a hint as to why it's doing it sometimes.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
samba needs restart on reboot johnh10000 Linux - Networking 2 01-20-2011 06:42 AM
Restart networking without reboot. patufet99 Linux - Networking 6 10-15-2009 02:55 PM
Cannot restart, reboot, or shutdown slimfadey Linux - Newbie 3 04-28-2005 08:07 PM
Always have to reboot to restart dsl sh1ft Slackware 8 04-21-2004 10:49 PM
Named cache kept through restart or reboot Supp0rtLinux Linux - Networking 2 01-21-2002 06:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:35 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration