I am doing a lab testing with 2 routers R1 & R2
R1 ETH 0/0 IP Address:
ip add 192.168.1.1 255.255.255.0
ip add 172.16.1.1 255.255.255.0 second
R2 ETH 0/0 IP Address:
ip add 172.16.1.12 255.255.255.0
When i ping from R1 to R2's IP Address 172.16.1.12 it was not pinging. Then i run "debug ip routing" & "debug ip packet" commands. I attached the output for your reference.
My understanding is, when the traffic is sent from R1 it is taking the source ip address 192.168.1.1 and R2 is having no route for 192.168.1.0 and thus R2 is dropping the packet
Then i added a route in R2 as "ip route 192.168.1.0 255.255.255.0 192.168.1.1 . It started working
Is there any solution available to make this work without adding route in R2
It may be a fundamental and basic concept which i am missing. Please guide me
When you use a secondary address on an interface, traffic that comes out of that interface will use the primary address as it's source generally. R2 doesn't know how to get to 192.168.1.0 without the static address, or a routing protocol, so the traffic is dropped because you're not sourcing the ping from R1's secondary address since it can only be sourced from that interface.
I may be missing something in your question, but you'll need either to run a routing protocol like eigrp, ospf, or rip, or have a static route to the 192.168.1.0 network, like you did, on the R2 router to get to the 192 subnet.