Jump to content

Persistent static routes


Recommended Posts

How can I make a static route persist in Unraid? I have been using "ip route add" in my /boot/config/go, however, it merely runs the command after a reboot. A truly persistent route is more than that. For example, if you unplug the network cable and plug it back in or reboot the router/switch Unraid server is plugged into, the custom routes will be gone. There are other scenarios when this can happen. There should be a way to add the static route to the network subsystem, so that it's re-added during any network events.

 

I've looked into dhcpcd hooks, there is /usr/share/dhcpcd/hooks/ directory. But it didn't work. Looks like it's a stripped down or modified version of dhcpcd. I'm well versed in Linux but not in Slackware particularly. Just by poking around, I see /etc/rc.d/rc.inet1 and rc.inet2 seem to be the scripts handling the networking. I played with those too; they don't re-run in a scenario with unplugged cable as an example.

 

I couldn't find any useful information about how Unraid internals work in regards to networking.

Link to comment

I wish it were that simple... The UI configuration doesn't save routes anywhere, it's just in-memory. It won't survive a reboot or other scenarios I described.

 

After posting this, I looked at the issue from a different angle. I used DHCP option 121 on my MikroTik router to supply the static route to Unraid via DHCP. Worked flawlessly. I actually like this approach better since the routing stuff belongs to, well, a router.

 

Still, there must be a way to do this in Unraid. Not everyone has an advanced router. It's not only about static routes either, I can see a need to run a custom script on Unraid server whenever the network connection goes down or up.

Link to comment
6 hours ago, andenker said:

After posting this, I looked at the issue from a different angle. I used DHCP option 121 on my MikroTik router to supply the static route to Unraid via DHCP. Worked flawlessly. I actually like this approach better since the routing stuff belongs to, well, a router.

 

I like this solution a lot - I too have a MikroTik router, I think I will need to have a play around with this!

Link to comment

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.

×
×
  • Create New...