ptunnel: send/receive TCP traffic via ICMP reliably

Yes, it can be useful sometimes. For example, you have access to Wi-Fi network but you’re not allowed to access Internet via TCP/UDP as these protocols are blocked. At the same time ICMP is opened and you can ping everything alive in Internet. So, to check your email just have ptunnel installed and work around the restrictions set by the Wi-Fi network sysadmin easily.

Ptunnel is an application that allows you to reliably tunnel TCP connections to a remote host using ICMP echo request and reply packets, commonly known as ping requests and replies. It is not a feature-rich tool by any means, but it does what it advertises. So here is what it can do:

  • Tunnel TCP using ICMP echo request and reply packets
  • Connections are reliable (lost packets are resent as necessary)
  • Handles multiple connections
  • Acceptable bandwidth (150 kb/s downstream and about 50 kb/s upstream are the currently measured maximas for one tunnel)
  • Authentication, to prevent just anyone from using your proxy

1. Install ptunnel in Ubuntu or Debian
apt-get install ptunnel

2. Start ptunnel proxy:

ptunnel -p proxy_address -lp listen_port -da destination_address -dp dest_port [-c network_device] [-v verbosity] [-u] [-x password] [-f file]

The following example assumes that ptunnel is run as root, both on the proxy and client. To tunnel ssh connections from the client machine via a proxy running on proxy.pingtunnel.com to the computer login.domain.com, the following command line would be used:

ptunnel -p proxy.pingtunnel.com -lp 8000 -da login.domain.com -dp 22

An ssh connection to login.domain.com can now be established as follows:

ssh -p 8000 localhost

P.S. A brief manual on how to use ptunnel can be got here.
P.P.S. If you are sysadmin and have to forbid Internet access to some user in LAN, don’t forget to block ICMP! 🙂

SHARE:
nv-author-image

Stefan Durand

My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

1 thought on “ptunnel: send/receive TCP traffic via ICMP reliably”

  1. Im having problem loading wine everytime i load wine and get to the package installer and opening it will give me an error: dependency is not supported satisfiable:libldap?

Leave a Reply

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