When performing IP geolocation on user IP addresses, it can be challenging to achieve meaningful precision because users are often assigned random IP addresses by DHCP.
One way to overcome this problem is to use the traceroute command on the IP in question. Instead of geolocating the user’s IP address directly, you can geolocate the last routing hop’s IP address, which can yield much better results. The reason this method works better is that routing infrastructure tends to be more stable and consistent over time, as opposed to constantly changing user IP addresses.
However, one major drawback of this technique is that most routing traffic infrastructure blocks ICMP packets, which are essential for traceroute to function correctly. As a result, you might be unable to obtain the routing IP address in some cases, limiting the effectiveness of this approach.