I have also had this problem.
There is an easy fix:
Create a DNS entry for your LAN IP that matches your Domain name / public IP.
For example - internally mymoodlesite.com = internal (network IP)
externally mymoodlesite.com = public IP.
If all users use the domain name to access the site and the domain name is specified in the config.php there will be no problems with links.