suse12: how to set default route via config file

6,457

Create or edit /etc/sysconfig/network/routes and add a line like :

default 192.168.1.1 - -

(where, in case it would not be obvious, 192.168.1.1 is your gateway)

[src: courseware for Suse course 3124 "SUSE Linux Server 12 Administration"]

Share:
6,457

Related videos on Youtube

John Westlund
Author by

John Westlund

Updated on September 18, 2022

Comments

  • John Westlund
    John Westlund over 1 year

    I've got some systems that are provisioning SLES12sp1 statelessly - the systems come up with their provisioning interface configured, but no default route.

    On RedHat I'd set the GATEWAYDEV in /etc/sysconfig/network -- but I can't find an equivalent for openSUSE/SLES.

    There is no NetworkManager or ifcfg files:

    # ls /etc/sysconfig/network/
    config  dhcp  if-down.d  if-up.d  ifcfg-lo  ifcfg.template  network  providers  scripts
    

    Some additional context:

    # ifconfig eth2
    eth2      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
              inet addr:192.168.1.29  Bcast:192.168.1.255  Mask:255.255.255.0
              inet6 addr: fe80::21e:67ff:fecb:f26f/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:213248 errors:0 dropped:0 overruns:0 frame:0
              TX packets:35744 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:295970393 (282.2 Mb)  TX bytes:4018621 (3.8 Mb)
              Memory:92020000-9203ffff 
    
    # route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0      0.0.0.0         255.255.255.0     U     0      0        0 eth2
    
  • John Westlund
    John Westlund over 7 years
    @heritu -- no luck. Tried default <ip> - -, default <ip> - eth2, default - - eth2. Maybe because PXE is bringing up the interface?
  • John Westlund
    John Westlund over 7 years
    I think your answer is correct -- but won't work in my case because of how the provisioning is happening.