I don't have any expertise regarding this. However, this post suggests creating the file local/defaults.php containing the line:
$defaults['moodle']['getremoteaddrconf'] = 3;The advice is a bit inconsistent so you may need to experiment with these settings.