I had this exact same problem and didn't find any answers online. Good news is that the fix is simple. The issue is not with your server or router config, but with your Gallery2 config.
In your Gallery2 root folder, locate the config.php file and open in in a text editor. Towards the end of the file, you will find a line something like
Code:
$gallery->setConfig('baseUri', 'protocol://192.168.blah.blah/Gallery2/main.php');
This line seems to be automatically written with the most recent installers for Gallery2 and is overriding the Gallery's autodetection features.
Fix: Just delete that line.
It should work just fine after that.
Cheers,
-blankreality