This is something I should have learned a long time ago. I figure it's time to clear up my understanding. I have always avoided overlapping routes to be safe, but it'd save time and reduce config lines if it's okay to overlap:
I need to reach all 192.168.x.0 networks via one gateway, except for 192.168.10.0/24 which is reached via a different gateway. Is the following configuration acceptable (notice the overlap)?
ip route 0.0.0.0 0.0.0.0 192.168.0.1
ip route 192.168.0.0 255.255.0.0 192.168.0.2
ip route 192.168.10.0 255.255.255.0 192.168.0.3
Or must I do this (no overlap)?
ip route 0.0.0.0 0.0.0.0 192.168.0.1
ip route 192.168.0.0 255.255.248.0 192.168.0.2
ip route 192.168.8.0 255.255.254.0 192.168.0.2
ip route 192.168.10.0 255.255.255.0 192.168.0.3
ip route 192.168.11.0 255.255.255.0 192.168.0.2
ip route 192.168.12.0 255.255.252.0 192.168.0.2
ip route 192.168.16.0 255.255.240.0 192.168.0.2
ip route 192.168.32.0 255.255.224.0 192.168.0.2
ip route 192.168.64.0 255.255.192.0 192.168.0.2
ip route 192.168.128.0 255.255.128.0 192.168.0.2
Thanks!
Chris Jones
Thank you for asking this question in the support community. There is absolutely no problem with "overlapping" routes. Generally speaking (in the case of static routes), routing logic declares that more specific routes have higher priority in the routing table than less specific routes. In the example you provided, there are actually, three "overlapping" routes: 192.168.10.0/24 > 192.168.0.0/16 > 0.0.0.0/0.
I hope that makes sense, but please do not hesitate to reply with any additional questions or information. I will be happy to help in any way I can.
Levi
That's great news. Thanks, Levi!
Thank you for asking this question in the support community. There is absolutely no problem with "overlapping" routes. Generally speaking (in the case of static routes), routing logic declares that more specific routes have higher priority in the routing table than less specific routes. In the example you provided, there are actually, three "overlapping" routes: 192.168.10.0/24 > 192.168.0.0/16 > 0.0.0.0/0.
I hope that makes sense, but please do not hesitate to reply with any additional questions or information. I will be happy to help in any way I can.
Levi
That's great news. Thanks, Levi!