มีปัญหา Resolve hostname ไม่ได้ ช้วยดูให้ทีครับ

ไม่แน่ใจปัญหาอยู่ที่ไหน งงไปหมดล่ะ

ไฟล์ /etc/resolve.conf


[FONT=Menlo]# cat /etc/resolv.conf[/FONT]
[FONT=Menlo]nameserver 8.8.8.8[/FONT]
[FONT=Menlo]nameserver 8.8.4.4[/FONT]

ลองเทส nslookup

[FONT=Menlo]# nslookup yahoo.com[/FONT]
[FONT=Menlo]Server:        8.8.8.8[/FONT]
[FONT=Menlo]Address:    8.8.8.8#53[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]Non-authoritative answer:[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 206.190.36.45[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 98.139.183.24[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 98.138.253.109[/FONT]

ลองเทส hostname

[FONT=Menlo]# host yahoo.com[/FONT]
[FONT=Menlo];; Truncated, retrying in TCP mode.[/FONT]
[FONT=Menlo]yahoo.com has address 206.190.36.45[/FONT]
[FONT=Menlo]yahoo.com has address 98.138.253.109[/FONT]
[FONT=Menlo]yahoo.com has address 98.139.183.24[/FONT]
[FONT=Menlo]yahoo.com has IPv6 address 2001:4998:c:a06::2:4008[/FONT]
[FONT=Menlo]yahoo.com has IPv6 address 2001:4998:58:c02::a9[/FONT]
[FONT=Menlo]yahoo.com has IPv6 address 2001:4998:44:204::a7[/FONT]
[FONT=Menlo]yahoo.com mail is handled by 1 mta6.am0.yahoodns.net.[/FONT]
[FONT=Menlo]yahoo.com mail is handled by 1 mta5.am0.yahoodns.net.[/FONT]
[FONT=Menlo]yahoo.com mail is handled by 1 mta7.am0.yahoodns.net.[/FONT]

ลองเทส dig

[FONT=Menlo]# dig yahoo.com[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.el6_7.4 <<>> yahoo.com[/FONT]
[FONT=Menlo];; global options: +cmd[/FONT]
[FONT=Menlo];; Got answer:[/FONT]
[FONT=Menlo];; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65469[/FONT]
[FONT=Menlo];; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo];; QUESTION SECTION:[/FONT]
[FONT=Menlo];yahoo.com.            IN    A[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo];; ANSWER SECTION:[/FONT]
[FONT=Menlo]yahoo.com.        1753    IN    A    206.190.36.45[/FONT]
[FONT=Menlo]yahoo.com.        1753    IN    A    98.138.253.109[/FONT]
[FONT=Menlo]yahoo.com.        1753    IN    A    98.139.183.24[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo];; Query time: 38 msec[/FONT]
[FONT=Menlo];; SERVER: 8.8.8.8#53(8.8.8.8)[/FONT]
[FONT=Menlo];; WHEN: Sun Nov 15 14:19:09 2015[/FONT]
[FONT=Menlo];; MSG SIZE  rcvd: 75[/FONT]

แบบนี้น่าจะแปลว่า name server ทำงานถูกแล้ว
แต่มันกลับ resolve hostname จาก app ต่างๆ ไม่ได้เช่น

app ping

[FONT=Menlo]# ping yahoo.com[/FONT]
[FONT=Menlo]ping: unknown host yahoo.com[/FONT]

app ftp

[FONT=Menlo]# ftp yahoo.com[/FONT]
[FONT=Menlo]ftp: yahoo.com: Temporary failure in name resolution[/FONT]
[FONT=Menlo]ftp> [/FONT]

app tracpath

[FONT=Menlo]# tracepath yahoo.com[/FONT]
[FONT=Menlo]gethostbyname2: Host name lookup failure[/FONT]

หรือกระทั่ง app yum

[FONT=Menlo]# yum update -y[/FONT]
[FONT=Menlo]Loaded plugins: fastestmirror, refresh-packagekit[/FONT]
[FONT=Menlo]Setting up Update Process[/FONT]
[FONT=Menlo]Determining fastest mirrors[/FONT]
[FONT=Menlo]Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was[/FONT]
[FONT=Menlo]14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"[/FONT]
[FONT=Menlo]Error: Cannot find a valid baseurl for repo: base[/FONT]

แบบนี้ต้องแก้ปัญหา ที่ไหนครับ

ขอบคุณครับ

ขอดู /etc/sysconfig/network-scrtips/ifcfg-ethX หน่อยครับ

กรณีนี้อาจจะเน่าที่ dns แถวๆนั้น แล้วก็ลอง ping 8.8.8.8, 8.8.4.4 หน่อยครับติดมั้ย

ถ้าไม่ติด ลองดู default-gateway อะครับ ใส่ถูกมั้ย

ถูกครับผม สามารถ ping ออกผ่าน ip ได้ และตามด้านบนคือ nslookup ไปถามกับ server 8.8.8.8 ได้ ครับ


[FONT=Menlo]ping -c 4 8.8.8.8[/FONT]
[FONT=Menlo]PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.[/FONT]
[FONT=Menlo]64 bytes from 8.8.8.8: icmp_seq=1 ttl=45 time=37.2 ms[/FONT]
[FONT=Menlo]64 bytes from 8.8.8.8: icmp_seq=2 ttl=45 time=37.1 ms[/FONT]
[FONT=Menlo]64 bytes from 8.8.8.8: icmp_seq=3 ttl=45 time=37.1 ms[/FONT]
[FONT=Menlo]64 bytes from 8.8.8.8: icmp_seq=4 ttl=45 time=37.1 ms[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]--- 8.8.8.8 ping statistics ---[/FONT]
[FONT=Menlo]4 packets transmitted, 4 received, 0% packet loss, time 3041ms[/FONT]
[FONT=Menlo]rtt min/avg/max/mdev = 37.133/37.163/37.201/0.237 ms[/FONT]

os / version อะไรครับ

Centos 6.7 ครับ

ลองดูผลลัพธ์นี้หน่อยครับ

strace ping -c 1 yahoo.com 2>&1 | egrep ‘connect|open’

ไม่มีอะไรเกิดขึ้นครับ


[FONT=Menlo]# strace ping -c 1 yahoo.com 2>&1 | egrep 'connect|open'[/FONT]
[FONT=Menlo]#[/FONT]

[COLOR=#333333]# strace ping -c 1 yahoo.com

ละครับ[/COLOR]

[FONT=Menlo]แง่ว :154218d4:

strace ping -c 1 yahoo.com[/FONT]

[FONT=Menlo]bash: strace: command not found
[/FONT]

อ้าว เอามาลงสิครับ

yum -y install strace

มันลงไม่ได้ครับผม เพราะว่า เวลามันไปอ่าน repo มันก้อต้อง connect ออกข้างนอก ผ่าน [FONT=Menlo]mirrorlist.centos.org[/FONT] ซึ่งมัน resolve hostname ไม่ได้ จึง connect ออกไปไม่ได้น่ะครับ

:154218d4:

ใส่ fix url เข้าไปใน yum repo (/etc/yum.repos.d/CentOS-Base.repo) เลยครับ

หรือไม่ก็ไปโหลด strace rpm มาจาก repo ที่นึง เช่น http://rpmfind.net/linux/rpm2html/search.php?query=strace

คำสั่ง [FONT=Menlo]strace ping -c 1 yahoo.com
[/FONT]

[FONT=Menlo]# strace ping -c 1 yahoo.com[/FONT]
[FONT=Menlo]execve("/bin/ping", ["ping", "-c", "1", "yahoo.com"], [/* 22 vars */]) = 0[/FONT]
[FONT=Menlo]brk(0)                                  = 0x7f2d26fa4000[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25ca2000[/FONT]
[FONT=Menlo]access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)[/FONT]
[FONT=Menlo]open("/etc/ld.so.cache", O_RDONLY)      = 3[/FONT]
[FONT=Menlo]fstat(3, {st_mode=S_IFREG|0644, st_size=43365, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 43365, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2d25c97000[/FONT]
[FONT=Menlo]close(3)                                = 0[/FONT]
[FONT=Menlo]open("/lib64/libidn.so.11", O_RDONLY)   = 3[/FONT]
[FONT=Menlo]read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0/\0\0\0\0\0\0"..., 832) = 832[/FONT]
[FONT=Menlo]fstat(3, {st_mode=S_IFREG|0755, st_size=206672, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 2301768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d25852000[/FONT]
[FONT=Menlo]mprotect(0x7f2d25884000, 2093056, PROT_NONE) = 0[/FONT]
[FONT=Menlo]mmap(0x7f2d25a83000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x31000) = 0x7f2d25a83000[/FONT]
[FONT=Menlo]close(3)                                = 0[/FONT]
[FONT=Menlo]open("/lib64/libc.so.6", O_RDONLY)      = 3[/FONT]
[FONT=Menlo]read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\356\1\0\0\0\0\0"..., 832) = 832[/FONT]
[FONT=Menlo]fstat(3, {st_mode=S_IFREG|0755, st_size=1920936, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 3750152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2d254be000[/FONT]
[FONT=Menlo]mprotect(0x7f2d25648000, 2097152, PROT_NONE) = 0[/FONT]
[FONT=Menlo]mmap(0x7f2d25848000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x7f2d25848000[/FONT]
[FONT=Menlo]mmap(0x7f2d2584d000, 18696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d2584d000[/FONT]
[FONT=Menlo]close(3)                                = 0[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25c96000[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25c95000[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25c94000[/FONT]
[FONT=Menlo]arch_prctl(ARCH_SET_FS, 0x7f2d25c95700) = 0[/FONT]
[FONT=Menlo]mprotect(0x7f2d25848000, 16384, PROT_READ) = 0[/FONT]
[FONT=Menlo]mprotect(0x7f2d25ca3000, 4096, PROT_READ) = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25c97000, 43365)           = 0[/FONT]
[FONT=Menlo]brk(0)                                  = 0x7f2d26fa4000[/FONT]
[FONT=Menlo]brk(0x7f2d26fc5000)                     = 0x7f2d26fc5000[/FONT]
[FONT=Menlo]open("/usr/lib/locale/locale-archive", O_RDONLY) = 3[/FONT]
[FONT=Menlo]fstat(3, {st_mode=S_IFREG|0644, st_size=99158576, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 99158576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2d1f62d000[/FONT]
[FONT=Menlo]close(3)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = 3[/FONT]
[FONT=Menlo]getuid()                                = 0[/FONT]
[FONT=Menlo]setuid(0)                               = 0[/FONT]
[FONT=Menlo]getpid()                                = 20722[/FONT]
[FONT=Menlo]open("/etc/resolv.conf", O_RDONLY)      = 4[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0644, st_size=307, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25ca1000[/FONT]
[FONT=Menlo]read(4, "options single-request
# Generat"..., 4096) = 307[/FONT]
[FONT=Menlo]read(4, "", 4096)                       = 0[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25ca1000, 4096)            = 0[/FONT]
[FONT=Menlo]socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]open("/etc/nsswitch.conf", O_RDONLY)    = 4[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0644, st_size=1688, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25ca1000[/FONT]
[FONT=Menlo]read(4, "#
# /etc/nsswitch.conf
#
# An ex"..., 4096) = 1688[/FONT]
[FONT=Menlo]read(4, "", 4096)                       = 0[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25ca1000, 4096)            = 0[/FONT]
[FONT=Menlo]open("/etc/ld.so.cache", O_RDONLY)      = 4[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0644, st_size=43365, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 43365, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f2d25c97000[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]open("/lib64/libnss_files.so.2", O_RDONLY) = 4[/FONT]
[FONT=Menlo]read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360!\0\0\0\0\0\0"..., 832) = 832[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0755, st_size=65928, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 2151824, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f2d1f41f000[/FONT]
[FONT=Menlo]mprotect(0x7f2d1f42b000, 2097152, PROT_NONE) = 0[/FONT]
[FONT=Menlo]mmap(0x7f2d1f62b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0xc000) = 0x7f2d1f62b000[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]mprotect(0x7f2d1f62b000, 4096, PROT_READ) = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25c97000, 43365)           = 0[/FONT]
[FONT=Menlo]open("/etc/host.conf", O_RDONLY)        = 4[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0644, st_size=9, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25ca1000[/FONT]
[FONT=Menlo]read(4, "multi on
", 4096)             = 9[/FONT]
[FONT=Menlo]read(4, "", 4096)                       = 0[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25ca1000, 4096)            = 0[/FONT]
[FONT=Menlo]open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 4[/FONT]
[FONT=Menlo]fcntl(4, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0644, st_size=235, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d25ca1000[/FONT]
[FONT=Menlo]read(4, "#127.0.0.1   localhost localhost"..., 4096) = 235[/FONT]
[FONT=Menlo]read(4, "", 4096)                       = 0[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25ca1000, 4096)            = 0[/FONT]
[FONT=Menlo]open("/etc/ld.so.cache", O_RDONLY)      = 4[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0644, st_size=43365, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 43365, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f2d25c97000[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]open("/lib64/libnss_dns.so.2", O_RDONLY) = 4[/FONT]
[FONT=Menlo]read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\20\0\0\0\0\0\0"..., 832) = 832[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0755, st_size=27424, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 2117880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f2d1f219000[/FONT]
[FONT=Menlo]mprotect(0x7f2d1f21e000, 2093056, PROT_NONE) = 0[/FONT]
[FONT=Menlo]mmap(0x7f2d1f41d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x4000) = 0x7f2d1f41d000[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]open("/lib64/libresolv.so.2", O_RDONLY) = 4[/FONT]
[FONT=Menlo]read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\00009\0\0\0\0\0\0"..., 832) = 832[/FONT]
[FONT=Menlo]fstat(4, {st_mode=S_IFREG|0755, st_size=110960, ...}) = 0[/FONT]
[FONT=Menlo]mmap(NULL, 2202248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7f2d1efff000[/FONT]
[FONT=Menlo]mprotect(0x7f2d1f015000, 2097152, PROT_NONE) = 0[/FONT]
[FONT=Menlo]mmap(0x7f2d1f215000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x16000) = 0x7f2d1f215000[/FONT]
[FONT=Menlo]mmap(0x7f2d1f217000, 6792, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2d1f217000[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]mprotect(0x7f2d1f215000, 4096, PROT_READ) = 0[/FONT]
[FONT=Menlo]mprotect(0x7f2d1f41d000, 4096, PROT_READ) = 0[/FONT]
[FONT=Menlo]munmap(0x7f2d25c97000, 43365)           = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "\2508\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 27, MSG_NOSIGNAL, NULL, 0) = 27[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [27])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "\2508\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 27[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "\2508\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 27, MSG_NOSIGNAL, NULL, 0) = 27[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [27])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "\2508\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, [16]) = 27[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "\2508\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 27, MSG_NOSIGNAL, NULL, 0) = 27[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [27])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "\2508\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 27[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "\2508\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 27, MSG_NOSIGNAL, NULL, 0) = 27[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [27])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "\2508\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\0\0\1\0\1", 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, [16]) = 27[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "n[\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 38, MSG_NOSIGNAL, NULL, 0) = 38[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [38])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "n[\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 38[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "n[\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 38, MSG_NOSIGNAL, NULL, 0) = 38[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [38])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "n[\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, [16]) = 38[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "n[\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 38, MSG_NOSIGNAL, NULL, 0) = 38[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [38])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "n[\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, [16]) = 38[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLOUT}], 1, 0)    = 1 ([{fd=4, revents=POLLOUT}])[/FONT]
[FONT=Menlo]sendto(4, "n[\1\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 38, MSG_NOSIGNAL, NULL, 0) = 38[/FONT]
[FONT=Menlo]poll([{fd=4, events=POLLIN}], 1, 5000)  = 1 ([{fd=4, revents=POLLIN}])[/FONT]
[FONT=Menlo]ioctl(4, FIONREAD, [38])                = 0[/FONT]
[FONT=Menlo]recvfrom(4, "n[\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co"..., 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, [16]) = 38[/FONT]
[FONT=Menlo]close(4)                                = 0[/FONT]
[FONT=Menlo]write(2, "ping: unknown host yahoo.com
", 29ping: unknown host yahoo.com[/FONT]
[FONT=Menlo]) = 29[/FONT]
[FONT=Menlo]exit_group(2)                           = ?[/FONT]
[FONT=Menlo]+++ exited with 2 +++
[/FONT]#

[FONT=Menlo]

คำสั่ง strace ping -c 1 yahoo.com 2>&1 | egrep ‘connect|open’

# strace ping -c 1 yahoo.com 2>&1 | egrep 'connect|open'

[/FONT]


[FONT=Menlo]open("/etc/ld.so.cache", O_RDONLY)      = 3[/FONT]
[FONT=Menlo]open("/lib64/libidn.so.11", O_RDONLY)   = 3[/FONT]
[FONT=Menlo]open("/lib64/libc.so.6", O_RDONLY)      = 3[/FONT]
[FONT=Menlo]open("/usr/lib/locale/locale-archive", O_RDONLY) = 3[/FONT]
[FONT=Menlo]open("/etc/resolv.conf", O_RDONLY)      = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)[/FONT]
[FONT=Menlo]open("/etc/nsswitch.conf", O_RDONLY)    = 4[/FONT]
[FONT=Menlo]open("/etc/ld.so.cache", O_RDONLY)      = 4[/FONT]
[FONT=Menlo]open("/lib64/libnss_files.so.2", O_RDONLY) = 4[/FONT]
[FONT=Menlo]open("/etc/host.conf", O_RDONLY)        = 4[/FONT]
[FONT=Menlo]open("/etc/hosts", O_RDONLY|O_CLOEXEC)  = 4[/FONT]
[FONT=Menlo]open("/etc/ld.so.cache", O_RDONLY)      = 4[/FONT]
[FONT=Menlo]open("/lib64/libnss_dns.so.2", O_RDONLY) = 4[/FONT]
[FONT=Menlo]open("/lib64/libresolv.so.2", O_RDONLY) = 4[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")}, 16) = 0[/FONT]
[FONT=Menlo]connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0[/FONT]
[FONT=Menlo]# [/FONT]

grep hosts /etc/nsswitch.conf

อีกนิดครับ

บรรทัด hosts: ควรจะประมาณนี้

hosts: files dns

(ถ้ามี [NOTFOUND=return] ให้เอาออก)

อ่อ อันนี้ ตอนแรกก็เป็น files dns นี่แล่ะครับ แต่มันก็ resolve ไม่ได้

ผมก้อเลย เอา files ออก เหลือไว้ให้ไปถามจาก dns อย่างเดียว มันก็ผลเหมือนกัน คือ resolve ไม่ได้อยู่ดี

ถ้ามั่นใจ nsswitch แล้ว

จากผล strace บรรทัดพวกนี้

[FONT=Menlo]recvfrom(4, “n[\203\0\0\1\0\0\0\0\0\0\5yahoo\3com\6luktao\3co”…, 1024, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr(“8.8.8.8”)}, [16]) = 38

ผลที่ส่งคืนมามันแปลกๆ
[/FONT]
กำลังสงสัยว่า ipv6 หรือเปล่า ลอง disable ipv6 มั้ยครับ

disable ipv6 ละครับ ยังไม่หาย เพลียใจหาเหตุ ไม่เจอ :154218d4:


[FONT=Menlo]# ping yahoo.com[/FONT]
[FONT=Menlo]ping: unknown host yahoo.com
[/FONT]
[FONT=Menlo]# nslookup yahoo.com[/FONT]
[FONT=Menlo];; Truncated, retrying in TCP mode.[/FONT]
[FONT=Menlo]Server:        8.8.8.8[/FONT]
[FONT=Menlo]Address:    8.8.8.8#53[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]Non-authoritative answer:[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 206.190.36.45[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 98.139.183.24[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 98.138.253.109[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]#[/FONT]

  • ที่เครื่องตัวเอง ลองปิด iptables ดูแล้วยังครับ?
  • server อยู่หลัง firewall อะไรรึเปล่าครับ?

อาการเหมือนจะมีการ block udp ไว้ tool พวก nslookup / host / dig มัน fallback ไปใช้ tcp ได้เลยไม่มีปัญหา แต่ libc มันใช้ tcp อย่างเดียวเลยเน่า

iptable ปิดเรียบร้อยครับ และไม่ได้อยู่หลัง firewall ครับ

edit : Truncated, retrying in TCP mode
เพราะ ผมไปแก้ไฟล์ nsswitch.conf จาก

hosts: files dns

เป็น

hosts: dns

บังคับให้มันไปถามจาก dns อย่างเดียวน่ะครับ พอเอา files กลับเข้ามา คำว่า Truncated, retrying in TCP mode มันก็หาย

[FONT=Menlo][root@mail ~]# iptables -L[/FONT]
[FONT=Menlo]Chain INPUT (policy ACCEPT)[/FONT]
[FONT=Menlo]target     prot opt source               destination         [/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]Chain FORWARD (policy ACCEPT)[/FONT]
[FONT=Menlo]target     prot opt source               destination         [/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]Chain OUTPUT (policy ACCEPT)[/FONT]
[FONT=Menlo]target     prot opt source               destination         [/FONT]
[FONT=Menlo]
# ping yahoo.com[/FONT]
[FONT=Menlo]ping: unknown host yahoo.com[/FONT]
[FONT=Menlo]
# nslookup yahoo.com[/FONT]
[FONT=Menlo];; Truncated, retrying in TCP mode.[/FONT]
[FONT=Menlo]Server:        8.8.8.8[/FONT]
[FONT=Menlo]Address:    8.8.8.8#53[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]Non-authoritative answer:[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 98.138.253.109[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 206.190.36.45[/FONT]
[FONT=Menlo]Name:    yahoo.com[/FONT]
[FONT=Menlo]Address: 98.139.183.24[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]#[/FONT]

isp/idc อะไรครับ ลองคุยกับทาง idc ดูละยัง

คืออาการค่อนข้างชัดว่ามีปัญหากับ udp มันเลยมีบรรทัดนี้โผล่ขึ้นมาครับ

[B]> ;; Truncated, retrying in TCP mode.[/B]