[opensuse] Why can not I ping an IPv6 host by name? Culprit is nscd!
Hi, Testing things. The name resolves, with both IPv4 and IPv6 addresses: cer@Telcontar:~> host Isengard Isengard.valinor has address 192.168.1.16 Isengard.valinor has IPv6 address fc00::16 cer@Telcontar:~> I can ping "normally": Telcontar:~ # ping -c 2 -v Isengard ping: socket: Permission denied, attempting raw socket... ping: socket: Permission denied, attempting raw socket... PING Isengard.valinor (192.168.1.16) 56(84) bytes of data. 64 bytes from Isengard.valinor (192.168.1.16): icmp_seq=1 ttl=64 time=0.309 ms 64 bytes from Isengard.valinor (192.168.1.16): icmp_seq=2 ttl=64 time=0.325 ms --- Isengard.valinor ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.309/0.317/0.325/0.008 ms Telcontar:~ # I can not ping by name if I force IPv6: Telcontar:~ # ping -c 2 -v -6 Isengard ping: socket: Permission denied, attempting raw socket... connect: Invalid argument Telcontar:~ # I can ping just fine by writing the IPv6 address, so there is connectivity: Telcontar:~ # ping -c 2 -v -6 fc00::16 ping: socket: Permission denied, attempting raw socket... PING fc00::16(fc00::16) 56 data bytes 64 bytes from fc00::16: icmp_seq=1 ttl=64 time=0.351 ms 64 bytes from fc00::16: icmp_seq=2 ttl=64 time=0.346 ms --- fc00::16 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1023ms rtt min/avg/max/mdev = 0.346/0.348/0.351/0.018 ms Telcontar:~ # Why? Using strace I get a clue. Telcontar:~ # strace -o ping.strace ping -6 -v Isengard.valinor ping: socket: Permission denied, attempting raw socket... connect: Invalid argument Telcontar:~ # execve("/usr/bin/ping", ["ping", "-6", "-v", "Isengard.valinor"], 0x7ffcb19d01e8 /* 68 vars */) = 0 brk(NULL) = 0x55f7e88b9000 ... futex(0x7fc5cd4419c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0 capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=1<<CAP_NET_RAW, inheritable=0}) = 0 capset({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=1<<CAP_NET_RAW, permitted=1<<CAP_NET_RAW, inheritable=0}) = 0 rt_sigprocmask(SIG_UNBLOCK, [ALRM], NULL, 8) = 0 rt_sigaction(SIGALRM, {sa_handler=0x55f7e6ab4810, sa_mask=[], sa_flags=SA_RESTORER|SA_INTERRUPT, sa_restorer=0x7fc5cd0c21e0}, NULL, 8) = 0 socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6) = -1 EACCES (Permission denied) write(2, "ping: socket: Permission denied,"..., 58) = 58 socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6) = 3 capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0 capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=1<<CAP_NET_RAW, permitted=1<<CAP_NET_RAW, inheritable=0}) = 0 capset({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=1<<CAP_NET_RAW, inheritable=0}) = 0 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0 sendto(4, "\2\0\0\0\r\0\0\0\6\0\0\0hosts\0", 18, MSG_NOSIGNAL, NULL, 0) = 18 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=4, revents=POLLIN|POLLHUP}]) recvmsg(4, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="hosts\0", iov_len=6}, {iov_base="\310O\3\0\0\0\0\0", iov_len=8}], msg_iovlen=2, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[5]}], msg_controllen=20, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 14 mmap(NULL, 217032, PROT_READ, MAP_SHARED, 5, 0) = 0x7fc5ce0b5000 close(5) = 0 close(4) = 0 socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP) = 4 connect(4, {sa_family=AF_INET6, sin6_port=htons(1025), inet_pton(AF_INET6, "fe80::4ecc:6aff:fe61:50a1", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 EINVAL (Invalid argument) write(2, "connect: Invalid argument\n", 26) = 26 exit_group(2) = ? +++ exited with 2 +++ It is trying to contact "fe80::4ecc:6aff:fe61:50a1" instead of what DNS answers. This is in /etc/hosts, so I edit it out - another problem now: Telcontar:~ # ping -c 2 -v -6 Isengard ping: socket: Permission denied, attempting raw socket... ping: Isengard: Name or service not known Telcontar:~ # execve("/usr/bin/ping", ["ping", "-6", "-v", "Isengard.valinor"], 0x7ffd8fe17238 /* 68 vars */) = 0 brk(NULL) = 0x55af0e17e000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) ... write(2, "ping: socket: Permission denied,"..., 58) = 58 socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6) = 3 capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = 0 capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=1<<CAP_NET_RAW, permitted=1<<CAP_NET_RAW, inheritable=0}) = 0 capset({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=1<<CAP_NET_RAW, inheritable=0}) = 0 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0 sendto(4, "\2\0\0\0\r\0\0\0\6\0\0\0hosts\0", 18, MSG_NOSIGNAL, NULL, 0) = 18 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=4, revents=POLLIN|POLLHUP}]) recvmsg(4, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="hosts\0", iov_len=6}, {iov_base="\310O\3\0\0\0\0\0", iov_len=8}], msg_iovlen=2, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[5]}], msg_controllen=20, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 14 mmap(NULL, 217032, PROT_READ, MAP_SHARED, 5, 0) = 0x7ffafb5aa000 close(5) = 0 close(4) = 0 socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 connect(4, {sa_family=AF_UNIX, sun_path="/var/run/nscd/socket"}, 110) = 0 sendto(4, "\2\0\0\0\16\0\0\0\21\0\0\0Isengard.valinor\0", 29, MSG_NOSIGNAL, NULL, 0) = 29 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=4, revents=POLLIN|POLLHUP}]) read(4, "\2\0\0\0\1\0\0\0\1\0\0\0\4\0\0\0\21\0\0\0\0\0\0\0", 24) = 24 read(4, "\300\250\1\20\2Isengard.valinor\0", 22) = 22 close(4) = 0 write(2, "ping: Isengard.valinor: Name or "..., 50) = 50 exit_group(2) = ? +++ exited with 2 +++ Why does it say the name is not known, when it is known? Telcontar:~ # host Isengard Isengard.valinor has address 192.168.1.16 Isengard.valinor has IPv6 address fc00::16 Telcontar:~ # host Isengard.valinor Isengard.valinor has address 192.168.1.16 Isengard.valinor But if I stop nscd it works! Telcontar:~ # systemctl restart nscd Telcontar:~ # host Isengard.valinor Isengard.valinor has address 192.168.1.16 Isengard.valinor has IPv6 address fc00::16 Telcontar:~ # ping -c 2 -v -6 Isengard ping: socket: Permission denied, attempting raw socket... ping: Isengard: Name or service not known Telcontar:~ # systemctl stop nscd Telcontar:~ # ping -c 2 -v -6 Isengard ping: socket: Permission denied, attempting raw socket... PING Isengard(Isengard6.valinor (fc00::16)) 56 data bytes 64 bytes from Isengard6.valinor (fc00::16): icmp_seq=1 ttl=64 time=0.323 ms 64 bytes from Isengard6.valinor (fc00::16): icmp_seq=2 ttl=64 time=0.327 ms --- Isengard ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1030ms rtt min/avg/max/mdev = 0.323/0.325/0.327/0.002 ms Telcontar:~ # -- Cheers / Saludos, Carlos E. R. (from 15.0 x86_64 at Telcontar)
participants (1)
-
Carlos E. R.