How can I define my Gateway

on an Opensuse 11 I have config my /etc/sysconfig/network/ifcfg-eth0 :


BOOTPROTO='none'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR='192.168.51.30'
MTU=''
NAME='name of my card'
NETMASK='255.255.255.0'
NETWORK='192.168.51.0'
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
GATEWAY='192.168.51.2'

if I run a route command I get no default route, only 192.168.51.0, link-local, and loopback.

How can I define a default route Gateway permanently.

I try
route add default gw 192.168.51.2

but when I reboot I got no route default again

thx :slight_smile:

The default gateway does not belong to an interface but is global. It is set in /etc/sysconfig/network/routes. The format is:

default *gatewayaddr* - -

Or set it with YaST … Routing

Enestaf wrote:

>
> on an Opensuse 11 I have config my /etc/sysconfig/network/ifcfg-eth0 :
>
>
> Code:
> --------------------
>
> BOOTPROTO=‘none’
> BROADCAST=’’
> ETHTOOL_OPTIONS=’’
> IPADDR=‘192.168.51.30’
> MTU=’’
> NAME=‘name of my card’
> NETMASK=‘255.255.255.0’
> NETWORK=‘192.168.51.0’
> REMOTE_IPADDR=’’
> STARTMODE=‘auto’
> USERCONTROL=‘no’
> GATEWAY=‘192.168.51.2’
>
> --------------------
>
>
> if I run a route command I get no default route, only 192.168.51.0,
> link-local, and loopback.
>
> How can I define a default route Gateway permanently.
>
> I try
> route add default gw 192.168.51.2
>
> but when I reboot I got no route default again
>
> thx :slight_smile:
>
>

The man page for routes is very useful, type

man 5 routes

in a console to read it.

To solve your problem, edit/create the file ‘/etc/sysconfig/network/routes’

add this line: (using information from your post)

default 192.168.51.2

Either reboot {shudder} or ‘rcnetwork restart’ to have this change
implemented.

Take Care,

Loni


L R Nix
lornix@lornix.com

I don’t have a ‘/etc/sysconfig/network/routes’ file

there is all files and folders in /etc/sysconfig/network :

config
dhcp
id-down.d
if-up.d
ifcfg-eth0
ifcfg-lo
ifcfg.template
ifroute-lo
providers
scripts

Do I have to create routes files? what do I put inside?

Thx for your answers

Why not use YaST to configure your networking, then you can see what format it generates in the files?

ken yap wrote:

>
> Why not use YaST to configure your networking, then you can see what
> format it generates in the files?
>
>

Ken is right, YaST would be a better tool to configure your network, it
handles all the little ‘bits’ that can be misremembered.

In any case, yes, you create the file, and put the single line:

default 192.168.51.2

within it. first word ‘default’, a space, and then the IP address of your
gateway.

Take Care,

Loni

L R Nix
lornix@lornix.com

resolve thanck you,

yast created the routes files