Hi, can anyone help me configure ssh server,

Currently, ssh checks the ip address of the client before allowing the login process.

Is it possible to configure the ssh, in a way that if the clients ip address is not in ip routing table, it would check if there is a private key available, if both conditions are not satisfied then the connection will be terminated.

the process is something like this;
if( ipAddress exist in IP routing table ) {
allow login
} else if( key exist ) {
allow login
} else {
connection terminated
how will can i configure my ssh like this?