others-How to solve the ping6 `connect: Invalid argument` or `Name or service not known` error?
1. Purpose
In this post , I would demonstrate how to solve the connect: Invalid argument
or Name or service not known
error when using ping6
command.
2. The solution
2.1 The command and the error
When I tried to ping an ipv6 address, I got this error:
[root@localhost kong]# ping6 fe80::aabc:31fd:cb76:e99a
connect: Invalid argument
And when I tried to ping an standard ipv6 address, I got this error:
[root@localhost kong]# ping6 fe80:0000:aabc:31fd:cb76:e99a
ping: fe80:0000:aabc:31fd:cb76:e99a: Name or service not known
2.2 The enviroment
Here is the environment:
[root@localhost kong]# ifconfig
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.2.3.111 netmask 255.255.255.0 broadcast 1.2.3.255
inet6 fe80::aabc:31fd:cb76:e99a prefixlen 64 scopeid 0x20<link>
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.3 What is ping6
The ping6 utility reports duplicate and damaged packets. Although they should never happen when pinging a unicast address, duplicate packets can occur in many situations and seem to be caused by inappropriate link-level retransmissions.
Ping6 is a tool to send ICMPv6 packet to check if an ipv6 address is available. ICMPv6 (Internet Control Message Protocol for the IPv6) is one of the basic protocols of IPv6. ICMPv6 has the ability to report to the source address error information and control information about the transmission of IPv6 packets to the destination. ICMPv6 defines some messages, such as: destination unreachable, data packet too long, timeout, response request and response response. In IPv6, in addition to the functions commonly used by ICMPv4, ICMPv6 has other functions, such as adjacency point discovery, stateless address configuration (including duplicate address detection), PMTUD and so on.
How to use ping6?
ping6 [-l size] [-n count] [-s sourceip] targetip
2.4 The solution to the error
[root@localhost kong]# ping6 fe80::aabc:31fd:cb76:e99a%ens32
PING fe80::aabc:31fd:cb76:e99a%ens32(fe80::aabc:31fd:cb76:e99a%ens32) 56 data bytes
64 bytes from fe80::aabc:31fd:cb76:e99a%ens32: icmp_seq=1 ttl=64 time=0.037 ms
64 bytes from fe80::aabc:31fd:cb76:e99a%ens32: icmp_seq=2 ttl=64 time=0.090 ms
64 bytes from fe80::aabc:31fd:cb76:e99a%ens32: icmp_seq=3 ttl=64 time=0.055 ms
%ens32 specifies which network card to send the request packet from.
3. Summary
In this post, I demonstrated how to solve the ping6 connect: Invalid argument
or Name or service not known
error . That’s it, thanks for your reading.