Cisco IOS IP SLA Traffic Generator

IP SLA is a great tool that you can use to make things like static routing more reliable but did you know you can also use it as a traffic generator?

When you configure IP SLA with the correct number of packets and payload sizes, you can use it to create certain traffic streams. This can be very useful when you want to practice QoS since you don’t have to mess around with traffic generator tools.

Before we look at the configuration, let’s do some calculations. Imagine we want to send 16 kbps of traffic from one router to another over Ethernet. How many packets should we send and what should the payload size be? Let’s take a look at the different header sizes first:

Ethernet Ip Udp Payload Sizes

Here is an example of a frame, an Ethernet header has 14 bytes, IP is 20 bytes and UDP is 8 bytes.

Calculate total frame size

Total frame size = L2 header + L3 header + L4 header + payload

My routers will be connected using Ethernet so that’s 14 bytes. IP adds another 20 bytes and UDP requires 8 bytes. The reason that I use UDP is that I will configure IP SLA to use UDP jitter.

14 + 20 + 8 = 42 bytes.

To keep the calculation simple, I’ll use a payload of 58 bytes so that the total packet will be 42 + 58 = 100 bytes.

Calculate Bandwidth

Bandwidth = frame size x number of packets

We know our frame size is 100 bytes so how many packets should we send per second? Our goal is to generate 16 kbps of traffic, that’s 16.000 bits per second. This is how we calculate it:

Number of packets = bandwidth / frame size

Before we can do this, we need to convert our 16.000 bits to bytes:

16.000 bits / 8 = 2000 bytes.

Our packet size is 100 bytes and we need 2000 bytes per second to reach 16 kbps:

2000 / 100 = 20

We need to send 20 packets per second with a frame size of 100 bytes to hit 16 kbps!

So far so good? Let’s start the configuration…


To demonstrate IP SLA we will use two routers connected to each other with Ethernet, R1 and R2:

R1 R2

Let’s start with the configuration of R1:

ip sla 1
 udp-jitter 17001 num-packets 20
 request-data-size 58
 threshold 500
 timeout 500
 frequency 1
ip sla schedule 1 life forever start-time now

As calculated we will send 20 packets per second with a payload size of 58. This will be good for 16 kbps but I will show you how to verify this in a bit. I used destination port 17002 (pick whatever you like) for this instance.

Let me give you another example for a bandwidth rate of 32 kbps:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 662 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

515 Sign Ups in the last 30 days

100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags: , , ,

Forum Replies

  1. Hi Rene,
    Fantastic article. This is the senerio I am trying. I have a site that is using a primary link as MPLS and a secondary backup link as VPN (IPsec site-to-site). Due to some erformance issues I would like to change the primary as the VPN and keep the MPLS as the backup. In my case I have a Fortigate Firewall at one site where the MPLS and VPN links terminate and at my head office I have a Core switch where the MPLS terminates and another fortigate where the VPN terminates. I have decreased the Administrative distance on the Fortigates to 18 so that it is

    ... Continue reading in our forum

  2. Hi Ian,

    Static routes will send ALL traffic for a certain prefix in a certain direction. It doesn’t care what kind of traffic it is…PBR (Policy Based Routing) lets you change the next hop IP address for specific traffic, for example something that matches an access-list.

    The “backup” time depends on the timers that you configured for IP SLA.

    For your internal networks, OSPF is a good solution because it will automatically deal with failed links and such. IP SLA + Static routes however can be useful for the edge of your network. Imagine you have two ISPs and you

    ... Continue reading in our forum

  3. Hi Sahar,

    BFD is useful for local networks where you use protocols like OSPF or EIGRP. IP SLA is more useful for WAN connections, you can use it to check if your Internet connection is operational.


  4. Hi Laz


    I follow your introduction, but it still the problem once My IP SLA which ping to through ISP1 using source interface that direct connect to ISP1 fail, it will use secondary route , after failover to secondary route, IP SLA keep fail, as it never can reach with source interface connect to ISP1 using secondary route which go through ISP2.
    Please help on this problem
    Thank you
    Sovandara Heng

  5. Hello Dominique

    The answer is yes, even for one fail, the action is taken immediately. It is

    ... Continue reading in our forum

38 more replies! Ask a question or join the discussion by visiting our Community Forum