Routing – How to Route Two Routers on One Switch in Different Networks

routing

I am trying to connect two routers in one switch to ping each other using IP route .

upload

router 0 has 192.168.10.1/24 gi0/0
router 1 has 192.168.20.1/24 gi0/0

I tried putting switch-port trunks on both fa0/1 and fa0/2 for switch 0

Best Answer

For the two routers to communicate with each other they need to share a common network (across the switch in your diagram).

So, using e.g. 192.168.10.1/16 and 192.168.20.1/16 (or up to /18) would work, while 192.168.10.1/24 and 192.168.20.1/24 will not.