I am not able to start dnsmasq on boot

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












These are the outputs I get when I type:



 systemctl status dnsmasq

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-12-14 08:49:31 UTC; 54min ago
Process: 590 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
Process: 569 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

Dec 14 08:49:30 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Dec 14 08:49:30 raspberrypi dnsmasq[569]: dnsmasq: syntax check OK.
Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Dec 14 08:49:31 raspberrypi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Unit entered failed state.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Failed with result 'exit-code'.


It works fine when I start the service manually.



I have set a static ip like this:



sudo nano /etc/dhcpcd.conf


interface wlan0
static ip_address=10.0.20.1/24
static routers=10.0.20.0






share|improve this question






















  • The log files should give you more information as to what may be going wrong.
    – Raman Sailopal
    Dec 14 '17 at 10:08






  • 2




    The log clearly says: you don't have ip 10.0.20.1 on your interfaces.
    – Ipor Sircer
    Dec 14 '17 at 10:26










  • It was a typo there.I had corrected it.
    – athul
    Dec 14 '17 at 11:53














up vote
1
down vote

favorite












These are the outputs I get when I type:



 systemctl status dnsmasq

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-12-14 08:49:31 UTC; 54min ago
Process: 590 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
Process: 569 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

Dec 14 08:49:30 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Dec 14 08:49:30 raspberrypi dnsmasq[569]: dnsmasq: syntax check OK.
Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Dec 14 08:49:31 raspberrypi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Unit entered failed state.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Failed with result 'exit-code'.


It works fine when I start the service manually.



I have set a static ip like this:



sudo nano /etc/dhcpcd.conf


interface wlan0
static ip_address=10.0.20.1/24
static routers=10.0.20.0






share|improve this question






















  • The log files should give you more information as to what may be going wrong.
    – Raman Sailopal
    Dec 14 '17 at 10:08






  • 2




    The log clearly says: you don't have ip 10.0.20.1 on your interfaces.
    – Ipor Sircer
    Dec 14 '17 at 10:26










  • It was a typo there.I had corrected it.
    – athul
    Dec 14 '17 at 11:53












up vote
1
down vote

favorite









up vote
1
down vote

favorite











These are the outputs I get when I type:



 systemctl status dnsmasq

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-12-14 08:49:31 UTC; 54min ago
Process: 590 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
Process: 569 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

Dec 14 08:49:30 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Dec 14 08:49:30 raspberrypi dnsmasq[569]: dnsmasq: syntax check OK.
Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Dec 14 08:49:31 raspberrypi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Unit entered failed state.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Failed with result 'exit-code'.


It works fine when I start the service manually.



I have set a static ip like this:



sudo nano /etc/dhcpcd.conf


interface wlan0
static ip_address=10.0.20.1/24
static routers=10.0.20.0






share|improve this question














These are the outputs I get when I type:



 systemctl status dnsmasq

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-12-14 08:49:31 UTC; 54min ago
Process: 590 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
Process: 569 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)

Dec 14 08:49:30 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Dec 14 08:49:30 raspberrypi dnsmasq[569]: dnsmasq: syntax check OK.
Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Dec 14 08:49:31 raspberrypi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Unit entered failed state.
Dec 14 08:49:31 raspberrypi systemd[1]: dnsmasq.service: Failed with result 'exit-code'.


It works fine when I start the service manually.



I have set a static ip like this:



sudo nano /etc/dhcpcd.conf


interface wlan0
static ip_address=10.0.20.1/24
static routers=10.0.20.0








share|improve this question













share|improve this question




share|improve this question








edited Dec 15 '17 at 18:06









Jeff Schaller

31.9k848109




31.9k848109










asked Dec 14 '17 at 10:06









athul

38137




38137











  • The log files should give you more information as to what may be going wrong.
    – Raman Sailopal
    Dec 14 '17 at 10:08






  • 2




    The log clearly says: you don't have ip 10.0.20.1 on your interfaces.
    – Ipor Sircer
    Dec 14 '17 at 10:26










  • It was a typo there.I had corrected it.
    – athul
    Dec 14 '17 at 11:53
















  • The log files should give you more information as to what may be going wrong.
    – Raman Sailopal
    Dec 14 '17 at 10:08






  • 2




    The log clearly says: you don't have ip 10.0.20.1 on your interfaces.
    – Ipor Sircer
    Dec 14 '17 at 10:26










  • It was a typo there.I had corrected it.
    – athul
    Dec 14 '17 at 11:53















The log files should give you more information as to what may be going wrong.
– Raman Sailopal
Dec 14 '17 at 10:08




The log files should give you more information as to what may be going wrong.
– Raman Sailopal
Dec 14 '17 at 10:08




2




2




The log clearly says: you don't have ip 10.0.20.1 on your interfaces.
– Ipor Sircer
Dec 14 '17 at 10:26




The log clearly says: you don't have ip 10.0.20.1 on your interfaces.
– Ipor Sircer
Dec 14 '17 at 10:26












It was a typo there.I had corrected it.
– athul
Dec 14 '17 at 11:53




It was a typo there.I had corrected it.
– athul
Dec 14 '17 at 11:53










2 Answers
2






active

oldest

votes

















up vote
0
down vote













Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address


This line indicates that your machine does not have the address 10.0.20.1 on your system when dnsmasq starts up. You need to reconfigure the systemd unit to start after this address has been added. This can be done by using systemd drop-ins. Create the directory /etc/systemd/system/dnsmasq.service.d and the add the following to a file with a .conf extension in that directory:



[Unit]
After=network-online.target


This assumes that your network is being brought online in a usual manner, and that it falls under the network-online.target unit. If it does not then this will not work and you'll need to adjust accordingly.






share|improve this answer




















  • I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
    – athul
    Dec 15 '17 at 6:27

















up vote
0
down vote



accepted










I solved the issue



I removed giving ip like this



sudo nano /etc/dhcpcd.conf


interface wlan0
static ip_address=10.0.20.1/24
static routers=10.0.20.0


And I gave ip to interfaces like this.



 sudo nano /etc/network/interfaces


# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto wlan0
iface wlan0 inet static
address 10.0.20.1
netmask 255.255.255.0

auto eth0
iface eth0 inet dhcp





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410833%2fi-am-not-able-to-start-dnsmasq-on-boot%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address


    This line indicates that your machine does not have the address 10.0.20.1 on your system when dnsmasq starts up. You need to reconfigure the systemd unit to start after this address has been added. This can be done by using systemd drop-ins. Create the directory /etc/systemd/system/dnsmasq.service.d and the add the following to a file with a .conf extension in that directory:



    [Unit]
    After=network-online.target


    This assumes that your network is being brought online in a usual manner, and that it falls under the network-online.target unit. If it does not then this will not work and you'll need to adjust accordingly.






    share|improve this answer




















    • I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
      – athul
      Dec 15 '17 at 6:27














    up vote
    0
    down vote













    Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address


    This line indicates that your machine does not have the address 10.0.20.1 on your system when dnsmasq starts up. You need to reconfigure the systemd unit to start after this address has been added. This can be done by using systemd drop-ins. Create the directory /etc/systemd/system/dnsmasq.service.d and the add the following to a file with a .conf extension in that directory:



    [Unit]
    After=network-online.target


    This assumes that your network is being brought online in a usual manner, and that it falls under the network-online.target unit. If it does not then this will not work and you'll need to adjust accordingly.






    share|improve this answer




















    • I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
      – athul
      Dec 15 '17 at 6:27












    up vote
    0
    down vote










    up vote
    0
    down vote









    Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address


    This line indicates that your machine does not have the address 10.0.20.1 on your system when dnsmasq starts up. You need to reconfigure the systemd unit to start after this address has been added. This can be done by using systemd drop-ins. Create the directory /etc/systemd/system/dnsmasq.service.d and the add the following to a file with a .conf extension in that directory:



    [Unit]
    After=network-online.target


    This assumes that your network is being brought online in a usual manner, and that it falls under the network-online.target unit. If it does not then this will not work and you'll need to adjust accordingly.






    share|improve this answer












    Dec 14 08:49:31 raspberrypi dnsmasq[590]: dnsmasq: failed to create listening socket for 10.0.20.1: Cannot assign requested address


    This line indicates that your machine does not have the address 10.0.20.1 on your system when dnsmasq starts up. You need to reconfigure the systemd unit to start after this address has been added. This can be done by using systemd drop-ins. Create the directory /etc/systemd/system/dnsmasq.service.d and the add the following to a file with a .conf extension in that directory:



    [Unit]
    After=network-online.target


    This assumes that your network is being brought online in a usual manner, and that it falls under the network-online.target unit. If it does not then this will not work and you'll need to adjust accordingly.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Dec 14 '17 at 13:58









    Patrick

    47.9k11125176




    47.9k11125176











    • I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
      – athul
      Dec 15 '17 at 6:27
















    • I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
      – athul
      Dec 15 '17 at 6:27















    I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
    – athul
    Dec 15 '17 at 6:27




    I tried but it's not working still the result is same.I am using it in raspberry pi with raspbian stretch lite. "Afer" had "network.target" in /lib/systemd/system/dnsmasq.service .I have edited it there and not as you said in the /etc/systemd/system/dnsmasq.service.d .Hope that too is fine.
    – athul
    Dec 15 '17 at 6:27












    up vote
    0
    down vote



    accepted










    I solved the issue



    I removed giving ip like this



    sudo nano /etc/dhcpcd.conf


    interface wlan0
    static ip_address=10.0.20.1/24
    static routers=10.0.20.0


    And I gave ip to interfaces like this.



     sudo nano /etc/network/interfaces


    # interfaces(5) file used by ifup(8) and ifdown(8)

    # Please note that this file is written to be used with dhcpcd
    # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

    # Include files from /etc/network/interfaces.d:
    source-directory /etc/network/interfaces.d

    auto wlan0
    iface wlan0 inet static
    address 10.0.20.1
    netmask 255.255.255.0

    auto eth0
    iface eth0 inet dhcp





    share|improve this answer
























      up vote
      0
      down vote



      accepted










      I solved the issue



      I removed giving ip like this



      sudo nano /etc/dhcpcd.conf


      interface wlan0
      static ip_address=10.0.20.1/24
      static routers=10.0.20.0


      And I gave ip to interfaces like this.



       sudo nano /etc/network/interfaces


      # interfaces(5) file used by ifup(8) and ifdown(8)

      # Please note that this file is written to be used with dhcpcd
      # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

      # Include files from /etc/network/interfaces.d:
      source-directory /etc/network/interfaces.d

      auto wlan0
      iface wlan0 inet static
      address 10.0.20.1
      netmask 255.255.255.0

      auto eth0
      iface eth0 inet dhcp





      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I solved the issue



        I removed giving ip like this



        sudo nano /etc/dhcpcd.conf


        interface wlan0
        static ip_address=10.0.20.1/24
        static routers=10.0.20.0


        And I gave ip to interfaces like this.



         sudo nano /etc/network/interfaces


        # interfaces(5) file used by ifup(8) and ifdown(8)

        # Please note that this file is written to be used with dhcpcd
        # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

        # Include files from /etc/network/interfaces.d:
        source-directory /etc/network/interfaces.d

        auto wlan0
        iface wlan0 inet static
        address 10.0.20.1
        netmask 255.255.255.0

        auto eth0
        iface eth0 inet dhcp





        share|improve this answer












        I solved the issue



        I removed giving ip like this



        sudo nano /etc/dhcpcd.conf


        interface wlan0
        static ip_address=10.0.20.1/24
        static routers=10.0.20.0


        And I gave ip to interfaces like this.



         sudo nano /etc/network/interfaces


        # interfaces(5) file used by ifup(8) and ifdown(8)

        # Please note that this file is written to be used with dhcpcd
        # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

        # Include files from /etc/network/interfaces.d:
        source-directory /etc/network/interfaces.d

        auto wlan0
        iface wlan0 inet static
        address 10.0.20.1
        netmask 255.255.255.0

        auto eth0
        iface eth0 inet dhcp






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 15 '17 at 17:27









        athul

        38137




        38137






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410833%2fi-am-not-able-to-start-dnsmasq-on-boot%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay