[tips] Ubuntu Tidak Bisa Ping Tapi Bisa Nslookup

Pernah mengalami host Ubuntu tidak bisa ping ke mana pun, padahal kita bisa browse ke mana pun?

Jadi ketika saya coba ping (di /etc/resolv.conf sudah saya isikan nameserver 8.8.8.8 dan 8.8.4.4) hasilnya:

# ping detik.com
 ping: detik.com: Name or service not known

Tapi ketika menjalankan nslookup:

# nslookup
 > detik.com
 ;; Got recursion not available from 8.8.8.8, trying next server
 Server: 8.8.4.4
 Address: 8.8.4.4#53

Non-authoritative answer:
 Name: detik.com
 Address: 203.190.242.211
 Name: detik.com
 Address: 103.49.221.211

Hal ini sangat mengganggu kegiatan di shell prompt. Tapi setelah ke sana ke mari, akhirnya ketemu permasalahannya. Jika kita check file /etc/nsswitch.conf, kemungkinan kita akan mendapati baris:

hosts:          files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns

Jika iya, edit baris tersebut menjadi:

hosts:          files dns

Lalu untuk memastikan tidak terjadi lagi hal seperti di atas, kita bisa menghapus libnss-mdns:

# apt-get remove libnss-mdns --purge
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following packages will be REMOVED:
 libnss-mdns*
 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
 After this operation, 110 kB disk space will be freed.
 Do you want to continue? [Y/n]

Nah sekarang ping ke mana pun sudah tidak ada masalah:

# ping detik.com -c3
 PING detik.com (103.49.221.211) 56(84) bytes of data.
 64 bytes from 103.49.221.211 (103.49.221.211): icmp_seq=1 ttl=57 time=27.6 ms
 64 bytes from 103.49.221.211 (103.49.221.211): icmp_seq=2 ttl=57 time=27.1 ms
 64 bytes from 103.49.221.211 (103.49.221.211): icmp_seq=3 ttl=57 time=29.1 ms

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>