LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 02-26-2006, 09:29 PM   #1
alienmagic
Member
 
Registered: Feb 2006
Distribution: Slackware 10.2, (2.6.16.16), FC 5
Posts: 109

Rep: Reputation: 15
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?
 
Old 02-26-2006, 09:41 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.

Last edited by jschiwal; 02-26-2006 at 09:47 PM.
 
Old 02-26-2006, 09:44 PM   #3
nguyennh
Member
 
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106

Rep: Reputation: 15
Using CLI :
route add default gw <your default gateway address> eth0
or
route add -net default gw <your default gateway address> eth0
 
Old 02-26-2006, 09:49 PM   #4
nguyennh
Member
 
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106

Rep: Reputation: 15
GUI make things beautiful , but CLI make them fast and strong .
 
Old 02-26-2006, 10:56 PM   #5
alienmagic
Member
 
Registered: Feb 2006
Distribution: Slackware 10.2, (2.6.16.16), FC 5
Posts: 109

Original Poster
Rep: Reputation: 15
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.

Last edited by alienmagic; 02-26-2006 at 11:15 PM.
 
Old 02-27-2006, 12:14 AM   #6
nguyennh
Member
 
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106

Rep: Reputation: 15
Lightbulb

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 ?
 
Old 02-27-2006, 06:10 AM   #7
alienmagic
Member
 
Registered: Feb 2006
Distribution: Slackware 10.2, (2.6.16.16), FC 5
Posts: 109

Original Poster
Rep: Reputation: 15
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?
 
Old 02-27-2006, 07:51 PM   #8
nguyennh
Member
 
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106

Rep: Reputation: 15
Place command above to your ~/.bashrc or /etc/profile (RedHat , Fedora) and /etc/bash.bashrc (I don't remember exactly) on SuSE .
 
Old 02-28-2006, 03:26 AM   #9
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Rep: Reputation: 38
Suse uses /etc/init.d/boot.local or /etc/boot.local like Redhat uses rc.local for startup scripts.
 
Old 01-02-2008, 10:29 AM   #10
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
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.
 
  


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
How do I set the ip address for eth0, eth1 and the default gateway? abefroman SUSE / openSUSE 5 05-19-2005 04:15 AM
Universal default gateway address resolution otisthegbs Linux - Networking 2 07-09-2004 02:28 AM
making a default gateway permanent csu19032 Linux - Networking 1 07-01-2004 02:28 PM
Obtaining a default gateway IP address from a Win2K workstation Linh Programming 1 02-20-2004 02:55 AM
How do I get iptables to redirect my default gateway address? Paul Woodhouse Linux - Networking 3 11-11-2003 08:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 01:40 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