problems with ip route add default

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have two iproute add default but with different metric , when I ingress sh iproute in console display me the route with lower metric without # , sombody why this??
Photo of chrisfipe f

chrisfipe f

  • 70 Points

Posted 2 years ago

  • 0
  • 1
Photo of Im JeongJin

Im JeongJin, Employee

  • 90 Points 75 badge 2x thumb

Hi Chrisfipe..

I could see correct iproute info in my lab.

* BD1.53 # show iproute
Ori  Destination        Gateway         Mtr       Flags                 VLAN       Duration
#s   Default Route      192.168.55.1    10   UG---S-um--f     CRBT       0d:0h:0m:52s

but in case there is no port assigned on the vlan.. ( in my case CRBT ), "show ip route" output didn't show # mark.

 * BD1.63 # sh iproute
Ori  Destination        Gateway           Mtr  Flags        VLAN       Duration
 s   Default Route      192.168.55.1    10   -G---S-um--- CRBT       0d:0h:0m:2s


* BD1.64 # sh vlan "CRBT"
VLAN Interface with name CRBT created by user
 Admin State: Enabled  Tagging: 802.1Q Tag 10
 Virtual router: VR-Default
 Primary IP    : 192.168.55.2/24
 IPv6:   None
 STPD:   None
 Protocol:  Match all unfiltered protocols
 Loopback:  Disabled
 NetLogin:  Disabled
 QosProfile:  None configured
 Egress Rate Limit Designated Port: None configured
 Flood Rate Limit QosProfile:       None configured
 Ports:  0.    (Number of active ports=0)



(Edited)
Photo of Im JeongJin

Im JeongJin, Employee

  • 90 Points 75 badge 2x thumb

Here is the result, when switch has two different path for default route.

* BD1.79 # sh iproute
Ori  Destination         Gateway            Mtr  Flags                VLAN       Duration
 s   Default Route      192.168.55.1    10   -G---S-um---    CRBT       0d:0h:0m:3s
#s   Default Route      192.168.157.1   100  UG---S-um--f  U-CG       0d:0h:1m:17s

even 192.168.55.1 configured with lower metric, it has no port on that VLAN, so cannot used as best path for default route.

you can also check with the command "debug hal show ipv4fib" to see which path used for forwarding the traffic.

* BD1.80 # debug hal show ipv4Fib
                            HAL IPv4 FIB:
VrId Prefix/Mask        Gateway         Vlan    MAC               Port     Or Ref Ins Flags Bucket
===================================================================
   2 000.000.000.000/ 0 192.168.157.001 1000026 00:00:00:00:00:00 00000000  3   1   1 F---  9999


(Edited)
Photo of Prashanth KG

Prashanth KG, Employee

  • 5,300 Points 5k badge 2x thumb
Hi

When we have 2 default routes with different metrics, we will not be able to load share the traffic using both the routes. So, in this scenario one route would be active and the other route will be backup and will be used only when the primary route is not present/active.

# sign indicates if a particular route is in used for forwarding the traffic or not. So, it is expected not to see the sign for the backup route.

#s   Default Route      10.2.0.2        10   UG---S-um--f- pe2_syd1_to_pe1_syd2 0d:0h:0m:56s
 s   Default Route      10.2.0.22       30   UG---S-um---- pe2_syd1_to_pe1_syd1 0d:0h:0m:43s

Hope this helps!
Photo of Henrique

Henrique, Employee

  • 10,342 Points 10k badge 2x thumb
When you have a default route as well as any other static route, you should see the # when the GW vlan is UP (at least 1 port UP). If the vlan is down, then you won't see the #.

To confirm if the route is being used you can check the "f" flag that means "Provided to FIB".

Example 1:

Ori  Destination        Gateway         Mtr        Flags          VLAN       Duration 
  s   Default Route      10.10.0.181    1    -G---S-um----    Link1    0d:0h:1m:34s
#s   Default Route      10.10.0.189    2    UG---S-um--f-   Link2    0d:0h:1m:25s

Route with lower metric through vlan Link1 (metric 1) is down and the next best route will be used (with higher metric).

Example 2:

Ori  Destination        Gateway         Mtr  Flags               VLAN       Duration
#s   Default Route      10.10.0.181    1    UG---S-um--f-  Link1    0d:0h:12m:12s
#s   Default Route      10.10.0.189    1    UG---S-um----  Link2    0d:0h:0m:5s

Both routes are UP, but the route with lower metric is being used. Again, you can confirm that based on the "f" flag.