How do I permanently delete a route?

OS: Almalinux 8, latest
Problem: Routes get added after reboot

ip route show gives this:


default via 41.48.48.25 dev ens18
41.48.48.0/24 dev ens18 proto kernel scope link src 41.48.48.26
41.48.48.27 dev ens18 scope link src 41.48.48.27
169.254.0.0/16 dev ens18 scope link metric 1002

This route: 41.48.48.0/24 dev ens18 proto kernel scope link src 41.48.48.26, causes other devices in the 41.48.48.0/24 to be unreachable.
Once I delete this route, then its fine.

But this route gets recreated after every reboot. How do I permanently delete a route?

What kind of installation and network environment do you have?

The default config is by NetworkManager.service and would fetch connection details from DHCP server.
There would not be “zeroconf subnet” (169.254.0.0/16).
The default gives only link-local route and default route. For example:

default via 10.30.20.6 dev ens3 proto dhcp src 10.30.20.7 metric 100 
10.30.20.0/28 dev ens3 proto kernel scope link src 10.30.20.7 metric 100

I know the “old” way of configuring static routes and that would be in /etc/sysconfig/network-scripts/route-ens18

I want to add that it seems your host has two ip addresses (maybe from the same subnet)

suggest that the ip 41.48.48.26 is that of the host but the next route

suggest that the ip 41.48.48.27 ist (also) one ip of the host.
Of course it is possible that there are multiple ip addresses configured but without knowing what the objective looks like makes it harder.

without the 41.48.48.0/24 route all network traffic for the local network (assuming that 41.48.48.0/24 is the local network) would have to go through the gateway I think and that could prove a bottleneck.

I also see that no specific ip address is configured as source to the default route.

One can get static routes from DHCP or add them in local config.
For NetworkManager (NM), via nmcli, the option is ipv4.routes.
With installation of package NetworkManager-dispatcher-routing-rules NM does use
the “/etc/sysconfig/network-scripts/{rule,route}-NAME” files.

However, issue here is not in adding more routes, but why some routes are added
and what would be the truly correct network configuration.

Up to RHEL 7 there was no “src” shown on default route. The (primary) address assigned to the outgoing interface is probably used.
(Up to RHEL 6 the 169.254.0.0/16 was added by default by initscripts.)

What kind of installation and network environment do you have?
I’m running WHM/Cpanel. I have two IPs configured on this machine. Attached diagram.
The “zeroconf subnet” (169.254.0.0/16) was added by the system

Capture

$ ipcalc -n -b 10.0.0.25/29
BROADCAST=10.0.0.31
NETWORK=10.0.0.24

With prefix 29 (which was nowhere in your routes) network address is *.24
The first usable address, *.25, is on the router.
You use two addresses, *.26 and *.27, and there are three more in the subnet: *.28, *.29, and *.30.

I don’t know WHM/Cpanel. Never seen one. On CentOS forum a mantra is that since *panel “solutions” tend to replace system components and procedures, systems that have them have to be managed by whatever method the *panel requires.

Only WHM/Cpanel know/document how they do configure network.

Your machine does have a second issue: two addresses on same subnet. That is trouble. It is possible to set that up, with policy routing, etc, but it is far from trivial and has limitations.
Well, perhaps Cpanel has a tool for that?

One can verify basics by reseting network config and keeping only one address (*.26). If network works with that, then switch to the other address (*.27). If that works too, then we have shown that neither address alone is a problem, but having both is.

So it seems that the wrong netmask was configured (/24 instead of /29)

I think this is the issue. How can I go about correcting it, or how do I reset the network config?

I know the “old” way of configuring static routes and that would be in /etc/sysconfig/network-scripts/route-ens18

I tried this, it did not work.
It is correct that I have two IP addresses configured.

I also see that no specific ip address is configured as source to the default route.

Is this a requirement?

Thanks I think this is exactly what I need to do, I just need a guide on how to do it.