Private and Public IP's

Private and Public IP's

by Luke MacKinney -
Number of replies: 7

I have moodle installed in one of my buildings and need to access it via the private IP address when I'm in that building. However all my other buildings will access it using the url. My url is what's programmed into Moodle as the www. When I try and access Moodle via the private IP in my building it has a bunch of errors, pictures won't display, it's very slow, and won't let me login all the time. How can I get it to work with both the public URL and the private IP?

 

Thanks.

Average of ratings: -
In reply to Luke MacKinney

Re: Private and Public IP's

by Steve Power -

Luke

If you have access to / control of DNS then I would suggest that you set the public IP and the private IP to the same domain name.  As an example our moodle domain name is http://learningspace.falmouth.ac.uk. Internally this resolves to 10.11.1.24 and externally it resolves to 195.194.77.30.

You then need to set $CFG->wwwroot in config.php to point to the domain name.

If you do not have this access then it is possible to fudge wwwroot to point to the appropriate ip address but one view will always be wrong due to the way moodle stores absolute address detail in links.

Regards
Steve

In reply to Luke MacKinney

Re: Private and Public IP's

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
This documentation might help as well... http://docs.moodle.org/en/masquerading
In reply to Jon Bolton

Re: Private and Public IP's

by Steve Power -

Jon

Far be it from me to disagree with Moodle Docs but I have had problems with the use of multiple values for $CFG->wwwroot.

The current value gets written into some links within the site and this can stop images from being visible from different locations. It seems particularly problematic for images within labels.

If an image is added from one value of $CFG->wwwroot it is only visible from that value from any other it appears as a broken link.

Regards
Steve

In reply to Steve Power

Re: Private and Public IP's

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Guilty! I wrote that stuff, and please do disagree away.

Are you using the HTML editor - that could well be including full URLs. Mmm...

EDIT:
In the spirit of fixing a bug by documenting it, I have added this limitation to the documentation page.
In reply to Luke MacKinney

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: Private and Public IP's

by Graeme Forrester -

If you are use a Windows domain and your own DNS server then the solution is simpler and means that you don't have to visit every machine.

1. Create a new zone on the primary DNS server eg domain.com and ensure that your DNS server is authoritive for it internally. Do not allow updates.

2. Create some host A records such as www - ip (your moodle server).

You can do the same with any internal server all you need to do is change the host header in apache which is a breeze. Best part is you don't need to change the web address which can be very confusing for end users.

I do the same with mail, student files etc. as my internal domain name is an illegal domain name on the internet and therefore non routable.

Depending on how many machines you have - host files will take a long time to deal with and if they need a reimage or if students happen to delete entries you are back to square one. 

In reply to Deleted user

Re: Private and Public IP's

by Steve Power -

Alan

Ah the joys of XP Home.

I have used the same change to hosts whenever I am working on a development server at home rather than using localhost. This allows changes to be made to a copy of our live site and for everything to look OK.

Regards
Steve