Results 1 to 7 of 7

Thread: How can I define my Gateway

  1. #1
    Enestaf NNTP User

    Default How can I define my Gateway

    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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How can I define my Gateway

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

    Code:
    default gatewayaddr - -
    Or set it with YaST ... Routing

  3. #3
    Join Date
    Jun 2008
    Location
    Oklahoma, US
    Posts
    822

    Default Re: How can I define my Gateway

    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
    >
    >


    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

  4. #4
    Enestaf NNTP User

    Default Re: How can I define my Gateway

    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

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How can I define my Gateway

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

  6. #6
    Join Date
    Jun 2008
    Location
    Oklahoma, US
    Posts
    822

    Default Re: How can I define my Gateway

    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

  7. #7
    Enestaf NNTP User

    Default Re: How can I define my Gateway (resolve)

    resolve thanck you,

    yast created the routes files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •