Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I sniff packets communicated through serial port on Linux?

share|improve this question
1  
If some answers provided answer to your question, you should accept it (meta.serverfault.com/questions/1033/…) –  Olli Feb 8 '11 at 13:31
add comment

3 Answers

There are a few options:

  • sersniff is a simple program to tunnel/sniff between 2 serial ports.

  • Serial line sniffer (slsnif) is a serial port logging utility. It listens to the specified serial port and logs all data going through this port in both directions.

  • Serial to Network Proxy (ser2net) provides a way for a user to connect from a network connection to a serial port.

  • SerialSpy acts as a serial pass-through device. It listens for incoming data on two serial ports and forwards it so the devices act as if they are directly connected. It also logs the data as it moves through the ports.

  • sercd is an RFC 2217-compliant serial port redirector. It lets you share a serial port through a network. It is based on sredird. The RFC2217 protocol is an extension to telnet and allows changing communication port parameters.

  • SerLooK is a KDE application for inspecting data going over serial lines. It can work as a binary terminal that sends and receives data through a defined port (Point to Point mode) and displays them on separate views. Each view can be configured to display data in hexadecimal, decimal, octal, binary, and raw ASCII. It is also possible to perform I/O through terminal emulation views and define a secondary port and monitor the traffic between two external hosts using a "Y" cable (Snooper mode).

  • nullmodem creates a virtual network of pseudo-terminals. It can be used as an adapter to connect two programs that normally need serial interface cards.

  • ttywatch monitors, logs, and multiplexes terminal I/O. It has full log rotation built in, and can use telnet as well as local TTY ports.

share|improve this answer
add comment

I tried to use slsnif, but I found that I got an error:

Failed to open a pty: No such file or directory

This mailing list item indicates that slsnif only supports the "legacy" pseudo-terminals (/dev/ttyp0 etc) which are probably not used on current Linux kernels.


I tried interceptty, and was successful in using it. First I ran it on the port of interest:

interceptty /dev/ttyACM0 

Then I connected the program-under-test to the pseudo-terminal /dev/pts/5 that interceptty created.

share|improve this answer
add comment

Try using jpnevulator (debian packaged) or slsniff, from http://slsnif.sourceforge.net/

share|improve this answer
add comment

protected by Chris S May 14 '12 at 2:50

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?