wget is unable to resolve host address 80% of the time

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











up vote
6
down vote

favorite
2












I have a wget 'http://xxxx.net/somepage.asp?params@abc' in a bash file.



When I run it, four out of five times it says:



Resolving xxxx.net (xxxx.net)... failed: No address associated with hostname.
wget: unable to resolve host address 'xxxx.net'


Thinking that there was a problem with my DNS server, I added a ping -c 2 xxxx.net before wget. Ping is 100% positively resolved all the time.



What could be the cause? Does wget have its own method of resolving names? This is on a Raspberry Pi.










share|improve this question













migrated from serverfault.com Nov 18 '14 at 4:04


This question came from our site for system and network administrators.


















    up vote
    6
    down vote

    favorite
    2












    I have a wget 'http://xxxx.net/somepage.asp?params@abc' in a bash file.



    When I run it, four out of five times it says:



    Resolving xxxx.net (xxxx.net)... failed: No address associated with hostname.
    wget: unable to resolve host address 'xxxx.net'


    Thinking that there was a problem with my DNS server, I added a ping -c 2 xxxx.net before wget. Ping is 100% positively resolved all the time.



    What could be the cause? Does wget have its own method of resolving names? This is on a Raspberry Pi.










    share|improve this question













    migrated from serverfault.com Nov 18 '14 at 4:04


    This question came from our site for system and network administrators.
















      up vote
      6
      down vote

      favorite
      2









      up vote
      6
      down vote

      favorite
      2






      2





      I have a wget 'http://xxxx.net/somepage.asp?params@abc' in a bash file.



      When I run it, four out of five times it says:



      Resolving xxxx.net (xxxx.net)... failed: No address associated with hostname.
      wget: unable to resolve host address 'xxxx.net'


      Thinking that there was a problem with my DNS server, I added a ping -c 2 xxxx.net before wget. Ping is 100% positively resolved all the time.



      What could be the cause? Does wget have its own method of resolving names? This is on a Raspberry Pi.










      share|improve this question













      I have a wget 'http://xxxx.net/somepage.asp?params@abc' in a bash file.



      When I run it, four out of five times it says:



      Resolving xxxx.net (xxxx.net)... failed: No address associated with hostname.
      wget: unable to resolve host address 'xxxx.net'


      Thinking that there was a problem with my DNS server, I added a ping -c 2 xxxx.net before wget. Ping is 100% positively resolved all the time.



      What could be the cause? Does wget have its own method of resolving names? This is on a Raspberry Pi.







      networking dns wget






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 18 '14 at 4:02









      Old Geezer

      132117




      132117




      migrated from serverfault.com Nov 18 '14 at 4:04


      This question came from our site for system and network administrators.






      migrated from serverfault.com Nov 18 '14 at 4:04


      This question came from our site for system and network administrators.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          7
          down vote



          accepted










          Technically they should both use the same way of resolving addresses, however ping is likely not going to try resolving IPv6 addresses at all (AAAA records) and query directly A records as it's an IPv4-only tool (ping6 does IPv6 ICMP requests).



          A configuration issue I've seen in some load-balancing DNS servers backed by named (the same should apply no mater what backs the dymamic DNS resolver) is that when there is an A record in the load-balancing configuration and nothing for the same name in named, a request for the AAAA record falls back to named which respond with an NXDomain error (no such domain), preventing the resolver from attempting any other requests. One fix is adding an A, TXT or other compatible record for that name so when named catches an AAAA request it will not return an address nor return NXDomain, so the the client will go on and look for an A record.



          If you have no control over the DNS server, using wget --inet4-only option may help. If that solves your issue you should also tell the domain owner about the DNS issue.






          share|improve this answer




















          • Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
            – Old Geezer
            Nov 18 '14 at 5:01










          • I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
            – Old Geezer
            Nov 18 '14 at 5:09











          • @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
            – Thomas Guyot-Sionnest
            Nov 18 '14 at 5:15










          • Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
            – Old Geezer
            Nov 18 '14 at 9:26







          • 1




            @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
            – Thomas Guyot-Sionnest
            Nov 19 '14 at 2:18










          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%2f168584%2fwget-is-unable-to-resolve-host-address-80-of-the-time%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          7
          down vote



          accepted










          Technically they should both use the same way of resolving addresses, however ping is likely not going to try resolving IPv6 addresses at all (AAAA records) and query directly A records as it's an IPv4-only tool (ping6 does IPv6 ICMP requests).



          A configuration issue I've seen in some load-balancing DNS servers backed by named (the same should apply no mater what backs the dymamic DNS resolver) is that when there is an A record in the load-balancing configuration and nothing for the same name in named, a request for the AAAA record falls back to named which respond with an NXDomain error (no such domain), preventing the resolver from attempting any other requests. One fix is adding an A, TXT or other compatible record for that name so when named catches an AAAA request it will not return an address nor return NXDomain, so the the client will go on and look for an A record.



          If you have no control over the DNS server, using wget --inet4-only option may help. If that solves your issue you should also tell the domain owner about the DNS issue.






          share|improve this answer




















          • Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
            – Old Geezer
            Nov 18 '14 at 5:01










          • I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
            – Old Geezer
            Nov 18 '14 at 5:09











          • @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
            – Thomas Guyot-Sionnest
            Nov 18 '14 at 5:15










          • Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
            – Old Geezer
            Nov 18 '14 at 9:26







          • 1




            @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
            – Thomas Guyot-Sionnest
            Nov 19 '14 at 2:18














          up vote
          7
          down vote



          accepted










          Technically they should both use the same way of resolving addresses, however ping is likely not going to try resolving IPv6 addresses at all (AAAA records) and query directly A records as it's an IPv4-only tool (ping6 does IPv6 ICMP requests).



          A configuration issue I've seen in some load-balancing DNS servers backed by named (the same should apply no mater what backs the dymamic DNS resolver) is that when there is an A record in the load-balancing configuration and nothing for the same name in named, a request for the AAAA record falls back to named which respond with an NXDomain error (no such domain), preventing the resolver from attempting any other requests. One fix is adding an A, TXT or other compatible record for that name so when named catches an AAAA request it will not return an address nor return NXDomain, so the the client will go on and look for an A record.



          If you have no control over the DNS server, using wget --inet4-only option may help. If that solves your issue you should also tell the domain owner about the DNS issue.






          share|improve this answer




















          • Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
            – Old Geezer
            Nov 18 '14 at 5:01










          • I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
            – Old Geezer
            Nov 18 '14 at 5:09











          • @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
            – Thomas Guyot-Sionnest
            Nov 18 '14 at 5:15










          • Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
            – Old Geezer
            Nov 18 '14 at 9:26







          • 1




            @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
            – Thomas Guyot-Sionnest
            Nov 19 '14 at 2:18












          up vote
          7
          down vote



          accepted







          up vote
          7
          down vote



          accepted






          Technically they should both use the same way of resolving addresses, however ping is likely not going to try resolving IPv6 addresses at all (AAAA records) and query directly A records as it's an IPv4-only tool (ping6 does IPv6 ICMP requests).



          A configuration issue I've seen in some load-balancing DNS servers backed by named (the same should apply no mater what backs the dymamic DNS resolver) is that when there is an A record in the load-balancing configuration and nothing for the same name in named, a request for the AAAA record falls back to named which respond with an NXDomain error (no such domain), preventing the resolver from attempting any other requests. One fix is adding an A, TXT or other compatible record for that name so when named catches an AAAA request it will not return an address nor return NXDomain, so the the client will go on and look for an A record.



          If you have no control over the DNS server, using wget --inet4-only option may help. If that solves your issue you should also tell the domain owner about the DNS issue.






          share|improve this answer












          Technically they should both use the same way of resolving addresses, however ping is likely not going to try resolving IPv6 addresses at all (AAAA records) and query directly A records as it's an IPv4-only tool (ping6 does IPv6 ICMP requests).



          A configuration issue I've seen in some load-balancing DNS servers backed by named (the same should apply no mater what backs the dymamic DNS resolver) is that when there is an A record in the load-balancing configuration and nothing for the same name in named, a request for the AAAA record falls back to named which respond with an NXDomain error (no such domain), preventing the resolver from attempting any other requests. One fix is adding an A, TXT or other compatible record for that name so when named catches an AAAA request it will not return an address nor return NXDomain, so the the client will go on and look for an A record.



          If you have no control over the DNS server, using wget --inet4-only option may help. If that solves your issue you should also tell the domain owner about the DNS issue.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 18 '14 at 4:54









          Thomas Guyot-Sionnest

          30026




          30026











          • Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
            – Old Geezer
            Nov 18 '14 at 5:01










          • I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
            – Old Geezer
            Nov 18 '14 at 5:09











          • @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
            – Thomas Guyot-Sionnest
            Nov 18 '14 at 5:15










          • Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
            – Old Geezer
            Nov 18 '14 at 9:26







          • 1




            @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
            – Thomas Guyot-Sionnest
            Nov 19 '14 at 2:18
















          • Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
            – Old Geezer
            Nov 18 '14 at 5:01










          • I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
            – Old Geezer
            Nov 18 '14 at 5:09











          • @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
            – Thomas Guyot-Sionnest
            Nov 18 '14 at 5:15










          • Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
            – Old Geezer
            Nov 18 '14 at 9:26







          • 1




            @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
            – Thomas Guyot-Sionnest
            Nov 19 '14 at 2:18















          Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
          – Old Geezer
          Nov 18 '14 at 5:01




          Thanks. wget -4 ... works, for all the times I tested. Are you saying that wget by default uses IPv6 first? BTW: the domain is on 1and1.
          – Old Geezer
          Nov 18 '14 at 5:01












          I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
          – Old Geezer
          Nov 18 '14 at 5:09





          I meet the same problem with 1and1's smtp server. In Python, smtplib.SMTP('smtp.1and1.com'), which instantiates the Smtp server, can't find the host three quarters of the time.
          – Old Geezer
          Nov 18 '14 at 5:09













          @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
          – Thomas Guyot-Sionnest
          Nov 18 '14 at 5:15




          @OldGeezer if -4 works, then likely there is a problem with the DNS server when resolving IPv6 addresses. You can check with dig AAAA <name> vs dig A <name>. On a good server you will see no answer to AAAA but you will see somewhere status: NOERROR. On a broken server you will see status: NXDOMAIN instead. The A lookup should return an ANSWER SECTION:. NXDomain must not be returned when there is a valid record of a different type for the name.
          – Thomas Guyot-Sionnest
          Nov 18 '14 at 5:15












          Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
          – Old Geezer
          Nov 18 '14 at 9:26





          Are you referring to the DNS server of my running client (which is the router firmware on the home network I am connected to) or the authoritative name server for that domain name?
          – Old Geezer
          Nov 18 '14 at 9:26





          1




          1




          @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
          – Thomas Guyot-Sionnest
          Nov 19 '14 at 2:18




          @OldGeezer I'm talking about the authoritative dns, but you may be able to get the answer from your local dns server too. It's true that if your local server cached an address already it may not show the behavior, but if you do an AAAA lookup on a clean cache you should see the NXDomain error there too. You can get the DNS servers from the parent domain with dig NS <domain>, and you can direct dns queries at those servers with: dig AAAA <name> @<nameserver> (no space between @ and the nameserver).
          – Thomas Guyot-Sionnest
          Nov 19 '14 at 2:18

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f168584%2fwget-is-unable-to-resolve-host-address-80-of-the-time%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