I'm learning to configure a simple PPP link with CHAP authentication for two Cisco routers. I'm trying to make sense of how router makes sense of the configuration in this example, as the logic of the configuration seems ambiguous to me.
In the configuration the username and password for the neighbor router is in the global configuration, which seems to make sense, as when a neighbor router authenticates, its name and password can be checked against the global user/password section.
There is however nothing in the configuration that explicitly tells a router what password to answer with when challenged by a neighboring router. For example (please refer to the diagram), if R1 received a challenge from R2, how does R1 know to answer with "mypass" as the CHAP password? Does R1 know that the CHAP challenge was sent from R2, and therefore it should use that password that is in the R2 user/password global pair?
Also if the user/password for CHAP are all set up in the global config and use the logic I just imagined, do multiple routers that are set up in a system all have to use the same CHAP password? Or is there a way to specify the CHAP password to use for a specific interface, or to a specific neighboring router?