dnsmasq do not work in antix-19

Forum Forums New users New Users and General Questions dnsmasq do not work in antix-19

Tagged: ,

  • This topic has 30 replies, 7 voices, and was last updated Dec 20-7:51 pm by Brian Masinick.
Viewing 15 posts - 1 through 15 (of 31 total)
  • Author
    Posts
  • #46990
    Member
    Roberto

      I has tried to install dnsmasq in antix-19, but resolvconf do not provide a dns server for dnsmasq to work. The file /run/dnsmasq/resolv.conf is empty, so dnsmasq do not work. I know how to force dnsmasq to use a static resolv.conf file, but I want to use the dynamic one generatated by resolvconf.

      Here are the steps I used to install dnsmasq in antix-19:
      printf “\nCONNMAN_RUNSTATEDIR_RESOLVCONF=no\nDAEMON_OPTS=\” –nodnsproxy\””>>/etc/default/connman #Disable connman’s dns.
      service connman stop;sleep 3;sudo service connman start #Restart connman
      mv /etc/resolv.conf /etc/resolv.conf.bak
      echo “nameserver 127.0.0.1” > /etc/resolv.conf
      apt-get install -y dnsmasq

      The installation worked without problems, but dnsmasq do not work. What configuration I need to do for resolvconf and dnsmasq work correctly?
      Sorry about the bad english, is not my native language.

      #47030
      Member
      Xecure
        Helpful
        Up
        0
        ::

        If you want a dynamic changed resolv.conf, use a symlink instead.
        Also, you will need to explore the relationship between dnsmasq and resolvconf.
        For example, in this thread:
        https://superuser.com/questions/894513/resolv-conf-keeps-getting-overwritten-when-dnsmasq-is-restarted-breaking-dnsmas
        They suggest editing /etc/default/dnsmasq so that dnsmasq doesn’t override resolvconf.
        IGNORE_RESOLVCONF=yes

        I don’t know enough about how networking and masks work to help you. You will need to read more about how this goes or hope someone else in the forum knows how to do what you need.

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

        #47036
        Member
        Roberto
          Helpful
          Up
          0
          ::

          I already knew the method you explained, but that do not solve my problem. If I edit the file “/etc/default/dnsmasq” and write “IGNORE_RESOLVCONF=yes”, dnsmasq will ignore the dynamic dns server list generatated by resolvconf, and this is not what I wanna do.
          This option is util to force dnsmasq to use a static resolv.conf file, but as I say before that is not I wanna do.
          I need to make resolvconf automaticaly generate a /run/dnsmasq/resolv.conf file for dnsmasq to work. That’s how it worked on Linux mint 17.1 that I used before antiX linux.

          #47037
          Anonymous
            Helpful
            Up
            0
            ::

            startpage.com search engine
            query: connman dnsmasq

            search results #2, #4, #5 each seem to address this exact question

            #47040
            Member
            Roberto
              Helpful
              Up
              0
              ::

              skidoo, none of the topics you’ve listed address my issue.

              #47297
              Member
              Keeely
                Helpful
                Up
                0
                ::

                Hi Roberto,

                I’m just going through the process of trying to make dnsmasq do all the stuff I previously did in Slackware, and yes, I do need a caching DNS server, it was on my TODO list, so I had a look today. The information on this was surprisingly hard to come by, making me think this is not the right way, however the following does work for me as I just tested it.

                /etc/dnsmasq.conf

                listen-address=127.0.0.1
                no-resolv
                resolv-file=/etc/resolv.dnsmasq

                Notes: Just as an aside, I don’t like the default dnsmasq config of not logging out to a separate file so the first thing I do when getting stuff to work is change the logging options:

                log-queries 
                log-facility=/var/log/dnsmasq.log 

                But that step is optional for you, of course. I also added the following line, just to prove my setup was working:

                address=my.domain/127.0.0.1

                /etc/dhcp/dhclient.conf
                prepend domain-name-servers 127.0.0.1;

                The above line will already be there in antiX just commented out, so comment it in. If dnsmasq is left with default config, this would of course make it try to go up its own backside (which you’ll see in the logs).

                /etc/dhcp/dhclient-enter-hooks.d/update_dnsmasq

                if [ -n "$new_domain_name_servers" ]; then
                 rm /etc/resolv.dnsmasq
                 for nameserver in $new_domain_name_servers; do
                  if [ "$nameserver" != "127.0.0.1" ]; then
                   echo "nameserver $nameserver" >> /etc/resolv.dnsmasq
                  fi
                 done
                fi

                here, /etc/resolv.dnsmasq must match what you have in the dnsmasq.conf file.
                The enter hooks are difficult to find information on, as the documentation doesn’t list all the available variables. But you can activate the debug script in antiX (see /etc/dhcp/debug and change the first line to RUN=”yes”. This will at least tell you what you get. Then I was able to craft a script to construct the resolv file specially for dnsmasq. Dnsmasq will poll the resolv file for changes. If you remove it temporarily (as I do above) it will wait for it to be re-written according to the docs.

                Sources:
                http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html. (Notes section at the end talks about this).
                http://manpages.ubuntu.com/manpages/bionic/man8/dhclient-script.8.html
                /etc/dhcp/debug

                Hope this helps.

                #47307
                Member
                Roberto
                  Helpful
                  Up
                  0
                  ::

                  Hi Keeely,
                  First of all, thank you for try to solve my problem.
                  I tried the solution you posted and has another problem. I used connman system tray to disconnect and reconect to wireless, but no “/etc/resolv.dnsmasq” is generated. After that, I typed “sudo dhclient” in terminal and the file “/etc/resolv.dnsmasq” was finally genereated.
                  Have I to typed “sudo dhclient” in terminal every time I want the file “/etc/resolv.dnsmasq” to be updated?
                  How to automate the update of the “/etc/resolv.dnsmasq” file? I want the file to be updated every time I connect to the network.

                  #47308
                  Moderator
                  caprea
                    Helpful
                    Up
                    0
                    ::

                    Might helps, in cmst > preferences you can mark the “Advanced Controls” under interfaces.
                    Afterwards it is possible to write a command
                    in “External Programs” “After Connect”

                    #47342
                    Member
                    Keeely
                      Helpful
                      Up
                      0
                      ::

                      I tried the solution you posted and has another problem.

                      Ah, sorry. I’m using antiX Core, perhaps it doesn’t use connman. In fact I hadn’t heard what that was before today :(. Looks like caprea’s idea is the way to go.

                      #47402
                      Member
                      Roberto
                        Helpful
                        Up
                        0
                        ::

                        caprea,
                        I wrote “/sbin/dhclient” in “External Programs” “After Connect”, but when I diconnect and reconnect to my wireless network the file “/etc/resolv.dnsmasq” is not created yet, so this solution do not worked for me.

                        #47404
                        Moderator
                        caprea
                          Helpful
                          Up
                          0
                          ::

                          I think the problem is the missing sudo.
                          One possibility to work around this would be to change your etc/sudoers/ file
                          But might better wait if someone else has an idea.

                          #47407
                          Moderator
                          Brian Masinick
                            Helpful
                            Up
                            0
                            ::

                            I think the problem is the missing sudo.
                            One possibility to work around this would be to change your etc/sudoers/ file
                            But might better wait if someone else has an idea.

                            I am not an expert in this area either but if the process that is running is owned by root then sudo is not necessary, it’ll be run by a privilege anyway. If there is a different account running the process other than root, that account requires access to the files and directories in use. These statements are true for certain.

                            --
                            Brian Masinick

                            #47709
                            Member
                            Roberto
                              Helpful
                              Up
                              0
                              ::

                              caprea, use cmst do not work for me because I have do manualy connect to the wifi network every time a reboot the system. When system starts it automacaly start the wifi network, even if I do not open cmst. I need a solution without user interaction. Besides that, cmst run as normal user, not as root, so I need to use “sudo dhclient” and add permissions in /etc/sudoers/ to this metod works. This is not a good solution.

                              #47710
                              Moderator
                              Brian Masinick
                                Helpful
                                Up
                                0
                                ::

                                @Roberto: do you have the antix-wifi-switch program on your system?

                                On my system, it is at /usr/local/bin/antix-wifi-switch

                                You can use it to switch between ceni and connman if it is available.

                                --
                                Brian Masinick

                                #47717
                                Member
                                Roberto
                                  Helpful
                                  Up
                                  0
                                  ::

                                  @masinick: no, antix-wifi-switch is not installed. “which antix-wifi-switch” printf nothing.

                                Viewing 15 posts - 1 through 15 (of 31 total)
                                • You must be logged in to reply to this topic.