LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-12-2007, 02:41 PM   #1
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Rep: Reputation: 15
Where to add route command in files to make it stay on every bootup?


Hello,

I would like to add:

"route add 192.168.0.1 gw 30.38.72.50" to SuSE so that it's not required to be typed every time the system is rebooted.

I scavenged the net and it seems like within /ect/rc.d/boot.local I should be able to add the command and it be loaded with the OS.

Was this a correct notion or is boot.local not for commands like route?

I have seen other threads of various forums mention rc.local and I do not have this file. I attempted to do write that route command into boot.local and it didn't change anything.
 
Old 06-12-2007, 03:12 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
It depends on your distribution (and maybe version thereof).

What is your distribution and version?

What does cat /etc/issue show?

What does uname -a show?
 
Old 06-12-2007, 03:20 PM   #3
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
SuSE 10.1,

It's actually a work computer that I won't have access to till tomorrow morning. I will be sure to post results so I can get this thing solved.

Thanks.
 
Old 06-13-2007, 07:30 AM   #4
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
uname -a : linuxhost1 2.6.16.13-4-default #1 "time" UTC 2006 i686 i686 i386 GNU/Linux

The other command just told me I was running SUSE 10.1
 
Old 06-13-2007, 07:43 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
OK - I don't use Suse but a quick Google search took me to the following page:

http://linuxmafia.com/pub/linux/suse...chapter10.html

It looks by the way as as if the site might be a handy one to book mark if you're doing Suse.

Section 10.4 from the above link says:

Quote:
10.4 Setting up static routing


We've discussed network configurations and what routing is used for. Now you're ready for setting up routing in SuSE Linux. YaST allows you to specify a default router in the format that you used to configure an interface. This is fine for a leaf node in a simple network. However, if the network has more than one router, or you actually want to set up a router, you'll need more than this. You need to specify a routing table. Even if YaST doesn't provide a way to set up a routing table, the SuSE Linux distribution has a fairly easy way to do this.

The file /etc/route.conf contains a routing table, which will be set up by the script /sbin/init.d/route whenever a networking runlevel (by default runlevels two and three) is reached. Following is a very simple routing table such as is found in /etc/route.conf.



#
# /etc/route.conf for hosts in 'Network A'
#
# In this file you can configure your static routing...
#
# This file is read by /sbin/init.d/route.
#
#
# Destination Dummy/Gateway Netmask Device
#
192.168.0.0 0.0.0.0 255.255.255.128 eth0
default 192.168.0.1



This routing table is typical for a simple network host. It could be any host in Network A from Figure 9-2. As you can see, comment lines start with a hash sign (#) in the first column. Comment lines and empty lines are ignored when the route script sets up the kernel routing table.

The other lines represent routing table entries. The format is very close to the output of the route command, as we demonstrate in Chapter 9.

The first column specifies a destination. This can be either a network address, a host address, or the string default for the default gateway. Whether the given address is a host or a network is determined by the netmask given in the third column. The network mask for a host is always 255.255.255.255. Everything else specifies a network route. Network route means a route to a network, whereas a host route is a route to a single host. The second column gives either the IP address of the router, which should be used to reach the destination given in the first column, or the special value 0.0.0.0, which means that all traffic headed to the destination will be given to1 the device specified in the last column. If a gateway address is given, the device specification is optional.

To clearly illustrate this, we refer back to Figure 9-2 and have a look at the entries of the routing tables of the hosts and routers in this network.
 
Old 06-13-2007, 08:28 AM   #6
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
hmmmm... I can't seem to locate any file called route.conf in /etc/

Let me go look again.
 
Old 06-13-2007, 08:33 AM   #7
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If you didn't have any statically defined routes you might not need it. You can create it from scratch. All the lines starting with "#" are comments so you can leave them out (or you can just cut and paste from the earlier post).
 
Old 06-13-2007, 08:48 AM   #8
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
If I do create this file, will I need to do anything in addition to make the system use it?

second day using SUSE, and first time in about 6-7 years. I'm getting the hang of it...slowly.
 
Old 06-13-2007, 09:05 AM   #9
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
nevermind-I am crazy

I thought for some reason I had more/less files when I was logged into root.

Last edited by Sanborn; 06-13-2007 at 09:22 AM.
 
Old 06-13-2007, 09:21 AM   #10
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
Uhh yeah forget that last thing I said, I think i am going crazy
 
Old 06-13-2007, 11:03 AM   #11
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
OK - so if you say forget the last thing you said which is to nevermind the question that means you DO want an answer to the question?

The answer is yes - you'll likely have to stop and start networking to make it take effect. However, if you've already statically set the route with "route add" at command line there's no hurry to do it. I would definitely plan to boot the box after making the change so you could verify the static route comes back in after a reboot. (e.g. Don't just wait for the next time it crashes - you might have forgotten by then and tear your hair out wondering why your networking suddenly is an issue.)
 
Old 06-13-2007, 12:33 PM   #12
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
made the file, made the command.

Nothing happened after reboot ;(

I've also been trying to use the Yast Routing GUI because it has a "expert configuration" portion where you can do the same thing.

The thing is, if I check the box to enable expert config, add my "expert" routing and then hit finish....next time I open up the routing tool the box is unchecked and my settings never go through!!!

 
Old 06-13-2007, 01:13 PM   #13
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
"made the file, made the command"

By file I assume you mean the one from the link I posted.

What "command" have you "made"?
 
Old 06-13-2007, 01:25 PM   #14
Sanborn
Member
 
Registered: Jun 2007
Distribution: Suse 10.1
Posts: 40

Original Poster
Rep: Reputation: 15
Sorry, I began to confuse another trick I was trying to do.

ok: so I made the file route.conf and I placed it in the /etc/ folder per the website you linked.

In the final I only wrote

30.38.72.50 0.0.0.0 255.255.255.0 eth0
192.168.0.1 30.38.72.50 255.255.255.255 eth0

saved the file, rebooted and when using the route -n command I find that nothing has changed.
 
Old 06-13-2007, 01:38 PM   #15
slimm609
Member
 
Registered: May 2007
Location: Chas, SC
Distribution: slackware, gentoo, fedora, LFS, sidewinder G2, solaris, FreeBSD, RHEL, SUSE, Backtrack
Posts: 430

Rep: Reputation: 67
check out the /etc/sysconfig/network/routes file
 
  


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
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
How to add a route table for eth1 and make it the default banner Linux - General 3 05-08-2005 11:14 AM
add a static route in Network init files Ghitza Linux - Networking 1 11-19-2004 05:26 AM
where do i add a command to make it run on boot stuart Linux - Newbie 4 06-21-2004 06:03 PM
Help with Route Add command? graystarr Linux - Networking 4 01-13-2004 04:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:03 PM.

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