For testing Moodle is running on Hyper-V with Default Switch as the network device. This makes it easy to test because only the host computer has access to the Moodle LAMP server, yet the server can access the internet.
One drawback is the IP address changes every time the server is restarted. Th Moodle site stops functioning. Running this script ever time the server is started makes it so the IP is updated in config.php:
sudo chmod -R 777 /var/www/html/moodle
ipaddress=$(hostname -I)
ipaddress=$(echo $ipaddress | sed 's/ *$//g')
cat /var/www/html/moodle/config.php | sed -r 's/(\b[0-9]{1,3}\.){3}[0-9]{1,3}\b'/"$ipaddress"/
sudo chmod -R 0755 /var/www/html/moodle
echo $ipaddress
Someone who knows Linux more may be able automate this.