Let's say there is a web application running on server 22.214.171.124 ip. Peer A open this web application in his own browser.Now how he will be able to connect a ethereum node where peer B is running.Please note ip of peer A,peer B are different from the ip where web server is running i.e. 126.96.36.199.
I'd suggest you shall not make your UI directly talk to your ethereum node because its not safe to expose the node directly to UI.
however, you shall try and create a middleware in nodejs to communicate to Ethereum backend.
In nodejs middleware you can use web3js api to connect with your ethereum node.
We have recently created such middleware APIs in node.js. You can take a look at this repo for reference -
The UI talks to node.js middleware and then middleware talks to Ethereum node.
Hope this helps.
Via embedde web3 in the client's browser. Thus, the client's browser needs web3. Best way to do it is MetaMask. In MetaMask, the user (client) can configure the node. MetaMask comes with some central nodes, so the user (client) actually does not need to setup any node. This is how I do it, e.g. http://www.chainify.io
web3 = new Web3(new Web3.providers.HttpProvider("http://PEER_B_IP:8545"));
If you know the ip of a client you may put the additional restriction on the Peer B server (firewall) only to accepts connection on port 8545 from the client ip.