- A virtual community of network engineers
 Home  BookStore  StudyNotes  Links  Archives  StudyRooms  HelpWanted  Discounts  Login
Source Address Selection posted 11/02/2008
[Chronological Index] [Thread Index] [Top] [Date Prev][Date Next] [Thread Prev][Thread Next]


I have a question about source address selection.  Obviously when pinging
another device, a router will use a source address of either the interface
that's directly connected to the destination or else the source address of
the exit interface that the router uses if it has a route in its routing
table.  The question I have is related to local policy routing in which the
destination address is NOT in the local router's routing table.

I've tested using a bunch of different address space and have found that I
get different results without an obvious pattern.  For example I had 3
routers connected as such:

      .       .
    .          .
R1             R2

I setup local policy routing on R0 and specified that when it tries to reach
R1's loopback address it should use a next-hop address of R1's directly
connected interface address.

If I don't match an address and simply set "ip next-hop x.x.x.x" it works
just fine, however, if I choose to "match" an address whether or not it
works depends entirely on what address space i use on the R0--R2 link even
though the address I'm trying to reach is the loopback on R1.  Here are some
config's to help illustrate what I'm trying to say:

( is R1's loopback address)

int f0/0
description link to R1
ip add

int fa1/0
desc link to R2
ip add

access-list 100 permit

route-map NEXT
match ip add 100
set ip next-hop

ip local policy route-map NEXT

even though there is NO route to in my routing table, when I try
to ping it my router always chooses to source from it's f1/0
interface rather than the f0/0 interface that is needed for local policy
routing to function properly in this scenario.  I know that I can easily NOT
use a match statement referencing the 10 address or modify the existing
access-list etc, but the purpose of me doing this scenario is for me to try
and determine why the router chooses to source from one address or another
when the destination address is NOT in the routing table and it is not
directly connected.

so anyway, the router always seemed to source from the 20 address, which
lead me to believe that if a router doesn't have a route in its routing
table, it chooses to source it's traffic from an interface with the highest
IP.  so I tried changing the address space of interface f1/0 to something
else besides, but still higher than the address and
I had different results every time.  It seemed completely random too.  Some
random addresses (all above seemed to be chosen as the source
address while others didn't and ended up being the source
address.  For example, I think when I used as the f1/0 address
it ended up being the source address when trying to ping to, but
when I used as f1/0's address, the ended up being
the source address and when i set f1/0 to, was
still the source.   I tried about 5 different subnets on f1/0 and whether
f1/0 or f0/0 ended up being the source address seemed completely random.

Sorry this is such a long post and that it's probably difficult to
understand my point.  This issue is kind of difficult for me to put into
words, although it would probably only take my 10 seconds to explain
verbally to someone.

Again, the point of this lab scenario is NOT to make local policy routing
work...that would be easy for this scenario.  It was just for me to
determine what makes a router choose its "source" address when the
destination address is not directly connected and it's not in the routing
table.  From what I've seen it's just plain old random.  Hopefully, someone
has a better answer if that's not the case.