Strange gateway address when using route-table and dispatcher script
Thomas Haller
thaller at redhat.com
Mon Sep 23 09:42:45 UTC 2024
On Mon, 2024-09-23 at 09:15 +0300, Alexander Rumyantsev wrote:
> When not using route-table I'm getting this values in dispatcher
> script:
>
> DHCP4_ROUTERS="10.1.1.254"
> IP4_ADDRESS_0="10.1.1.14/24 10.1.1.254"
> IP4_GATEWAY="10.1.1.254"
>
> But when i switch to separate table via route-table setting, I'm
> getting:
>
> DHCP4_ROUTERS="10.1.1.254"
> IP4_ADDRESS_0="10.1.1.14/24 0.0.0.0"
> IP4_GATEWAY="0.0.0.0"
>
> Is it a bug or feature?
> NetworkManager 1.42.4
>
> Best regards,
> Alexander
>
The gateway is the next hop of the best default route. A default route
has a destination with prefix length zero (0.0.0.0/0). For this
purpose, NetworkManager only considers the routes from the main table.
That's because it is not clear how "best default route" or gateway
makes sense here. With non-trivial routing setups like policy routing,
the selected route can depend on the source address.
Probably this is a bug and gateway could be defined in a way that is
useful here. But unclear how exactly.
Maybe in your case look at the variables from the DHCP lease, like
IP4_ROUTERS (DHCP option 3).
Thomas
More information about the Networkmanager
mailing list