How to implement working netplan yaml as TrueNAS routes?

kfrank

Cadet
Joined
Mar 20, 2023
Messages
8
I was hoping someone could help me implement a current netplan yaml that I have working on a number of Ubuntu installations into working routes on my TrueNAS scale installation.

This is my current working netplan yaml in Ubuntu 22.04 LTS:

Code:
network:
  renderer: NetworkManager
  version: 2
  ethernets:
    eth0:
      match:
        macaddress: 00:xx:xx:xx:xx:xx
      mtu: 1500
      set-name: eth0
      dhcp4: false
      accept-ra: false
      addresses:
      - 172.17.255.30/24
      nameservers:
        search: [xxx.net,ssn.xxx.net]
        addresses: [172.17.255.10,172.17.255.169]
      routes:
        - to: default
          via: 172.17.255.254
        - to: 172.18.99.0/24
          scope: link
          metric: 100
        - to: 172.27.0.0/24
          scope: link
          metric: 100
        - to: 172.20.187.0/24
          scope: link
          metric: 100
        - to: 172.17.46.0/24
          via: 172.17.255.138
        - to: 172.17.48.0/24
          via: 172.17.255.138
        - to: 172.20.188.0/24
          via: 172.17.255.138


As you can see I have one interface that gets routed to various other subnets.
Many of the use the "to: IP, scope: link, metric: 100" format.
Is there any way to accomplish this in TrueNAS Scale?
Any help would be appreciated.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
TrueNAS is not going to read your YAML files. It is a dedicated appliance operating system. It is not a Ubuntu system and you need to make any changes through whatever method the GUI provides. For both CORE and SCALE, static routes may be added under Networking->Static Routes. This is the only supported way to accomplish this. When you do it through the GUI, your changes will be installed into the configuration database and this can be ported to other hosts, newer versions of the appliance, etc.
 

kfrank

Cadet
Joined
Mar 20, 2023
Messages
8
TrueNAS is not going to read your YAML files. It is a dedicated appliance operating system. It is not a Ubuntu system and you need to make any changes through whatever method the GUI provides. For both CORE and SCALE, static routes may be added under Networking->Static Routes. This is the only supported way to accomplish this. When you do it through the GUI, your changes will be installed into the configuration database and this can be ported to other hosts, newer versions of the appliance, etc.
@jgreco, thank you for your reply. I was not expecting TrueNAS to use the Yaml file I posted above.
The yaml file is just an example of of a working server I am running with the proper routes that I would like to implement on the on my TrueNAS server.
I may not have been clear enough in my question.
I was able to implement the static routes using the GUI that are in the form of:

Code:
- to: 172.17.46.0/24
  via: 172.17.255.138


however, I didn't see any way in the GUI to enter the routes with "scope: link" that I have in my netplan such as:

Code:
        - to: 172.18.99.0/24
          scope: link
          metric: 100
        - to: 172.27.0.0/24
          scope: link
          metric: 100
        - to: 172.20.187.0/24
          scope: link
          metric: 100


Thank you again for any assistance you may be able to offer.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
I don't do Linux networking, so perhaps you can explain what "scope: link" is doing.

I went so far as to look at the documentation at https://netplan.io/reference where it describes it as

scope (scalar)

The route scope, how wide-ranging it is to the network. Possible values are "global", "link", or "host".

Which is spectacularly unhelpful for a documentation site. In general, if you want to add routes for traffic to a nonlocal network and direct that to a gateway, the form you show as generated by the GUI should be sufficient. There are lots of other more exotic things that people try to build into modern IP stacks, but generally TrueNAS doesn't support more than classic IP configurations because once you start implementing things like multiple forwarding tables (FreeBSD), you get a whole bunch of new risky edge cases to worry about. I get the feeling that "scope: link" is some such sort of IP stack trickery. If so, you cannot get that behaviour via the networking GUI. You may be able to add startup tasks to add manual route(8) commands to implement the functionality, but this comes at a price: you may no longer get correct behaviour when reloading/restarting the network (such as after reconfiguring interfaces, etc).

As I previously said, I don't do Linux (or at least Linux-specific) networking, so I'm just trying to give you a path of some sort here. If you can explain what "scope: link" does, I will listen politely and contemplate it to see if anything further occurs to me. I am not aware of any Linux networking experts here in the forum, but perhaps the discussion will draw some out.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
scope:link is used for secondary subnets off the primary interface. For TrueNAS, OP will need to manually add interface IPs on those secondary subnets.

1681255910699.png
 
Top