Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: static route disappers after network restart

  1. #1

    Default static route disappers after network restart

    After searching a lot, finding no working solution, I hope I can get help here.

    Static route set up in yast/network configuration will not give access to the connected network.
    Although the entries for the static route can be seen after restart yast/network configuration.
    Using "ip route add DESTINATION/24 via GATEWAY dev DEVICE" establishes the connection
    and I am able to work on the connected machine.
    After network restart, independent of restarting the host machine or using "systemctl restart network.service", the static route disappears.

    Thanks in advance for your help!

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    3,376

    Default Re: static route disappers after network restart

    1. Are you using the "Network Manager" or "wicked" to start the network configuration at boot time?
    2. There are some things to be aware of when configuring static routing.

    The basic reference is in the openSUSE documentation: "Reference Guide": <https://doc.opensuse.org/>
    <https://doc.opensuse.org/documentati...nce/index.html>
    Part II -- System -- Chapter 13 "Basic Networking" -- section 13.6 "Configuring a Network Connection Manually".

    Assuming that, you're using "wicked", the routing needs to be setup in the '/etc/sysconfig/network/routes' and '/etc/sysconfig/network/ifroute-*' files. See section 13.6.2.7.

    Assuming that, you're using "wicked", if you find that YaST is not setting up the static routes properly -- you can only setup the static routes by manually editing the files mentioned above -- please submit an openSUSE Bug Report -- login is the same as the one you use to access this forum: <https://bugzilla.opensuse.org/>.

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,771
    Blog Entries
    2

    Default Re: static route disappers after network restart

    I suspect you're not configuring correctly.

    When using YaST,
    You do not set up an ordinary static route for your Default Gateway.
    Instead, the top 2 lines configure your Default Gateways, and you use the dropdowns to configure your DG IP address and device (actually the interface, not the device). Once set, they should be persistent across reboots (I've done this so know this should be the expected behavior).

    I haven't configured a route down below but it's likely that you'd need to specify a flag in the "Options" to make the route persistent.

    Which leads to the next concept...

    By default and particularly in the command you used to set your Default Gateway, manually added routes are only effective during your current session (as you've discovered).
    In the "old days" you had to add a flag to the "addroute" command to make the setting persistent across reboots.
    Looks like nowadays the "ip add route" command has a "save" option which likely does the same.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  4. #4

    Default Re: static route disappers after network restart

    Quote Originally Posted by dcurtisfra View Post
    1. Are you using the "Network Manager" or "wicked" to start the network configuration at boot time?
    2. There are some things to be aware of when configuring static routing.

    The basic reference is in the openSUSE documentation: "Reference Guide": <https://doc.opensuse.org/>
    <https://doc.opensuse.org/documentati...nce/index.html>
    Part II -- System -- Chapter 13 "Basic Networking" -- section 13.6 "Configuring a Network Connection Manually".

    Assuming that, you're using "wicked", the routing needs to be setup in the '/etc/sysconfig/network/routes' and '/etc/sysconfig/network/ifroute-*' files. See section 13.6.2.7.

    Assuming that, you're using "wicked", if you find that YaST is not setting up the static routes properly -- you can only setup the static routes by manually editing the files mentioned above -- please submit an openSUSE Bug Report -- login is the same as the one you use to access this forum: <https://bugzilla.opensuse.org/>.
    Hello dcurtisfra

    I'm using wicked, otherwise you can not configure a routing table entry in yast, as I know.
    After closing YaST-network configuration the static route was not established. Looking again into YaST, the entries for the route were there.
    Then I modified the files you have mentioned by hand according to the syntax in section 13.6 and restarted the network with "systemctl restart network.service". But with no luck.

    So also the manual set up doesn´t work, although the "ip route add ..." command works to establish the connection temporarily.

  5. #5

    Default Re: static route disappers after network restart

    Quote Originally Posted by tsu2 View Post
    I suspect you're not configuring correctly.

    When using YaST,
    You do not set up an ordinary static route for your Default Gateway.
    Instead, the top 2 lines configure your Default Gateways, and you use the dropdowns to configure your DG IP address and device (actually the interface, not the device). Once set, they should be persistent across reboots (I've done this so know this should be the expected behavior).

    I haven't configured a route down below but it's likely that you'd need to specify a flag in the "Options" to make the route persistent.

    Which leads to the next concept...

    By default and particularly in the command you used to set your Default Gateway, manually added routes are only effective during your current session (as you've discovered).
    In the "old days" you had to add a flag to the "addroute" command to make the setting persistent across reboots.
    Looks like nowadays the "ip add route" command has a "save" option which likely does the same.

    TSU
    Hello TSU

    I do not want to configure a Default Gateway but an additional static route to a sum of other machines. On a computer with OpenSuSE Leap 42.1 I have configured this static route using YaST exactly the same way and it works.
    I will try your tip with the "save" option for the "ip route add ..." command.

  6. #6

    Default Re: static route disappers after network restart

    Hello TSU

    I didn't find an option like "save" in manpages of ip. Any other idea?

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    27,162

    Default Re: static route disappers after network restart

    It would be nice if yiu gave people something to chew on. Thus show commands like
    Code:
    ip route
    and their output and not only tell stories about what you think you see.

    BTW when you do an
    Code:
    ip route add ....
    that is indeed only added to the routing table in the kernel. And that will be deleted when you stop the network (mostly at shutdown).

    When you want a route added at network startup (mostly at boot) using wicked, it should be in /etc/sysconfig/network/routes. The easiest and least error prone way to put it there is IMHO by using YaST > Network Devices > Network Settings and then the tab Routing.

    After all one of the more important reasons for choosing openSUSE is its nice system management tool YaST. Thus when running openSUSE, why not use it?
    Last edited by hcvv; 11-Aug-2017 at 12:18.
    Henk van Velden

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,771
    Blog Entries
    2

    Default Re: static route disappers after network restart

    First,
    It seems that what I stated earlier about enabling persistence in the "route add" command is what you would do on a Solaris or Windows machine, not Linux. In Linux, the routing table isn't edited directly. For persistence, your routing rule is re-loaded and added to the routing table on each boot using sysconfig.


    Did some testing.
    I verified the problem you are experiencing. I tested rules which defined remote networks as follows...

    I used both the YaST tool and edited the files directly with same results...
    - Using the YaST module, if you leave the Device set to the dash (which means not defined), then the route is written to
    Code:
    /etc/sysconfig/network/routes
    - Using the YaST moule, if you specify a Device(eg eth0) then the route is written to
    Code:
    /etc/sysconfig/network/ifroutes-devicename 
    Although I don't think should be necessary, for good measure I restarted the network service.

    For both of the above, I created rules by both using YaST and then creating rules by editing the files directly, then ran the typical "display routing table command" as follows, but in both cases the static routes were not listed
    Code:
    route -n
    ip route show
    Then, to further test the routes, I executed traceroutes to Host addresses in the remote networks.
    Code:
    traceroute ip_address
    Looks to me that static routes is broken completely.
    Do you want to create the bug at https://bugzilla.opensuse.org ?

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  9. #9
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    22,101
    Blog Entries
    1

    Default Re: static route disappers after network restart

    Quote Originally Posted by tsu2 View Post
    Looks to me that static routes is broken completely.
    Do you want to create the bug at https://bugzilla.opensuse.org ?

    TSU
    Looks to me that it is the documentation that is lacking actually. Based on the comments in this bug report every route which contains a gateway also needs a direct route (without gateway specified) first or it will be rejected by the kernel. For example, suppose I have eth1 assigned as 192.168.100.100/24. If I want to add the following routes
    Code:
    192.168.6.21 via 192.168.100.1 dev eth1
    172.18.156.60 via 192.168.100.5 dev eth1
    then in ifroute-eth1 I need to add the following

    Code:
    192.168.100.0/24 - - eth1
    192.168.6.21 192.168.100.1 - eth1
    172.18.156.60 192.168.100.5 - eth1
    and so on...

    Once done restart wicked...
    Code:
    systemctl restart wicked
    My routing table now looks like...

    Code:
    dean@linux-54cw:~> ip route
    default via 192.168.1.1 dev wlan0  proto dhcp 
    172.18.156.60 via 192.168.100.5 dev eth1 
    192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.8 
    192.168.6.21 via 192.168.100.1 dev eth1 
    192.168.100.0/24 dev eth1  proto kernel  scope link  src 192.168.100.100
    Last edited by deano_ferrari; 12-Aug-2017 at 22:12.

  10. #10
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    12,771
    Blog Entries
    2

    Default Re: static route disappers after network restart

    Hmmm...

    I'll take a look at this more closely and set up a test network to verify....

    But,
    My initial impression is that for the typical scenario,
    The system starts off with a routing table that is created automatically based on an existing NIC and its networking configuration including a DG.

    That means that unless you assign an entirely new IP address in a different network range which is entirely unnecessary, defining a special route to the gateway address for a new static route should be entirely unnecessary because the new gateway would already be easily found within the supported address range in the existing routing table.

    For now,
    I did a quick search for relevant documentation in other distros and OS, and in no other case is there ever a requirement to define a route to the new static route gateway.
    In all cases, all that is required is the <single> new static route rule, that's all.

    So, IMO this is not a documentation problem, it's a real bug (based on your bugzilla reference).

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Page 1 of 2 12 LastLast

Posting Permissions

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