Where do I put `route add default gateway`?

Where do I put `route add default gateway`?

Post by Sky Lemo » Fri, 18 May 2001 10:51:38



This is a pretty basic question, but I'm no guru. I know that you should
define your gateway in one of the startup scripts, but where?

`route add default gateway`

Thanks,

-Chris

 
 
 

Where do I put `route add default gateway`?

Post by Tony Curti » Fri, 18 May 2001 10:57:15


>> On Thu, 17 May 2001 01:51:38 GMT,

> This is a pretty basic question, but I'm no guru. I know
> that you should define your gateway in one of the
> startup scripts, but where?
> `route add default gateway`

Put the address of the default gateway/router in
/etc/defaultrouter.  The full story is in:

    man -s4 defaultrouter

/etc/init.d/inetinit is where this file gets read and the
route added.  Hmmmm, thought: couldn't the defaultrouter
be configured in /etc/default/inetinit like tcp_strong_iss
is?

hth
t
--
Just reach into these holes.  I use a carrot.

 
 
 

Where do I put `route add default gateway`?

Post by G.T. » Fri, 18 May 2001 11:09:20



> This is a pretty basic question, but I'm no guru. I know that you should
> define your gateway in one of the startup scripts, but where?

Do you mean /etc/defaultrouter?  Just create a file with that name
containing only the ip of your default gateway.

# cat /etc/defaultrouter  
192.168.1.1

Greg

 
 
 

Where do I put `route add default gateway`?

Post by David Hil » Fri, 18 May 2001 11:06:27



> This is a pretty basic question, but I'm no guru. I know that you should
> define your gateway in one of the startup scripts, but where?

> `route add default gateway`

> Thanks,

> -Chris

create the file /etc/defaultrouter that contains the IP of your default
router.

for example,
echo "192.168.1.1" > /etc/defaultrouter

- David

 
 
 

Where do I put `route add default gateway`?

Post by Sky Lemo » Fri, 18 May 2001 12:29:28


Thanks all! I actually did this once and forgot about it!

-Chris


> This is a pretty basic question, but I'm no guru. I know that you should
> define your gateway in one of the startup scripts, but where?

> `route add default gateway`

> Thanks,

> -Chris

 
 
 

Where do I put `route add default gateway`?

Post by Mathew Kirsc » Fri, 18 May 2001 22:52:06



> This is a pretty basic question, but I'm no guru. I know that you should
> define your gateway in one of the startup scripts, but where?

> `route add default gateway`

Nowhere. The facility is already provided for you.
Simply list the IP address of the default router in /etc/defaultrouter, then
reboot the system.
 
 
 

Where do I put `route add default gateway`?

Post by P Lanvi » Fri, 18 May 2001 23:02:03



> This is a pretty basic question, but I'm no guru. I know that you should
> define your gateway in one of the startup scripts, but where?

> `route add default gateway`

Solaris recognizes the file /etc/defaultrouter

$su - root
#cat > /etc/defaultrouter
<router-IP>
^D
$

Also, look into /etc/rc2.d/S69inet

rgds

/PL

 
 
 

Where do I put `route add default gateway`?

Post by Dennis Peterso » Sun, 20 May 2001 00:56:34



> This is a pretty basic question, but I'm no guru. I know that you should
> define your gateway in one of the startup scripts, but where?

> `route add default gateway`

> Thanks,

> -Chris

Create an entry in your /etc/hosts file (IP and name are examples):
192.168.10.1    defaultrouter # default router - name is arbitrary

Create a file, /etc/defaultrouter, and put in it the hostname you just
created in your /etc/hosts file. You can also put just the IP of the
default router in that file, but I prefer using this method over placing
the IP in the /etc/defaultrouter file as it gives me one place on my
systems to worry about IP's.

This will ensure your system will come up with your selection as a
default route but won't help the current session. This can be corrected
as follows (using the example information):
# route add default 192.168.10.1 1

Dennis Peterson
CTO
One Stop Consulting, Inc.
Seattle, WA
http://thinkUNIX.com

 
 
 

Where do I put `route add default gateway`?

Post by Dennis Peterso » Sun, 20 May 2001 00:59:06




> > This is a pretty basic question, but I'm no guru. I know that you should
> > define your gateway in one of the startup scripts, but where?

> > `route add default gateway`

> Nowhere. The facility is already provided for you.
> Simply list the IP address of the default router in /etc/defaultrouter, then
> reboot the system.

Better is to add the route manually (reboots are rarely a requirement):
# route add default <IP of router> 1

Dennis Peterson
CTO
One Stop Consulting, Inc.
Seattle, WA
http://thinkUNIX.com

 
 
 

Where do I put `route add default gateway`?

Post by Tony Walto » Sun, 20 May 2001 01:24:54





> > > This is a pretty basic question, but I'm no guru. I know that you should
> > > define your gateway in one of the startup scripts, but where?

> > > `route add default gateway`

> > Nowhere. The facility is already provided for you.
> > Simply list the IP address of the default router in /etc/defaultrouter, then
> > reboot the system.

> Better is to add the route manually (reboots are rarely a requirement):
> # route add default <IP of router> 1

And best, possibly, is to do both.  

echo IP_of_router >>  /etc/defaultrouter (so the route will be added
automatically the next time you reboot) and do a "route add default
IP_of_router" (to avoid needing to reboot immediately).

--
Tony

 
 
 

Where do I put `route add default gateway`?

Post by Mathew Kirsc » Sun, 20 May 2001 03:10:30



> > Nowhere. The facility is already provided for you.
> > Simply list the IP address of the default router in /etc/defaultrouter, then
> > reboot the system.

> Better is to add the route manually (reboots are rarely a requirement):
> # route add default <IP of router> 1

I have my reasons for rebooting

1. Saves having to explain how to use route to a newbie.
2. Tests that the default route is properly set during a reboot. It's much
easier to reboot a system to test things during the installation phase.
3. Proves that the default route is automatically set during a reboot.

 
 
 

Where do I put `route add default gateway`?

Post by Dennis Peterso » Sun, 20 May 2001 11:59:30






> > > > This is a pretty basic question, but I'm no guru. I know that you should
> > > > define your gateway in one of the startup scripts, but where?

> > > > `route add default gateway`

> > > Nowhere. The facility is already provided for you.
> > > Simply list the IP address of the default router in /etc/defaultrouter, then
> > > reboot the system.

> > Better is to add the route manually (reboots are rarely a requirement):
> > # route add default <IP of router> 1

> And best, possibly, is to do both.

> echo IP_of_router >>  /etc/defaultrouter (so the route will be added
> automatically the next time you reboot) and do a "route add default
> IP_of_router" (to avoid needing to reboot immediately).

> --
> Tony

Absolutely - thanks for being more clear than I. It was the unneeded
reboot I was focused on.

Dennis Peterson
CTO
One Stop Consulting, Inc.
Seattlem, WA
http://thinkUNIX.com

 
 
 

Where do I put `route add default gateway`?

Post by Dennis Peterso » Sun, 20 May 2001 11:56:39




> > > Nowhere. The facility is already provided for you.
> > > Simply list the IP address of the default router in /etc/defaultrouter, then
> > > reboot the system.

> > Better is to add the route manually (reboots are rarely a requirement):
> > # route add default <IP of router> 1

> I have my reasons for rebooting

> 1. Saves having to explain how to use route to a newbie.
> 2. Tests that the default route is properly set during a reboot. It's much
> easier to reboot a system to test things during the installation phase.
> 3. Proves that the default route is automatically set during a reboot.

I don't agree with #1 - that's what keeps them wallowing as newbies, but
that's just me. #2 and 3 are fine and should be done for the reasons you
state. But on a system that drags in 6-7 figures a day, you'd probably
agree the boot can wait for the next scheduled outage. In any event, it
is a very good idea to know how to do all these things (and to know this
*can* be done) from the command line and to avoid a gratuitous reboot
whenever possible.

Dennis Peterson
CTO
One Stop Consulting, Inc.
Seattle, WA
http://thinkUNIX.com