How is the source IP address of ping packets specified

4

The -a parameter specifies the source IP address of ping packets.

If -a is not specified, the system searches for the outbound interface mapping the destination IP address in the routing table and uses the outbound interface's IP address as the source IP address of ping packets.

If there are equal-cost routes to the destination IP address, the system performs the hash algorithm based on the destination IP address, protocol number, ICMP type, and ICMP mode and selects the outbound interface's IP address as the source IP address of ping packets.

Other related questions:
How can an S series switch ping another device using ping packets carrying a specified source IP address
For S series switches (except the S1700), you can specify the source IP address of ping packets by specifying the -a source-ip-address parameter in the ping command. For example, set the source and destination IP addresses of ping packets to 192.168.150.107 and 10.135.19.157, respectively. [HUAWEI] ping -a 192.168.150.107 10.135.19.157

An S series switch fails to ping the remote device using ping packets carrying the source IP address. Why the ping succeeds after the source IP address is changed
For S series switches (except the S1700), the possible reason why the ping succeeds after the source IP address is changed is that the remote device does not have a return route to send response packets. If the ping succeeds after you change the source IP address or do not specify any source IP address in the ping command, you need to check whether the remote device has a return route.

How to locate the ping failure
When the ping operation fails, locate the fault based on the following troubleshooting roadmap: 1. Check whether the AR interface is Up and whether the IP address is configured correctly. Command: display interface brief and display ip interface [ < interface-type > < interface-number > ] 2. If a Layer 2 interface is used, check whether STP is running on the AR and check whether the physical interface where ping packets pass is blocked. Command: display stp [ instance < instance-id > ] [ interface < interface-type > < interface-number > ] [ brief ] 3. Check whether routes are reachable: If routes are unreachable, troubleshoot the fault. Command: display ip routing-table 4. Check whether policies are configured on local and remote devices. If the remote device is a firewall, check whether the remote interface is added to a zone and whether the inter-zone rule is enabled. 5. Check whether ARP entries of the direct route are learned correctly. If ARP entries cannot be learned, check whether strict ARP learning is enabled. Disable strict ARP learning and try again. If the fault persists, perform the ping operation on one device and check whether ARP request packets are sent out from the interface and whether the remote device sends ARP reply packets based on ARP packet statistics. Commands: display arp and display arp learning strict 6. If there is no preceding problem, collect statistics on ICMP packets, determine the position where packets are lost and locate the packet loss point.

How to limit the specified source or destination address to access the network
You can configure an ACL to match the source or destination address. If the host with the source IP address of 10.1.1.1 is required to access only the host on network segment 10.1.1.18/26, the configuration is as follows: For details on how to configure a traffic classifiers, behaviors (action is set to permit), and traffic policies, see MQC Configuration in AR CLI-based Configuration Guide - QoS.

Can an S series switches forward a packet if both the source and destination IP addresses of the packet are multicast addresses
The S5710-C-LI or S5700SI drops packets whose source and destination IP addresses are both multicast addresses. Other switches broadcast such packets in a VLAN.

If you have more questions, you can seek help from following ways:
To iKnow To Live Chat
Scroll to top