1

Currently I am using Alma-Linux, where I need to create 2 default gateways for the same NIC. Main intent of 2 default gateway configuration is.. when any one of the gateways is down then other one will work so that there will be no communication lost to remote host which is in different subnet altogether.

enter image description here

Gateway Configuration Below IPs are used for routing

  1. 11.12.13.1 ( As a default gateway)
  2. 11.12.13.2 (static route Next hop)

Both IPs are ping-able.

For testing fail over scenario, I disabled the NIC with IP 11.12.13.1 and performed the traceroute command on a random remote host which is in different subnet.

command : traceroute 17.18.19.2

but traceroute result is destination unreachable.

In this scenario, I assume packets will go through static route 11.12.13.2 ip as a fall back option. since configured gateway is down. It is not working as I expected.

Note: When I add exact IP 17.18.19.2 as destination/prefix address instead of Default(0.0.0.0) then Static route is working fine in this case.

Need some pointers to get this scenario work. Please correct me, incase my understanding is not correct.

enter image description here

  • What is the result of `netstat -rn`? – Romeo Ninov Aug 12 '23 at 11:29
  • @RomeoNinov: Added route table for your reference. If I replace 0.0.0.0 with actual destination address 17.18.19.2 in the static route rules then "Destination Unreachable" message is going off. – cpp_learner Aug 12 '23 at 12:11
  • 1
    Add text, no images. And show us the device via which is the second route. Is it the same as default or not. – Romeo Ninov Aug 12 '23 at 13:37
  • 0.0.0.0 via 11.12.13.2 is my second route. First route is "default via 11.12.13.1" – cpp_learner Aug 13 '23 at 02:49
  • On which interface? I suppose you have two of them because otherwise the way you test it is meaningless. – Romeo Ninov Aug 13 '23 at 05:38
  • I have ONLY one NIC interface (say 'eth0'). Trying to create 2 default routes(via default gateway and default static route) for SAME interface (eth0). Is this an invalid configuration? Same interface cannot support multiple default routes? I am new to networking stuff. Need your guidance to understand and test the 2nd gateway in case of first gateway failure occurs – cpp_learner Aug 13 '23 at 06:48
  • The simplest test of fail-over is to down the gateway (interface with IP 11.12.13.1) and then check. If you down the interface on machine you want to implement the solution you loose entire network connectivity. – Romeo Ninov Aug 13 '23 at 07:08
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/147864/discussion-between-cpp-learner-and-romeo-ninov). – cpp_learner Aug 13 '23 at 07:48
  • Note: 0.0.0.0/32 is a never matching *route* but not a default route (which would be 0.0.0.0/0 not /32) . OP's new question asking the same ( https://serverfault.com/questions/1141794/alma-linux-gateway-fall-back-is-not-working-when-gateway-ip-with-lower-metric ) doesn't show any command's output so this won't be detectable by reading it. – A.B Aug 19 '23 at 19:39

1 Answers1

0

With @A.B suggestion I was able to solve the issue by using proper destination IP. 0.0.0.0/0 semantics is equal to default but I used wrong subnet mask value. Thanks @A.B