Moodle 3.6.2 - Ip address

Moodle 3.6.2 - Ip address

by Leandro C. -
Number of replies: 5

Hello everyone, I'm using moodle 3.6.2+ on a lamp server, virtualized in a Virtual Box virtual machine.

I have the custom of exporting the virtual machine and taking it home to increment the bank of issues.

At home, I set the network to brigde mode and the manual ip address set at .******. I also change the file "config.php" on wwwroot.

During the week, I return the virtual machine for my work and reconfigures the Ip address to ********** including making the same change in wwwroot.

Always reset the apache server with the command: "systemctl restart apache2.

It turns out that some moodle server pages are displaying iP "conflict", as you can see in the attachment.

How can I solve this problem?

(Edited by Mary Cooch - original submission Tuesday, 26 February 2019, 9:29 PM)

Average of ratings: -
In reply to Leandro C.

Re: Moodle 3.6.2 - Ip address

by Ken Task -
Picture of Particularly helpful Moodlers

Suggest changing the approach.  

Configure the virtualized LAMP Moodle server configured with a FQDN ... something like mymoodle.somenet.net.  In the VB config of the that instance ... set DHCP as one would normally.

Use your workstations host file to map a 10. to the FQDN of mymoodle.somenet.net.   If the workstation is a laptop and you carry it back and forth to work makes no difference then what IP address the server gets if using the host file map 10.x.x.x or 192.168..x.x ... all map to the FQDN mymoodle.somenet.net.

To make a line in-active in /etc/hosts just add # in front.

To activate a mapping line remove the #.

Moodle config file does not change and there is no need to run search and replace for all the internal links that moodle might have recorded using IP addresses.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.6.2 - Ip address

by Leandro C. -

Ken, thanks for your help.

I believe I'm on the right path to solve the problem, but I would like to have more details to finish.

I made the following changes inside the VM:

hosts


hostname


hostnames



After these settings, I can access the moodle through the addresses "simfo.carcara.ead" or 192.168.0.16, when I am inside the VM. But I can not access moodle in any address by the host . (The VB network is configured in bridge mode.)

Could you give me more details about this question?

Thanks again for your attention.


(Edited by Helen Foster to remove image containing sensitive data - original submission Wednesday, 27 February 2019, 7:01 AM)

In reply to Leandro C.

Re: Moodle 3.6.2 - Ip address

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
As Ken explained, chaning the URL of a Moodle site back and forth is no fun. Not only you have to edit config.php you might even have to run the https://docs.moodle.org/36/en/Search_and_replace_tool.

Yes, defining a fictitious domain is one solution. But then not only the server also the clients must resolve this domain to the IP address of the Moodle VM it needs to reach. In other words, you have to edit the hosts file of the client(s) too.
In reply to Leandro C.

Re: Moodle 3.6.2 - Ip address

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, then please clarify what this means and why you are 'taking it home'?

"I have the custom of exporting the virtual machine and taking it home to increment the bank of issues."

Is the purpose for taking it home to work on issues in a 'test environment'?  Am guessing that 'to increment' means update or upgrade.

If that's the case, using the host file on a local machine fits and is the only way to go.  The VM clone of the server has exactly the same FQDN ... no need to change anything about/on server.

I do the very same thing when working remotely on a true remotely hosted server that is moving to another provider thus will have a different IP address in DNS - the FQDN will not change after the move/migration.

Now if others need to access then they also would have to edit their hosts file ... and you would need to open ports in your home firewall ... etc. etc.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.6.2 - Ip address

by Leandro C. -

Mr Ken, sorry to answer only now. You understood my first message correctly. I was changing the IP every time I moved the virtual machine from my work to my home.

I understand now that it is not a good idea to change Moodle IP. To solve the problem, I accessed the available options in: http://yourmoodlesite.org/admin/tool/replace/index.php

Thank you