LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   Making default gateway address permanent in SuSe 10 (https://www.linuxquestions.org/questions/suse-opensuse-60/making-default-gateway-address-permanent-in-suse-10-a-419920/)

alienmagic 02-26-2006 09:29 PM

Making default gateway address permanent in SuSe 10
 
I just installed SuSe for the first time on my home network. We used it at work for a mail server, but other than manage user accounts, I didn't mess with it much. I've generally used Red Hat distros up until now.

In SuSe 10, I can't figure out how to permanantly add a default gateway through the CLI. In Red Hat, it's just a matter of adding a line to /etc/sysconfig/network or /etc/sysconfig/network-scripts/ifcfg-eth0, depending on the setup. Niether of these files exist in my fresh install of SuSe 10.

I've done quite a bit of Googling, and came up with two sites that said to edit etc/rc.d/rc.local in SuSe. Unfortunately, this file does not exist either. I need to know how to make the gateway permanent using the command line. Can I just create rc.local in /etc/rc.d, or is there somewhere else I should be making the default gateway address permanent?

jschiwal 02-26-2006 09:41 PM

You can do that in YaST. Go to the Network Devices --> Network Card setup dialog. Select your NIC or wireless device and click on Edit.

In the Detailed Settings area on the bottom of the window, click on Routing.
This is where you enter the default gateway for the device.

There will be a file created named /etc/sysconfig/network/routes. I think that the manual way of doing it would be to add a route using ifconfig and then running SuSEconfig, but I'm not certain if SuSEconfig would pick up the change without actually trying it.

nguyennh 02-26-2006 09:44 PM

Using CLI :
route add default gw <your default gateway address> eth0
or
route add -net default gw <your default gateway address> eth0

nguyennh 02-26-2006 09:49 PM

GUI make things beautiful , but CLI make them fast and strong .

alienmagic 02-26-2006 10:56 PM

Quote:

Originally Posted by nguyennh
Using CLI :
ute add default gw <your default gateway address> eth0
r add -net default gw <your default gateway address> eth0

I regularly use this command for adding a gateway, but I need to make it permanent. This does not.

Quote:

Originally Posted by jschiwal
You can do that in YaST. Go to the Network Devices --> Network Card setup dialog. Select your NIC or wireless device and click on Edit.

I tried manually creating the file /etc/sysconfig/network/routes and adding:

GATEWAY=192.168.200.1

and saw this error as it was restarting:


Quote:

noiface Error while executing:
Command 'ip route replace to GATEWAY=192.168.200.1' returned:
Error: an inet prefix is expected rather than "GATEWAY=192.168.200.1".
Configuration line: GATEWAY=192.168.200.1
and still had no gateway listed when I run route.

edit: I finally figured out that the format for the routes file is:

default 192.168.200.1 - -

rather than what I was trying before. That seems to have taken care of it.

nguyennh 02-27-2006 12:14 AM

Quote:

Originally Posted by alienmagic
I regularly use this command for adding a gateway, but I need to make it permanent. This does not.

Why don't you place it on your bootup script ?

alienmagic 02-27-2006 06:10 AM

Do you mean putting the command in /etc/rc.d/init.d or /etc/rc.d/rc.local?
Neither of those files exists. Is there another file I should add the command to?

nguyennh 02-27-2006 07:51 PM

Place command above to your ~/.bashrc or /etc/profile (RedHat , Fedora) and /etc/bash.bashrc (I don't remember exactly) on SuSE .

Harlin 02-28-2006 03:26 AM

Suse uses /etc/init.d/boot.local or /etc/boot.local like Redhat uses rc.local for startup scripts.

knockout_artist 01-02-2008 10:29 AM

Good Day,

I make cahnges to file

/etc/sysconfig/network/routes

But when I restart computer it disappears. Suse writes down its on default entries.
How could I stop suse from updating the file.


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