Issue setting default gateway

I have configured a ethernet interface (DHCP), a VLAN interface and a bridge.

Whenever I reboot truenas, network/internet access is not possible. Neither to truenas itself, nor to the apps.

I think it’s a truenas issue beacuse here is how to consistently fix the issue after a reboot:

  1. edit settings (network > global configuration), change the ipv4 default gateway to something random .
  2. click save
  3. get error: pyroute2.netlink.exceptions.NetlinkError: (22, ‘Invalid argument’)
  4. change the default gateway back to the correct one (in my case 192.168.10.1)
  5. click save again
  6. same error as 3.
  7. close the dialog, then reopen it again. click save, now it works without the error

Now everything works perfectly fine.
Since this issue persists over multiple Truenas upgrades, I decided to open this topic. I’m running 24.10.2.2 (I briefly updated to 25.04 and the same issue is there also)

Following points are bothering:

  • The “invalid argument” error message is not helpful and doesn’t guide me to the actual issue.
  • The workaround is strange, but the fact that it works shows that it’s a truenas issue and not my network configuration.

What could be next steps to fix this issue?

Is that an excerpt or the full error text? If the former can you please post the full error?

If you can recreate this at will, a bug report is probably a great idea. You can report a bug using the button at the top of the TrueNAS UI.

Provide output of ip a please.

Btw, truenas would be accessible even with the “wrong” gateway.

Sure, attached ip a s and ip r s output, both directly after restarting (where it’s not working) and after I apply the fix mentioned in the previous post (files with -fixed suffix).

ipas.txt (15.8 KB)
ipas-fixed.txt (15.9 KB)
iprs.txt (2.6 KB)
iprs-fixed.txt (2.7 KB)

That’s the full error message from step 3. and 6.:

 Error: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 211, in call_method
    result = await self.middleware.call_with_audit(message['method'], serviceobj, methodobj, params, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1529, in call_with_audit
    result = await self._call(method, serviceobj, methodobj, params, app=app,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1460, in _call
    return await methodobj(*prepared_call.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/service/config_service.py", line 83, in update
    rv = await self.middleware._call(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1460, in _call
    return await methodobj(*prepared_call.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 49, in nf
    res = await f(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/schema/processor.py", line 179, in nf
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/plugins/network_/global_config.py", line 346, in do_update
    await self.middleware.call('route.sync')
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1629, in call
    return await self._call(
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1460, in _call
    return await methodobj(*prepared_call.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/plugins/network_/route.py", line 130, in sync
    routing_table.add(ipv6_gateway)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/interface/netif_linux/routing.py", line 203, in add
    self._op("add", route)
  File "/usr/lib/python3/dist-packages/middlewared/plugins/interface/netif_linux/routing.py", line 246, in _op
    ip.route(op, **kwargs)
  File "/usr/lib/python3/dist-packages/pyroute2/iproute/linux.py", line 2310, in route
    ret = self.nlm_request(
          ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 870, in nlm_request
    return tuple(self._genlm_request(*argv, **kwarg))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 1214, in nlm_request
    for msg in self.get(
               ^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 873, in get
    return tuple(self._genlm_get(*argv, **kwarg))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 550, in get
    raise msg['header']['error']
pyroute2.netlink.exceptions.NetlinkError: (22, 'Invalid argument')

Try to remove ip from enp1s0. You already specified it (well, another ip in the same subnet) in br0. And the enp1s0 is the part of br0.

1 Like

Heh, I just learned about bridges 5 minutes ago, and dude said, make sure to delete the IP from the ethernet adapter before you do your final save. You can’t have a bridge and an interface with the same address. Once you bind your interface to the bridge, the bridge gets the IP. Way I understood it at least.