Ratna

Ratna add a DNS record

DNS record? sound like a new idea. I will look into it later

Ratna if your smart phone connects to the wi-fi access point (hotspot) of the MoodleBox, it should resolve moodlebox.home to 10.0.0.1. I don't know why it doesn't do that in your case. Often if you try to visit http://10.0.0.1 initially, it jumps to http://moodlebox.home and will stay there.

it does jump to http://moodlebox.home when i try to go to http://10.0.0.1, but however, in the page it says ERR_NAME_NOT_RESOLVED and in other page says DNS_PROBE_FINISHED_NXDOMAIN so I cannot access the Moodle website

@Nicolas
this may sound like a silly question, where do you configure to go to http://moodlebox.home ? in the Moodle config or something? or is there is any documentation i can read? i would like to try and error changing the URL for testing.

    Baam

    in the page it says ERR_NAME_NOT_RESOLVED and in other page says DNS_PROBE_FINISHED_NXDOMAIN so I cannot access the Moodle website

    Means your device doesn't know what moodlebox.home is, i.e. it does not resolve moodlebox.home to 10.0.0.1. The expected behaviour is, when a device gets the IP address through DHCP it also gets the IP address of a DNS server. That DNS server, in this case also running in the MoodleBox, resolves moodlebox.home to 10.0.0.1. Your device somehow does not behave that way.

    I don't know nothing about smart phones and their OSes, but if you provide as much information as possible about your smart-phone and how you connect it to the MoodleBox wi-fi, others might be able to help.

      Ratna

      Got it, I will look into the DNS server configuration also then

      Thank you for the insight, Ratna.

      Nicolas

      Great! I will note this also.

      I will update my changes here to keep track of my work and others can refer.

      Can you please tell us something about your Raspberry Pi case? Is there a lot of metal around it?

        Can you please copy a new microSD card? We need to have a clear starting point.

        When you put the card into the Raspberry Pi and you start it up with a monitor and a keyboard connected then you will see the enlarging of the MoodleBox partition and then a reboot. The monitor should show everything and all things should have an [OK] at the beginning of the line. Yes, one thing has a [FAILED] … it's dnsmasq … I don't know why but it seems to be normal.

        You will get the moodlebox login at the bottom. Okay, when the MoodleBox starts for the first time the sometimes I get some line after the login. The you can press enter twice without any other input and the login is in the last line. Login with the user moodlebox and the password Moodlebox4$.

        Type ifconfig and you will see four network devices and their ip addresses.
        lo is the localhost with 127.0.0.1
        uap0 is the wifi with 10.0.0.1
        eth0 is the lan. If it has a connection to your router it should have a dynamic ip from the router.
        wlan0 has no IP address. wlan0 can be configured later to connect to the internet without lan.

        If you want to connect with your notebook via lan you have to connect to your router with a second lan cable. If you disconnect the cable from the Moodlebox to the router then the dynamic IP address of the Moodlebox is lost. And you should disable your wifi modul of the notebook because you should only use one connection with only one ip address. Now you can ping your MoodleBox from the notebook with ping 192.168.1.100 …. take the ip address which is shown for eth0 when you asked for ipconfig.

        If you want to get the Moodle web site on your Notebook you must add the following line at the end the file /etc/hosts.

        192.168.1.100  moodlebox.home  moodlebox

        Do not change anything else without adding the line. Take the dynamic ip address for eth0 you got with ipconfig on the MoodleBox. Now you can ping your MoodleBox again. All three input should get the same result … the ping should answer. Does this work for you?

        ping 192.168.1.100
        ping moodlebox.home
        ping moodlebox 

        And you can take the browser on your notebook and enter the url http://moodlebox.home/ …. be sure to write http and not https and set the slash at the end. The slash at the end stops connecting to a search engine like Google. The MoodleBox web site should be shown. Does this work for you?

        The next step could be to connect your smartphone via wifi to the MoodleBox. Please switch off your mobile provider connection. Connect your smartphone to the MoodelBox wifi and check the connection settings. The ip address of the smartphone should be 10.0.0.x where x is a number from 2 to 254. The network mask should be 255.255.255.0 and the router ip address should be 10.0.0.1. Does this work for you?

        Now you can take the browser on your smartphone and enter the url http://moodlebox.home/ …. be sure to write http and not https and set the slash at the end … the same you did on the notebook. Does this work for you?

          10 days later

          ralfkrause
          sorry for the late reply, hectic week.

          ralfkrause When you put the card into the Raspberry Pi and you start it up with a monitor and a keyboard connected then you will see the enlarging of the MoodleBox partition and then a reboot. The monitor should show everything and all things should have an [OK] at the beginning of the line. Yes, one thing has a [FAILED] … it's dnsmasq … I don't know why but it seems to be normal.

          yep, just like you said.

          ralfkrause You will get the moodlebox login at the bottom. Okay, when the MoodleBox starts for the first time the sometimes I get some line after the login. The you can press enter twice without any other input and the login is in the last line. Login with the user moodlebox and the password Moodlebox4$.

          yep, also same.

          ralfkrause Type ifconfig and you will see four network devices and their ip addresses.

          yep, mine is
          lo is 127.0.0.1
          uap is 10.0.0.1
          eth0 is 192.168.1.51 (from my home router)
          wlan0 has no ip address

          ralfkrause connect to your router with a second lan cable

          yes in this environment. my notebook and my pi is connected to my router via cable.

          initial try to access website on URL http://moodlebox.home/ is not success, its the same as before.

          ralfkrause the end the file /etc/hosts.

          yes i have edit as your preferences, you can refer to this image.

          ralfkrause the ping should answer. Does this work for you?

          for the ping, i only can ping to the ip address only, the other two replied unable to find host.
          you can refer to this image

          ralfkrause The MoodleBox web site should be shown. Does this work for you?

          nope, same as before. refer here,

          ralfkrause Connect your smartphone to the MoodelBox wifi and check the connection settings

          yes i can connect to the Moodlebox's WiFi, here is the configuration.

          ralfkrause be sure to write http and not https and set the slash at the end … the same you did on the notebook. Does this work for you?

          nope, still not

          ralfkrause

          ralfkrause Can you please tell us something about your Raspberry Pi case? Is there a lot of metal around it?

          yes sure.
          my Raspberry pi is protected by plastic/ABS case. i put it beside my laptop on the table, no metal around it that i am aware of.

          ralfkrause If you want to get the Moodle web site on your Notebook you must add the following line at the end the file /etc/hosts.

          @Baam You should do this (edit /etc/hosts) on your computer, not on the MoodleBox (you seem not to have read the doc).

            Nicolas

            Oh, my bad, I'm trying to understand. I'm sorry.
            Ok so update on that i have change the hosts file on my windows. (i refer on google how to that, there are plenty on how to do it)..
            I also have set static address on my pi to 192.168.1.60

            Finally, now my notebook can access the website (yes finally), just by typing http://moodlebox.home/, but from my smartphone, connect directly to the MoodleBox wifi or my home router (because my pi is also connected to home router) is still getting the same issue (ERR_NAME_NOT_RESOLVED and DNS_PROBE_FINISHED_NXDOMAIN).

            Now, i have new question, is the next devices who want to access the website need to add the new line in the hosts file also or what? is that how it is supposed to work?

              Baam Oh, my bad, I'm trying to understand. I'm sorry.

              No problem, we all do 😃

              Baam Now, i have new question, is the next devices who want to access the website need to add the new line in the hosts file also or what? is that how it is supposed to work?

              Suppose that you have a fresh MoodleBox:

              1. Out of the box (i.e. without any configuration), any device connected to the "MoodleBox" wireless LAN can automatically access MoodleBox interface via the https://moodlebox.home/ URL.
              2. Devices not connected to this WLAN (e.g. on the same ethernet LAN of MoodleBox) can access via the https://moodlebox.home/ URL, either if you configure correctly a DNS on the ethernet LAN (e.g. your router’s DNS server), or if you edit /etc/hosts file of all these devices, as stated here: https://moodlebox.net/en/help/how-to-access-the-moodlebox-via-ethernet/.

              Baam getting the same issue (ERR_NAME_NOT_RESOLVED and DNS_PROBE_FINISHED_NXDOMAIN)

              If you keep getting these errors, the problem lies on point 2 above. I kindly suggest you try to start over with a fresh MoodleBox image, don't change anything in it and get a valid DNS configuration on your LAN, e.g. on your router’s DNS server.

              Greetings everyone,
              Thank you for holding on to me.
              Here is an update so far.

              I have start over with a fresh MoodleBox image and I connect the pi to my home network. In my home router, I bind the Pi's MAC address to 192.168.1.60 so I don't have to configure in /etc/dhcpcd.conf file. I also have configured my home network DNS configuration to the Pi (192.168.1.60), but still i couldn't access the Moodle website.
              After some brainstorming with my colleagues, I manage to get access the website.
              Let me explain the steps.
              after reconsidering @Ratna 's advice. to add a DNS record, I have do homework on how to add a record in DNSMASQ.

              Ratna add a DNS record

              Turns out, you can add records easily in /etc/hosts file, as the DNSMASQ will also look in the /etc/hosts file. So, I have add (in the /etc/hosts file)

              192.168.1.60 moodlebox

              Next, restart the dnsmasq.service.

              sudo systemctl restart dnsmasq.service

              ***after this step, i still cannot access the Moodle website yet. but after i have add this line in /etc/dnsmasq.conf

              listen-address=192.168.1.60
              address=/home/192.168.1.60

              Now, i can successfully access the Moodle website. I can access it using http://moodlebox.home, http://192.168.1.60 (will also redirect to http://moodlebox.home). without editing hosts file on my windows notebook.

              BUT make sure to turn off DNS/VPN on your devices (windows, mac, iphone, android). because I personally configure my DNS to dns.adguard.com to block all the ads.

              I am not sure why but if there are other DNS configured, I cannot access the Moodle website.

              Thus, my issue is solved! Yey. Thank you @Nicolas, @Ratna, @ralfkrause

                Baam I don't know if I could accept your settings as a solution for connecting the MoodleBox.


                As I wrote in https://discuss.moodlebox.net/d/60-connect-an-access-point-to-the-moodlebox/7 I am using a TP WR-1043ND to connect to my MoodleBox. In this configuration every device connected with the router can connect to http://moodlebox.home/ . The device can be connected with an ethernet cable to the yellow connectors to the router or it can be connected to the wifi of the router or it can be connected to the wifi of the MoodleBox. And in every case you with get the correct web page by typing in moodlebox.home/ or moodlebox/ (and in my special setting with the url shortener YOURLS you also can typ mb/ as a very short address ... see https://discuss.moodlebox.net/d/269-using-an-url-shortener-on-the-moodlebox for this).

                Yes, of course you can also use the ip addresses ... 192.168.1.100, if your computer is connected to the router via cable or wifi, and 10.0.0.1 if your device is connected to the Moodlebox wifi ... but actually nobody has to know the ip addresses!! When connecting to the router or to the MoodleBox the dhcp service also sends the correct dns server.

                In my openwrt router I set up a static lease and some dns entries for my MoodleBox ... moodlebox.home, moodlebox and mb. Please look at the screenshots. The MoodleBox gets the static ip address 192.168.1.100 and the dns server adds the dns names for the MoodleBox. You do not need to change anything on any device to connect to the MoodleBox. I need only to configure the router and no computer!

                Yes, you're correct that you must switch off any vpn tunnel and any external dns. If your device uses vpn it is connected directly to an external vpn server and knows nothing about the local devices in your local network. And if your device uses an external dns then this dns knows nothing about the local devices. With such a setting your device does not find the MoodleBox but it also does not find the local printer, the local server, or the local NAS.

                  5 days later

                  ralfkrause
                  I currently using TP-Link Archer MR200 v2. Your setup is likely similar to mine, the difference is only mine get to the WAN by using the LTE connection. I also already make research on how to change router firmware to OpenWRT firmware, but sadly, there is none related to my version (v2), there only available for version 1. So, I could not try the OpenWRT in this setup.

                  In my router, I have configured the primary DNS to the Pi's IP Address
                  NOTE: I have change my Pi's IP address to 192.168.1.100

                  I also have Bind IP with MAC address for my laptop (192.168.1.50) and my Pi (192.168.1.100)

                  ralfkrause I don't know if I could accept your settings as a solution for connecting the MoodleBox.

                  I also don't have any idea, but this is only way right now that seems to work. If there are any ways to make it more make sense. I would be happy to try.

                  My configuration is just the same as I wrote here

                  Baam I manage to get access the website.

                  Here is some screenshot of my configuration

                  moodlebox@moodlebox:/etc $ cat hosts

                  127.0.0.1 localhost
                  ::1 localhost ip6-localhost ip6-loopback
                  ff02::1 ip6-allnodes
                  ff02::2 ip6-allrouters

                  #10.0.0.1 moodlebox
                  192.168.1.100 moodlebox.home moodlebox
                  192.168.1.100 moodlebox.home mb

                  I have configured some of DNS entries for my Moodlebox by referring at ralfkrause posts. I also can access Moodle by using http://moodlebox.home, http://192.168.1.100 and even by using mb/ at the search bar.
                  I also have decided to not be using the built-in access point because i am using my own router, so I will not need the 10.0.0.1 address and remove it from the configuration.

                  I also add these two entries into /etc/dnsmasq.conf

                  listen-address=192.168.1.100
                  address=/home/192.168.1.100

                  And that's all the configuration and I now can access the Moodle website.

                  Thank you for the guide.

                    Baam
                    In the first screenshot I found a setting that would not allow to find any internet address outside your classroom. The primary address for all devices in the router network must be the router itself, in your case 192.168.1.1. The MoodleBox does not send dns data to the ethernet port. Every device connected to the MoodleBox wifi will get the dns information from the MoodleBox. But to load anything from the internet the MoodleBox also needs a correct dns server for the next jump ... and this next jump is the router. And the router gets its next jump from an external dns via WAN or LTE. So the network gets a following up dns chain.

                    Because you can't set a dns entry for moodlebox.home or moodlebox you need to set the file /etc/hosts in every of your devices which should connect to the MoodleBox over the router and the ethernet port. The last two lines in your hosts file should be only in one line ... you can add more than two names behind the ip address and they all will show the same ip address to your web browser.

                    192.168.1.100 moodlebox.home moodlebox mb

                    But you should set this hosts file on your notebook and not on the MoodleBox. In your case you will have not any device which can connect to the MoodleBox wifi. Every device connected to MoodleBox wifi gets an ip address 10.0.0.x but the server does not know its ip address 10.0.0.1 anymore.

                    The idea of the MoodleBox is that the devices will connect to the MoodleBox wifi. You can connect about 20 devices at the same time. Every device gets an ip address and the dns from the MoodleBox. And every device will get a connection to the internet when the MoodleBox is connected to the internet.

                    Your using case is special. You want to connect to the MoodleBox via ethernet port. Therefore you need to set the static ip address to the ethernet port. Yes, you did this in your router with 192.168.1.100. And you need to edit the hosts file in your notebook so the notebook knows how to find http://moodlebox.home/ ... yes, the hosts file inside the notebook tells that http://moodlebox.home/ and http://192.168.1.100/ are the same.

                    Do not edit anything in the MoodleBox to fix your problem.

                      ralfkrause

                      ralfkrause you can add more than two names behind the ip address

                      Ohh I see, thank you for telling me this.

                      ralfkrause The idea of the MoodleBox is that the devices will connect to the MoodleBox wifi. You can connect about 20 devices at the same time. Every device gets an ip address and the dns from the MoodleBox. And every device will get a connection to the internet when the MoodleBox is connected to the internet.

                      I will try this setup with a new fresh install SD Card later.

                      ralfkrause you need to edit the hosts file in your notebook

                      Alright, note that!

                      ralfkrause Do not edit anything in the MoodleBox to fix your problem.

                      OK, I'm trying not to do so. hehe

                      My current MoodleBox is running fine! I decided to show my parameters.

                      Yes, I am connected with a notebook to my router and the router dns is setup to resolve http://moodlebox.home as 192.168.1.100. Yes, my notebook shows the MoodleBox web site and the MoodleBox administration. My notebook has the ip address 192.168.1.144. My notebook is not shown in the MoodleBox dashboard because it gets its ip address from my router and not from the MoodleBox.

                      But in the dashboard you can see my iPhone which is connected to the MoodleBox wifi and has the ip address 10.10.10.61. My iPhone can get to the web site http://moodlebox.home and the MoodleBox administration. And my iPhone can go to the internet ... via MoodleBox wifi, through the MoodleBox, through lan cable and the router. The MoodleBox ip address 10.10.10.1 is a setting in the MoodleBox dashboard, also the country.

                      No, there is not any change in the MoodleBox without the additional url shortener yourls I described here https://discuss.moodlebox.net/d/269-using-an-url-shortener-on-the-moodlebox

                      I hope that you believe to start without any change of the MoodleBox software.
                      The only changes for the connection with an ethernet cable are:

                      • you need a static ip address for the MoodleBox which you set in the router ... otherwise it is dynamic.
                      • you must add the dns entry in the file /etc/hosts of your notebook or you must add the dns entry into the dns server of your router.

                      I like the MoodleBox very much because it is so easy to use out of the box.

                        ralfkrause I think the difficulty in understanding that MoodleBox is that it is also a router, having two network interfaces each in a different IP network. The first one is the wireless network 10.0.0.0/24, to which the wi-fi interface of MoodleBox is connected. It sets its own address as 10.0.0.1. Other devices connected to this wireless network (generally) get their network setup from the (DHCP server of the) MoodleBox. Yes, there is also a DHCP running in the MoodleBox!

                        The second network interface is the (cable) Ethernet port, which is connected to the Internet router. These "routers" are usually modem, DHCP server, wi-fi access point, network filter, ... Many things in one! By default MoodleBox does not decide on the IP address of Ethernet port, rather gets it from the DHCP server in the Internet router. In Ralf's network it is 192.168.1.0/24 and gave MoodleBox Ethernet interface the IP 192.168.1.100.

                        In short, talking of the IP address of the MoodleBox is confusing, because there are two!

                        Test: Why MoodleBox does not extend its DHCP server to the second (cabled Ethernet) LAN?

                          ralfkrause My current MoodleBox is running fine! I decided to show my parameters.

                          Thank you for sharing, Krause.
                          I just bought secondhand router, TP-Link Archer C5. I wanted to install OpenWRT in it, so I can look forward for your settings.

                          Ratna Test: Why MoodleBox does not extend its DHCP server to the second (cabled Ethernet) LAN?

                          maybe because usually in LAN, there is their own IP address provided by the router or dedicated DHCP server.