cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3733
Views
5
Helpful
7
Replies

Longest Prefix match

vishalpatil86
Level 1
Level 1

hi,

 

i went through the following document -

 

http://www.cisco.com/c/en/us/support/docs/ip/enhanced-interior-gateway-routing-protocol-eigrp/8651-21.html#building

 

I just wanna know whether longest prefix match is considered first over AD and metric or it is considered separately while routing

 

Thanks,

Vish

2 Accepted Solutions

Accepted Solutions

Mark Malone
VIP Alumni
VIP Alumni

Hey that's the order it goes in below longest match always checked first

The Longest Match Rule

Administrative Distance

Metric

View solution in original post

Jon Marshall
Hall of Fame
Hall of Fame

Vish

Longest prefix is always considered before anything else.

Then if there are multiple routes from different routing protocols with the same prefix and subnet mask it comes down to AD.

Then if there are still multiple routes within the same routing protocol it comes down to metric.

If there are still multiple routes then it depends on the routing protocol ie. IGPs such as EIGRP/OSPF will install equal cost paths although how many depends on the protocol itself whereas BGP, for example, will by default only install one of the routes because it uses additional attributes to select a route.

Jon

View solution in original post

7 Replies 7

Mark Malone
VIP Alumni
VIP Alumni

Hey that's the order it goes in below longest match always checked first

The Longest Match Rule

Administrative Distance

Metric

Thanks Mark

Jon Marshall
Hall of Fame
Hall of Fame

Vish

Longest prefix is always considered before anything else.

Then if there are multiple routes from different routing protocols with the same prefix and subnet mask it comes down to AD.

Then if there are still multiple routes within the same routing protocol it comes down to metric.

If there are still multiple routes then it depends on the routing protocol ie. IGPs such as EIGRP/OSPF will install equal cost paths although how many depends on the protocol itself whereas BGP, for example, will by default only install one of the routes because it uses additional attributes to select a route.

Jon

Thanks Jon

No problem.

Just to clarify the link you posted to was about building the routing table which is what my answer was about.

Obviously there is also the routing of the packets and this will always use the longest match prefix but the others don't really come into it here ie. you wouldn't have the same prefix and subnet mask with two different ADs because the router would only place one of them in the IP routing table.

Jon

 

gotcha!!

chris noon
Level 1
Level 1

Yes longest prefix is always preferred and then attributes such as AD come into play.

 

If you have routes to the same destination (with same subnet mask) but the AD is different, the better AD route will be placed in the routing table.  You have routes to the same network, with different masks then both will be installed in the routing table, e.g.:

 

router# show ip route
     ....
     D   192.168.32.0/26 [90/25789217] via 10.1.1.1
     R   192.168.32.0/24 [120/4] via 10.1.1.2
     O   192.168.32.0/19 [110/229840] via 10.1.1.3

 

The traffic towards these networks will then be decided based on the destination IP address and subnet mask.

 

I hope thats clear, if not this this short read should clear it up:

http://www.cisco.com/c/en/us/support/docs/ip/enhanced-interior-gateway-routing-protocol-eigrp/8651-21.html

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card