interface.save_default_route

This method exists _solely_ to provide a “warning” and therefore a path for remediation for when an end-user modifies an interface and we rip the default gateway out from underneath them without any type of warning.

NOTE: This makes 2 assumptions 1. interface.create/update/delete must have been called before calling this method 2. this method must be called before interface.sync is called

This method exists for the predominant scenario for new users… 1. fresh install SCALE 2. all interfaces start DHCPv4 (v6 is ignored for now) 3. 1 of the interfaces receives an IP address 4. along with the IP, the kernel receives a default route (by design, of course) 5. user goes to configure this interface as having a static IP address 6. as we go through and “sync” the changes, we remove the default route because it exists in the kernel FIB but doesn’t exist in the database. 7. IF the user is connecting via layer3, then they will lose all access to the TrueNAS and never be able to finalize the changes to the network because we ripped out the default route which is how they were communicating to begin with.

In the above scenario, we’re going to try and prevent this by doing the following: 1. fresh install SCALE 2. all interfaces start DHCPv4 3. default route is received 4. user configures an interface 5. When user pushes “Test Changes” (interface.sync), webUI will call network.configuration.default_route_will_be_removed BEFORE interface.sync 6. if network.configuration.default_route_will_be_removed returns True, then webUI will open a new modal dialog that gives the end-user ample warning/verbiage describing the situation. Furthermore, the modal will allow the user to input a default gateway 7. if user gives gateway, webUI will call this method providing the info and we’ll validate accordingly 8. OR if user doesn’t give gateway, they will need to “confirm” this is desired 9. the default gateway provided to us (if given by end-user) will be stored in the same in-memory cache that we use for storing the interface changes and will be rolledback accordingly in this plugin just like everything else

There are a few other scenarios where this is beneficial, but the one listed above is seen most often by end-users/support team.

Type: object

Type: array
No Additional Items

Tuple Validation

Parameter 1: gateway

gateway

Type: string

Result

Type: null


Required roles: NETWORK_INTERFACE_WRITE