ip route add - RTNETLINK answers: File exists

It works fine and I don’t understand why it’s not working for the /23

Because it's already there - this is what RTNETLINK answers: File exists is telling you.

your netstat -rt output contains this route:

172.21.136.0    0.0.0.0         255.255.254.0   U         0 0          0 eth4

which is conflicting with ip route add 172.21.136.0/23 via 172.21.137.251 dev eth4.


The /23 is already in your table...

netstat -nr

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.21.137.0    172.21.137.251  255.255.255.0   UG        0 0          0 eth4
172.21.136.0    172.21.137.251  255.255.255.0   UG        0 0          0 eth4
170.242.57.0    0.0.0.0         255.255.255.0   U         0 0          0 bond0
172.21.136.0    0.0.0.0         255.255.254.0   U         0 0          0 eth4 <----------
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth4
0.0.0.0         170.242.57.251  0.0.0.0         UG        0 0          0 bond0

Also keep in mind that ip route add 172.21.136.0/23 via 172.21.137.251 dev eth4 is a bit non-sensical since 172.21.137.251 is in 172.21.136.0/23