juniper_junos_ping

Execute ping from a Junos device

New in version 2.0.0.

Synopsis

  • Execute the ping command from a Junos device to a specified destination in order to test network reachability from the Junos device .

Requirements

The following software packages must be installed on hosts that execute this module:

Module-specific Options

The following options may be specified for this module:

parameter type required default choices comments
acceptable_percent_loss
int no 0
Maximum percentage of packets that may be lost and still consider the task not to have failed.

aliases: acceptable_packet_loss
count
int no 5
Number of packets to send.
dest
str yes none
The IP address, or hostname if DNS is configured on the Junos device, used as the destination of the ping.

aliases: dest_ip, dest_host, destination, destination_ip, destination_host
do_not_fragment
bool no False
  • yes
  • no
Set Do Not Fragment bit on ping packets.
interface
str no none
The source interface from which the the ping is sent. If not specified, the default Junos algorithm for determining the source interface is used.
rapid
bool no True
  • yes
  • no
Send ping requests rapidly
routing_instance
str no none
Name of the source routing instance from which the ping is originated. If not specified, the default routing instance is used.
size
int no none (default size for device)
The size of the ICMP payload of the ping.
Total size of the IP packet is size + the 20 byte IP header + the 8 byte ICMP header. Therefore, size of 1472 generates an IP packet of size 1500.
source
str no none
The IP address, or hostname if DNS is configured on the Junos device, used as the source address of the ping. If not specified, the Junos default algorithm for determining the source address is used.

aliases: source_ip, source_host, src, src_ip, src_host
ttl
int no none (default ttl for device)
Maximum number of IP routers (hops) allowed between source and destination.

Examples

---
- name: Examples of juniper_junos_ping
  hosts: junos-all
  connection: local
  gather_facts: no
  roles:
    - Juniper.junos

  tasks:
    - name: Ping 192.68.1.1 with default parameters. Fails if any packets lost.
      juniper_junos_ping:
        dest: "192.68.1.1"

    - name: Ping 192.68.1.1 Allow 50% packet loss. Register response.
      juniper_junos_ping:
        dest: "192.68.1.1"
        acceptable_percent_loss: 50
      register: response
    - name: Print all keys in the response.
      debug:
        var: response

    - name: Ping 192.68.1.1. Send 20 packets. Register response.
      juniper_junos_ping:
        dest: "192.68.1.1"
        count: 20
      register: response
    - name: Print packet sent from the response.
      debug:
        var: response.packets_sent

    - name: Ping 192.68.1.1. Send 10 packets wihtout rapid. Register response.
      juniper_junos_ping:
        dest: "192.68.1.1"
        count: 10
        rapid: false
      register: response
    - name: Print the average round-trip-time from the response.
      debug:
        var: response.rtt_average

    - name: Ping www.juniper.net with ttl 15. Register response.
      juniper_junos_ping:
        dest: "www.juniper.net"
        ttl: 15
      register: response
    - name: Print the packet_loss percentage from the response.
      debug:
        var: response.packet_loss

    - name: Ping 192.68.1.1 with IP packet size of 1500. Register response.
      juniper_junos_ping:
        dest: "192.68.1.1"
        size: 1472
      register: response
    - name: Print the packets_received from the response.
      debug:
        var: response.packets_received

    - name: Ping 192.68.1.1 with do-not-fragment bit set. Register response.
      juniper_junos_ping:
        dest: "192.68.1.1"
        do_not_fragment: true
      register: response
    - name: Print the maximum round-trip-time from the response.
      debug:
        var: response.rtt_maximum

    - name: Ping 192.68.1.1 with source set to 192.68.1.2. Register response.
      juniper_junos_ping:
        dest: "192.68.1.1"
        source: "192.68.1.2"
      register: response
    - name: Print the source from the response.
      debug:
        var: response.source

    - name: Ping 192.168.1.1 from the red routing-instance.
      juniper_junos_ping:
        dest: "192.168.1.1"
        routing_instance: "red"

    - name: Ping the all-hosts multicast address from the ge-0/0/0.0 interface
      juniper_junos_ping:
        dest: "224.0.0.1"
        interface: "ge-0/0/0.0"

Notes

Note

  • The NETCONF system service must be enabled on the target Junos device.

Author

  • Juniper Networks - Stacy Smith (@stacywsmith)

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.