LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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-2009, 10:00 AM   #1
epoh
Member
 
Registered: Jan 2008
Posts: 75

Rep: Reputation: 15
Loosing the default route on reboot


I've got 25 servers that have been built in the past few months using the same RHEL5 cd - kernel 2.6.18-128.el5. They all seem to have the same problem, on reboot they loose their default route. /etc/sysconfig/network has the gateway information on each and every server. But after rebooting and issuing the 'route' command, no default entry. Has anyone else run into this problem? Running a script on boot to add the default route works fine, but I'm still concerned that something's not working properly on these boxes.
 
Old 08-11-2009, 12:06 PM   #2
thllgo
Member
 
Registered: Sep 2003
Location: Laurel MD
Posts: 296

Rep: Reputation: 32
Hello

As I understand in the file /etc/sysconfig/network, there is a line that reads

GATEWAY=a.b.c.d

where a.b.c.d is the address of your default router. Have you checked that the network service is started on boot. "/sbin/chkconfig network on". You can do a "/sbin/chkconfig --list |grep network". You should see that the network is off for init states of 0,1, and 6 on for init states 2,3,4,and 5

something else to check is permissions on the network file
owner=root, group=root and 644

I don't know if it makes a difference but you can also check /etc/sysconfig/network-scripts/ifcfg-eth0 has the entry "ONBOOT=yes"
 
Old 08-11-2009, 12:28 PM   #3
epoh
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
These are all setup as they should be with correct permissions. I am honestly thinking there is some sort of bug going on with this specific version I'm using. I've not had this happen with my other servers. The downside is I cannot easily patch these boxes (requires coordination with the SAP team and the customer.)

Quote:
[root@sappbid0 ~]# cd /etc/sysconfig/
[root@sappbid0 sysconfig]# ls -al network
-rw-r--r-- 1 root root 70 Jul 29 16:10 network
[root@sappbid0 sysconfig]# more network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=sappbid0
GATEWAY=10.18.1.1
[root@sappbid0 sysconfig]# more network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.18.1.255
IPADDR=10.18.1.16
NETMASK=255.255.254.0
NETWORK=10.18.1.0
ONBOOT=yes
[root@sappbid0 sysconfig]# chkconfig --list | grep network
network 0_off 1_off 2_on 3_on 4_on 5_on 6_off
(ETA, had to change the chkconfig result because the forum apparently freaks out with ':')

Last edited by epoh; 08-11-2009 at 12:29 PM.
 
Old 08-11-2009, 05:57 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by epoh
Running a script on boot to add the default route works fine, but I'm still concerned that something's not working properly on these boxes.
What "script" are you referring to?

After rebooting and then running # service network restart manually, is the default gateway in place?
 
Old 08-12-2009, 09:09 AM   #5
mwengren
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Rep: Reputation: 0
Hi,

My first post on LinuxQuestions. Thanks for posting this problem because I have the same behavior on my RHEL5 64 bit box.

uname -ri
2.6.18-128.4.1.el5 x86_64

All of the network script settings are correct, but each time the machine is rebooted or the network service restarted manually, the default gateway is lost.

I have not come across this problem before on any of the linux systems I've worked on.

Any solution other than adding the route add command to a boot script?

Thanks.
 
Old 08-12-2009, 09:11 AM   #6
mwengren
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Rep: Reputation: 0
Hi,

My first post on LinuxQuestions. Thanks for posting this problem because I have the same behavior on my RHEL5 64 bit box.

uname -ri
2.6.18-128.4.1.el5 x86_64

All of the network script settings are correct, but each time the machine is rebooted or the network service restarted manually, the default gateway is lost.

I have not come across this problem before on any of the linux systems I've worked on.

Any solution other than adding the route add command to a boot script?

Thanks.
 
Old 08-12-2009, 09:31 AM   #7
epoh
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by anomie View Post
What "script" are you referring to?

After rebooting and then running # service network restart manually, is the default gateway in place?
I'm talking about a little shell script I created to run on boot that adds the default route back in. Manually restarting the network after a reboot does not add the default route back.

I am hoping I'll get to patch these machines sometime in the next few weeks. We'll see if that fixes it.
 
Old 08-12-2009, 03:10 PM   #8
thllgo
Member
 
Registered: Sep 2003
Location: Laurel MD
Posts: 296

Rep: Reputation: 32
Quote:
GATEWAY=10.18.1.1
[root@sappbid0 sysconfig]# more network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.18.1.255
IPADDR=10.18.1.16
NETMASK=255.255.254.0
NETWORK=10.18.1.0
I don't know if it makes a difference but with a netmask of 255.255.254.0 the NETWORK should be 10.18.0.0 I believe either your netmask should be changed to 255.255.255.0 or network to 10.18.0.0. Considering where the default router is I would think change the netmask.
 
Old 08-12-2009, 03:23 PM   #9
epoh
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by thllgo View Post
I don't know if it makes a difference but with a netmask of 255.255.254.0 the NETWORK should be 10.18.0.0 I believe either your netmask should be changed to 255.255.255.0 or network to 10.18.0.0. Considering where the default router is I would think change the netmask.
That is what I got from my network team.

Regardless, everything works fine once I add a manual route, if the netmask were wrong it would stay broken, wouldn't it?

Last edited by epoh; 08-12-2009 at 03:37 PM.
 
Old 08-12-2009, 03:33 PM   #10
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
@epoh: I'd still be curious to see your script and precisely what it is doing. Since the /etc/init.d/network script is not setting up the default gateway properly, clearly something (either the init script or the values fed to it) is broken.
 
Old 08-12-2009, 03:50 PM   #11
thllgo
Member
 
Registered: Sep 2003
Location: Laurel MD
Posts: 296

Rep: Reputation: 32
Quote:
That is what I got from my network team.

Regardless, everything works fine once I add a manual route, if the netmask were wrong it would stay broken, wouldn't it?
I don't really know. My only guess is to change the netmask, reboot and see if it works.
 
Old 08-12-2009, 03:52 PM   #12
epoh
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by anomie View Post
@epoh: I'd still be curious to see your script and precisely what it is doing. Since the /etc/init.d/network script is not setting up the default gateway properly, clearly something (either the init script or the values fed to it) is broken.
My script could not be any simpler:

Quote:
[root@sapptxa0 etc]# more route.sh
#!/bin/sh
route add default gw 10.18.1.1
I have not edited anything in the /etc/init.d/network script. the network itself comes up and online, and all the routes listed in the /etc/sysconfig/network-scripts/route-eth# files are put in place just like they are supposed to.

Quote:
[root@sapptxa0 init.d]# ls -al /etc/init.d/network
-rwxr-xr-x 1 root root 8022 Nov 13 2008 /etc/init.d/network

[root@sapptxa0 rc3.d]# pwd
/etc/rc3.d
[root@sapptxa0 rc3.d]# ls -al S10network
lrwxrwxrwx 1 root root 17 Jul 16 06:47 S10network -> ../init.d/network
I don't know what could be messed up with it, given that I never edited it. What would I be looking for within the network script file?
 
Old 08-12-2009, 03:53 PM   #13
epoh
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by thllgo View Post
I don't really know. My only guess is to change the netmask, reboot and see if it works.
The netmask is correct. And I looked at the other boxes, that was the only box with 10.18.1.0 listed as the network. I think another admin helped do the config on that one server. All the other boxes have 255.255.254.0 and 10.18.0.0 for the gateway and network, respectively. They all have the same issue.
 
Old 08-12-2009, 04:24 PM   #14
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by epoh
What would I be looking for within the network script file?
You could start with this script as a troubleshooting point to determine why default gateway is not being set properly.

To /etc/init.d/network, add (just below the sh-bang line):
Code:
set -x
Then run:
Code:
/etc/init.d/network restart
You're going to see a whole lot of output (i.e. each command echoed before it is run). What you're looking for is references to the GATEWAY value being read - or not.

If your shell script-fu is no good, you can post output here (or upload it as plain text to an area where we can view it).
 
Old 08-13-2009, 09:26 AM   #15
epoh
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
Ok.. now I think I'm loosing my mind. I haven't change anything on this one box I've been looking at (because it hasn't been handed over to the SAP team) and now it seems to be behaving perfectly. 'service network restart' - default route is there. Reboot - default route is there. I am going to see if the SAP guys will let me play with a different box.
 
  


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
Quagga default route not showing in kernel default route (netstat -nr) Valkyr1e Linux - Networking 3 08-03-2008 09:20 PM
Loosing IP configuration after reboot makram.ng Linux - Networking 1 01-08-2007 08:00 AM
Default route took 20s to display with 'route' command Akhran Linux - Newbie 3 11-04-2006 04:59 AM
default route has to be set evey reboot? lucktsm Linux - Networking 3 11-28-2005 05:07 PM
Loosing hardware settings on reboot..? ScreeminChikin Linux - General 1 09-09-2002 03:46 PM

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

All times are GMT -5. The time now is 05:53 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
Open Source Consulting | Domain Registration