Ping
The Ping tool uses ICMP Echo messages to test network connectivity and measure round-trip delay between the router and target hosts. It is the most fundamental network diagnostic tool for verifying IP connectivity and diagnosing network issues.
Overview
Section titled “Overview”Ping operates by sending ICMP Echo Request packets to a target host and waiting for ICMP Echo Reply responses. The tool reports the success or failure of each packet, along with round-trip time statistics. This allows network administrators to quickly determine:
- Whether a host is reachable
- The latency to a target destination
- Packet loss percentage
- Path viability through the network
Basic Usage
Section titled “Basic Usage”Send ICMP echo requests to a target host:
/ping 10.0.0.1 count=10Output:
SEQ HOST SIZE TTL TIME STATUS 0 10.0.0.1 56 64 1ms 1 10.0.0.1 56 64 1ms 2 10.0.0.1 56 64 1ms ... sent=10 received=10 packet-loss=0% min-rtt=1ms avg-rtt=1ms max-rtt=2msProperties
Section titled “Properties”Core Parameters
Section titled “Core Parameters”| Property | Description |
|---|---|
| address | Target IP address or hostname to ping |
| count | Number of ping packets to send (default: unlimited until interrupted) |
| interval | Time between packets in seconds (default: 1s) |
| size | Packet size in bytes (default: 56 bytes) |
| ttl | Time-to-live value for outgoing packets |
| timeout | Wait time for replies in seconds |
Source and Routing Parameters
Section titled “Source and Routing Parameters”| Property | Description |
|---|---|
| src-address | Source IP address to use in outgoing packets |
| interface | Interface to send packets from |
| routing-table | Routing table to use for lookups |
| routing-mark | Firewall routing mark to match |
Advanced Parameters
Section titled “Advanced Parameters”| Property | Description |
|---|---|
| do-not-fragment | Set the DF (Don’t Fragment) flag |
| adaptive | Adapt interval to round-trip time |
| packet-loss-threshold | Percentage of packet loss that triggers logging |
| network | Limit to specific network for broadcast/multicast pings |
Examples
Section titled “Examples”Basic Connectivity Test
Section titled “Basic Connectivity Test”/ping 8.8.8.8 count=4Expected output:
SEQ HOST SIZE TTL TIME STATUS 0 8.8.8.8 56 64 10ms 1 8.8.8.8 56 64 11ms 2 8.8.8.8 56 64 10ms 3 8.8.8.8 56 64 11ms sent=4 received=4 packet-loss=0% min-rtt=10ms avg-rtt=10ms max-rtt=11msTest Through Specific Interface
Section titled “Test Through Specific Interface”/ping 10.0.0.1 interface=ether1 count=3Verify Gateway Failover
Section titled “Verify Gateway Failover”/ping 192.168.1.254 count=3/ping 10.0.0.1 routing-table=vpn count=3MTU Path Discovery
Section titled “MTU Path Discovery”/ping 10.0.0.1 size=1472 count=3/ping 10.0.0.1 size=1500 do-not-fragment=yes count=3If packets with size=1472 succeed but 1500 fails with “DF bit set”, there’s an MTU issue on the path.
Script-Based Monitoring
Section titled “Script-Based Monitoring”:local target "8.8.8.8":local count 3:local result [/ping $target count=$count];:if ($result = 0) do={ :log warning "Ping to $target failed - host unreachable"} else={ :log info "Ping to $target OK - $result replies received"}Ping Variants
Section titled “Ping Variants”IPv4 Ping
Section titled “IPv4 Ping”Standard IPv4 ICMP echo:
/ping 192.168.1.1 count=5 interval=2/ping 8.8.8.8 count=3IPv6 Ping
Section titled “IPv6 Ping”IPv6 ICMP echo requests use the /ping command with IPv6 addresses:
/ping 2001:db8::1 count=5/ping ff02::1%ether1 ; Multicast ping on local segmentDNS Name Resolution
Section titled “DNS Name Resolution”Ping by hostname to test DNS resolution:
/ping google.com count=4/ping mikrotik.com count=3Continuous Ping
Section titled “Continuous Ping”Run ping until interrupted (Ctrl+C):
/ping 10.0.0.1Finite Ping
Section titled “Finite Ping”Send a specific number of packets:
/ping 10.0.0.1 count=100Special Ping Types
Section titled “Special Ping Types”MAC Ping
Section titled “MAC Ping”Ping devices on the same broadcast domain using MAC addresses. This bypasses IP layer and communicates directly at layer 2.
First, enable the MAC ping server:
/tool mac-server ping set enabled=yesThen ping by MAC address:
/ping 00:0C:42:72:A1:B0To restrict to a specific interface:
/ping 00:0C:42:72:A1:B0%ether1Multicast Ping
Section titled “Multicast Ping”Send ICMP echo to multicast addresses to discover multiple responders:
/ping ff02::1 count=3- ff02::1 - IPv6 all-nodes multicast group (discovers all IPv6-enabled hosts on local segment)
- 224.0.0.1 - IPv4 all-hosts multicast group
This is useful for:
- Discovering all hosts on a local network segment
- Verifying multicast functionality
- Network inventory and discovery
Broadcast Ping
Section titled “Broadcast Ping”Ping a broadcast address to discover all responsive hosts:
/ping 192.168.1.255 count=2/ping 10.0.0.255 count=2Broadcast pinging may not work on all networks due to firewall configurations or switch ACLs.
Advanced Usage
Section titled “Advanced Usage”Custom Packet Size
Section titled “Custom Packet Size”Test path MTU and fragmentation behavior with custom packet sizes:
/ping 10.0.0.1 size=1472 count=10/ping 10.0.0.1 size=1500 do-not-fragment=yes count=5Source Address Specification
Section titled “Source Address Specification”Ping from a specific source IP:
/ping 10.0.0.1 src-address=192.168.1.100/ping 2001:db8::1 src-address=2001:db8::100Useful when the router has multiple IP addresses on different interfaces.
Interface-Specific Ping
Section titled “Interface-Specific Ping”Send packets from a specific interface:
/ping 10.0.0.1 interface=ether1/ping 192.168.1.1 interface=wlan1Routing Table Selection
Section titled “Routing Table Selection”Use a specific routing table:
/ping 10.0.0.1 routing-table=main/ping 8.8.8.8 routing-table=vpnAdaptive Ping
Section titled “Adaptive Ping”Adaptive mode adjusts interval based on round-trip time:
/ping 10.0.0.1 adaptive=yesTTL Specification
Section titled “TTL Specification”Set custom TTL to test specific hop behavior:
/ping 10.0.0.1 ttl=1/ping 192.168.1.100 ttl=64Troubleshooting with Ping
Section titled “Troubleshooting with Ping”Network Connectivity Test Sequence
Section titled “Network Connectivity Test Sequence”Follow this systematic approach to diagnose connectivity issues:
Step 1: Local Interface Test
Section titled “Step 1: Local Interface Test”Ping the router’s own interface to verify basic IP stack:
/ping 192.168.1.1 count=3Step 2: Directly Connected Host
Section titled “Step 2: Directly Connected Host”Ping a host on the same subnet:
/ping 192.168.1.10 count=3Step 3: Default Gateway
Section titled “Step 3: Default Gateway”Ping the default gateway:
/ping 192.168.1.254 count=3Step 4: Remote Host
Section titled “Step 4: Remote Host”Ping an external IP address:
/ping 8.8.8.8 count=3Step 5: DNS Resolution Test
Section titled “Step 5: DNS Resolution Test”Ping a domain name to test DNS:
/ping google.com count=3Interpreting Results
Section titled “Interpreting Results”Successful Response
Section titled “Successful Response” SEQ HOST SIZE TTL TIME STATUS 0 8.8.8.8 56 64 10ms- SEQ: Sequence number
- SIZE: Packet size in bytes
- TTL: Time-to-live received
- TIME: Round-trip time in milliseconds
- STATUS: Reply status
No Response (Packet Loss)
Section titled “No Response (Packet Loss)”If you see no replies with 100% packet loss:
/ping 10.0.0.1 count=5 sent=5 received=0 packet-loss=100% min-rtt=0ms avg-rtt=0ms max-rtt=0msCauses may include:
- Firewall blocking ICMP
- Host is offline
- Incorrect IP address
- Routing problem
- Network cable disconnected
Intermittent Responses
Section titled “Intermittent Responses”Partial packet loss indicates:
sent=10 received=7 packet-loss=30% min-rtt=5ms avg-rtt=12ms max-rtt=50ms- Congested link
- Unstable network connection
- Intermittent firewall drops
- Wireless interference
Common Error Patterns
Section titled “Common Error Patterns””no route to host”
Section titled “”no route to host””The router cannot find a route to the destination:
/ping 10.100.0.1Check routing table:
/ip route print“address unreachable”
Section titled ““address unreachable””The router knows how to reach the network but cannot:
/ip route print where dst-address=10.100.0.0/24Verify gateway is reachable and ARP is resolved.
High Latency
Section titled “High Latency”Latency over 100ms may indicate:
- Congested link
- Distance to remote host
- Network equipment processing delays
- Wireless hop interference
Monitoring and Automation
Section titled “Monitoring and Automation”Script Integration
Section titled “Script Integration”Use ping in scripts for monitoring:
:local target "8.8.8.8":local result [/ping $target count=3];:if ($result = 0) do={ :log warning "Ping to $target failed!"}Health Checks
Section titled “Health Checks”Regular ping monitoring:
/system scheduler add name=ping-gateway interval=1m on-event={ /ping 192.168.1.254 count=1}Netwatch
Section titled “Netwatch”Use Netwatch for automated host monitoring:
/tool netwatch add host=8.8.8.8 interval=30s timeout=1000ms \ up-script="/log info \"Host up\"" \ down-script="/log error \"Host down\""Performance Considerations
Section titled “Performance Considerations”ICMP Rate Limiting
Section titled “ICMP Rate Limiting”Some hosts or firewalls rate-limit ICMP responses. Increase interval:
/ping 10.0.0.1 interval=2 count=10Large Scale Pings
Section titled “Large Scale Pings”For scanning multiple hosts:
:for i from=1 to=254 do={ /ping 192.168.1.$i count=1}Impact on CPU
Section titled “Impact on CPU”Continuous ping with small intervals increases CPU load:
/ping 10.0.0.1 interval=0.1 ; High CPU usageRelated Commands
Section titled “Related Commands”/tool mac-server ping- MAC-level ping server configuration/tool traceroute- Path tracing to destination/tool mac-telnet- Connect via MAC address/tool ssh- Secure shell access/tool fetch- Transfer files over network