How to fix “wget: unable to resolve host address” issue

Posted In Network - By Tum. On Friday, May 31st, 2013 With 0 Comments

terminal bash shellถ้าหากใช้งาน wget แล้วเกิดปัญหาเรื่องการ resolve host เหมือน error ด้านล่าง

wget: unable to resolve host address domain.com

ตัวอย่าง

แนวทางการแก้ไขเบื้องต้นให้เราตรวจสอบดูว่า network ของเครื่องสามารถใช้งานได้หรือไม่เป็นอันดับแรก ด้วยคำสั่ง ping ดังตัวอย่าง

ถ้าหากว่าไม่สามารถ Ping ได้แสดงว่าเป็นปัญหาที่ network แต่ถ้า Ping ได้ แสดงว่าปัญหาเกิดจาก wget พยายามใช้งาน ipv6 ซึ่งเครื่องที่เกิดปัญหาไม่มีการใช้งาน ipv6 จึงทำให้ไม่สามารถใช้งานได้

วิธีการแก้ไขปัญหา wget: unable to resolve host address domain.com สามารถทำได้หลายวิธีดังนี้

  1. ใช้ option -4 หรือ –inet4-only เพื่อให้ wget ใช้งาน ipv4 ดังตัวอย่าง

    หรือ
  2. ทำการ map host กับ ip ที่ไฟล์ /etc/hosts ดังตัวอย่าง
  3. แก้ไขค่า config ของ wget โดยแก้ไขไฟล์ /etc/wgetrc และให้เพิ่ม parameter ด้านล่างลงไป

จากนั้นลองทดสอบใช้งานดูอีกครั้งครับ :)

Tags: , , ,

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*