I know that subnetting helps in dividing the internet part and physical address + host part. Like, a class C prefix uses 3 octets for internet part and 1 bit for physical address + host part. I'm reading this book and they keep referring that subnets are used in the internet. But how do the router happen to change the last part of the public IP address to send request for a particular host in the local network? Does the router have control over the last octet to change it by itself? Or the subnetting technology is used for local network only? And does the ISP have any control over how we use subnet? Like my public IP is 220.127.116.11. Does it change the last part 112(if it were using Class C) for different hosts in a network?
Just continue reading. Both global and local IP networks can be subneted. Network Address Translation (NAT) is used to translate local IP into public.
When talking about your specific address, you're talking about a /32. Your network might be in any subnet your ISP sees fit.
Example: 18.104.22.168/16 is the network as received by your ISP from its local IP authority. They might divide it further for different routers, CMTS, dslam or whatever your technology uses, so let's say you receive your 22.214.171.124 in the subnet /20. An internet router might have in his table the full network as 126.96.36.199/16 in its table, but then it need to forward packets to your address, a specific /32, so he thinks: if I take the first 16 bits of this address will it match this 188.8.131.52? If yes, it forwards your packet to "network 184.108.40.206". As the packet reach your ISP network, /16 is not enough anymore, so your ISP router looks for the network 220.127.116.11/20, which is the network address for the network your address is in.
It maches ones and zeros, from left to right, that's why 18.104.22.168 is the network address of 22.214.171.124/20, even if the third octet is not the same. Very confusing at first. Keep practicing and you'll get the hang of it.