Is there a way to figure out the country name just by looking at an IP address? I mean, do countries have specific ranges of IP addresses? For example, Australia can have IP addresses only in the range of 123.45.56.89 - 231.54.65.98
(just an example)
I think what you're looking for is an IP Geolocation database or service provider. There are many out there and some are free (get what you pay for).
Although I haven't used this service before, it claims to be in real-time: https://www.kickfire.com
Here's another IP geo location API from Abstract API - https://www.abstractapi.com/ip-geolocation-api
But just do a google search on IP geo and you'll get more results than you need.