Cisco static routing question

phatrabt

Senior member
Jan 28, 2004
238
0
0
If you forward a subnet on a router to a static route, and that static route is being learned via OSPF from a device that's a few away, does the destination address of the packet get changed to the static address? Or does it leave it as the original destination address? Here's what I mean:

I got a destination of 10.10.14.129. RouterA has a static route for this subnet that is redistributed through the network via OSPF to RouterB. When the packet comes in destined for 10.10.14.129, the static route in RouterA points to IP address 10.10.100.1.

ip route 10.10.14.129 255.255.255.0 10.10.100.1

10.10.100.1 is learned in RouterA via OSPF from RouterB. 10.10.100.1 is 4 routers away and traces out to a Null0 interface on another router. Doing a trace of 10.10.14.129 there is a loop between RouterA and RouterB as it just keeps bouncing back and forth.

The question I have is this:

When RouterA forwards the packet back to RouterB (per the static route and the route learned via OSPF) does RouterB look at the ORIGINAL destination address (10.10.14.129 - which would explain the loop) or does it change the destination address to the static route destination (10.10.100.1 - which I would think would cause the packets to be dropped and wouldn't result in a loop)? If it looks at the original destination address, how does that work if there is a device a few hops away?
 

spidey07

No Lifer
Aug 4, 2000
65,469
5
76
I'd need to look at the router commands the routing table to really see what is going on.

But...A router will ALWAYs make a forwarding decision (where to send the packet) based on the longest prefix match in the routing table. So if there are two routes..

10.10.14.0 255.255.255.0 (10.10.14.0/24)
10.10.14.129 255.255.255.255 (10.10.14.129/32)

Notice how this route "overlap". The /32 is "more specific", "longer prefix" so it will use this route to forward a packet to 10.01.14.129. All other 10.10.14.0 addresses would use the /24 route.

I notice that you used a class C mask in your route statement. Make sure that is the correct mask for that network as 10.10.14.129 is very close to 10.10.14.128/25. This could be causing your loop. As far as the return path, it just looks at the DST address and forwards the packet.

If you're getting ping-pong between router A and B then that means both have routes pointing back to each other. routing loop. Also with OSPF all you really need to do is redistribute this static route into OSPF. Then all other OSPF routers will be aware of the route. Also be careful...OSPF is a very powerful protocol and you really need to know what you are doing before donig redistribution to understand what is going on and how to treat the route once it is in the OSPF area.

-edit-
one last thing to note. If you do pings or traces or anything else "sourced" by the router itself the router will use the IP address of the outgoing interface. This can throw people off because they think it is sourced by another address.

oh and to answer your question...a router will never change source or destination IP addresses of a packet unless told to do so via NAT/PAT or other features.
 

phatrabt

Senior member
Jan 28, 2004
238
0
0
Thanks for the response! One thing, I goofed on the static route. It should be:

ip route 10.10.14.0 255.255.255.0 10.10.100.1