Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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"
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.)
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?
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?
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.
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.
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?
@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.
@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
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.
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.