A router (IPv4)

Destination             Interface
0.0.0.0/0               m0
172.58.128.0/17         m1
172.58.128.0/19         m2 
172.58.160.0/19         m3

I need choose which interface is correct. I did so:

172.58.218.80 m2
172.58.165.90 m3
172.58.124.36 m1
172.58.169.18 m3  
172.58.155.112 m2
172.59.12.142 m0

Can anyone check if I did this right? Beacuse I do not really understand the "longest prefix match".

How can I know the address is been "match" in the routing table?

Thanks


Thanks. resmon6

So Step1 convert it to binary.

10101100.00111010.10000000.00000000 172.58.128.0/17  
10101100.00111010.10000000.00000000 172.58.128.0/19         
10101100.00111010.10100000.00000000 172.58.160.0/19

Step2 use subnet mask to get the prefix.

10101100.00111010.1    is the prefix for 172.58.128.0/17
10101100.00111010.100  is the prefix for 172.58.128.0/19
10101100.00111010.101  is the prefix for 172.58.160.0/19

Step3

10101100.00111010.11011010.01010000 172.58.218.80 
10101100.00111010.10100101.01011010 172.58.165.90 
10101100.00111010.01111100.00100100 172.58.124.36 
10101100.00111010.10101001.00010010 172.58.169.18  
10101100.00111010.10011011.01110000 172.58.155.112 
10101100.00111011.00001100.10001110 172.59.12.142

-------------------------------------------------------- 
10101100.00111010.1 
10101100.00111010.100 
10101100.00111010.101

So it means

172.58.218.80 m1
172.58.165.90 m3
172.58.124.36 m0
172.58.169.18 m3
172.58.155.112 m2
172.59.12.142 m0

Can you help me to check it is correct now ?

Thanks

Edit
Report