(Solved) Routing Table Persistence (Lack Of)


surfshack66

Recommended Posts

Let me preface this by saying i know exactly 0 about routing tables in linux and how they are modified.

 

Since the unRAID OS runs in ram and is unpacked fresh from the USB drive on boot, changes that you make to the underlying linux system at runtime do not persist. The only things that do persist across reboot are those things that the unraid GUI / Config files allow you to tweak. With that said I dont know one way or the other whether unRAID has a configuration option for static routes, but if you have looked and not found it then possibly not. In that case your only choice is to re-make the changes on every boot. I would suggest writing a script that makes the changes and then run it on startup using the CA User Scripts plugin.

Link to comment

You can definitely do this,

Any commands you want to run after a reboot can be put in /boot/config/go

The server will run the go script at startup. There's obviously another few ways to achieve - like the CA User Scripts idea above.

You can modify the routing table directly via commands such as:

ip route add 192.168.0.0/16 via 192.168.1.111

I'm not at my machine right now but I believe you can also use files with the name route-eth# to define routes for an interface - should be placed at /etc/sysconfig/network-scripts/

So you could make a file called route-eth0 - put your desired routes in it - save to /boot/config/route-eth0 and in your go file just copy the file into place. However, you'd need to check if this worked after a reboot because the network might need cycling afterwards. The commands route or ip r might help too.

 

 

Link to comment
8 hours ago, primeval_god said:

The only things that do persist across reboot are those things that the unraid GUI / Config files allow you to tweak. 

Maybe this is a bug then? The changes are made on the Network Settings page of the GUI. It's nice being able to add them there, the only issue is they don't persist.

 

Perhaps someone from unraid can confirm if this is a bug or could be a feature request...

 

EDIT: Also thanks to everyone for the help so far

Edited by surfshack66
Link to comment
14 hours ago, surfshack66 said:

I add the custom routes in the network settings page. They do not persist after rebooting. Is that normal?

Yes, this is normal

When adding custom routes they are only stored in RAM. Rebooting the system clears these custom routes.

To make them persistent the equivalent 'ip' commands need to be executed upon a reboot. One way to do this is using the custom scripts plugin.

  • Thanks 1
Link to comment
  • surfshack66 changed the title to Routing Table Persistence (Lack Of)
On 9/25/2018 at 5:40 PM, Delarius said:

You can definitely do this,

Any commands you want to run after a reboot can be put in /boot/config/go

The server will run the go script at startup. There's obviously another few ways to achieve - like the CA User Scripts idea above.

You can modify the routing table directly via commands such as:


ip route add 192.168.0.0/16 via 192.168.1.111

I'm not at my machine right now but I believe you can also use files with the name route-eth# to define routes for an interface - should be placed at /etc/sysconfig/network-scripts/

So you could make a file called route-eth0 - put your desired routes in it - save to /boot/config/route-eth0 and in your go file just copy the file into place. However, you'd need to check if this worked after a reboot because the network might need cycling afterwards. The commands route or ip r might help too.

 

 

The command doesn't seem to work properly.

I receive the following message:

 

Error: Nexthop has invalid gateway.

Link to comment
18 minutes ago, bonienl said:

What is the output of


ip route show

 

Linux 4.18.14-unRAID.
Last login: Sun Oct 14 14:10:34 -0400 2018 on /dev/pts/2.
root@Tower:~# ip route show
default via 192.168.1.1 dev br0 proto dhcp src 192.168.1.2 metric 218
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.1.0/24 dev br0 proto dhcp scope link src 192.168.1.2 metric 218
192.168.20.0/24 dev br0.20 scope link metric 1
192.168.70.0/24 dev br0.70 scope link metric 1
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1

I had to manually add 192.168.20.0 and 192.168.70.0 via the Network Settings page.

Link to comment
  • surfshack66 changed the title to (Solved) Routing Table Persistence (Lack Of)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.