My machine's local host IP address is 192.168.0.15, and I do loopback test on Windows 10.
I use two ping commands as follows, but both are failed (responsed by saying "PING: Transmit failed
General failure")
C:\> ping 192.168.0.15 -S 127.0.0.1
C:\> ping 127.0.0.1 -S 192.168.0.15
Can someone help explain that to me?
As far as I know, the loopback test is to make sure tcp/ip is working. So you would ping either 192.168.0.15 or 127.0.0.1. Pinging either of those and getting a response means tcp/ip is working. I've not seen the -S command used in this situation. Not saying the -S can't or shouldn't be used, I'm simply not familiar with the reasoning behind using the -S for this purpose. I'm open to learning something new though. : )
The use of "-S <srcaddr>" means to designate a specific source IP address of this icmp datagram.
Right. I understand the -S portion. My guess though is it's probably used when multiple IP addresses are assigned to the same NIC. Example if your NIC card had both 192.168.0.15 and 192.168.0.16 assigned, then the -S would make sense. 127.0.0.1 is not technically an assigned IP and that may be why you're getting the error. My only suggestion would be to set the IP assignment method for this NIC to static and assign it two different IPs as shown above. Then try pinging .15 when using .16 as the source.