TCPTRACEROUTE(1)

πŸ’… TCPTRACEROUTE(1) β€” like, the whole manual but make it make sense

okay bestie, so this is tcptraceroute from the General Commands Manual, and I'm gonna walk you through it the way I'd explain it in the group chat. no gatekeeping, no cap. 🫢


✨ NAME ✨

tcptraceroute β€” a traceroute implementation using TCP packets. that's it, that's the vibe. it's traceroute but the packets are TCP. πŸ’–


✨ SYNOPSIS ✨

tcptraceroute [-nNFSAE] [ -i interface ] [ -f first ttl ]
[ -l length ] [ -q number of queries ] [ -t tos ]
[ -m max ttl ] [ -p source port ] [ -s source address ]
[ -w wait time ] host [ destination port ] [ length ]

like, that's the whole shape of it. host is the main character, everything else is optional garnish. 🌸


✨ DESCRIPTION ✨

so tcptraceroute is a traceroute implementation using TCP packets. yes it's literally in the name, we love an honest queen.

the more traditional traceroute(8) sends out either UDP or ICMP ECHO packets with a TTL of one, then increments the TTL until the destination has been reached. and by printing the gateways that generate ICMP time exceeded messages along the way, it's able to determine the path packets are taking to reach the destination. cute, right? classic. πŸ‘‘

but here's the problem. with the widespread use of firewalls on the modern Internet, a lot of the packets that traceroute(8) sends out end up being filtered, making it impossible to completely trace the path to the destination. filtered. blocked. ghosted. πŸ’€

however! in many cases, these firewalls will permit inbound TCP packets to specific ports that hosts sitting behind the firewall are listening for connections on. so by sending out TCP SYN packets instead of UDP or ICMP ECHO packets, tcptraceroute is able to bypass the most common firewall filters. it's giving "i know a guy" energy. ✨

it's worth noting that tcptraceroute never completely establishes a TCP connection with the destination host. here's the tea:

  • if the host is not listening for incoming connections, it will respond with an RST indicating that the port is closed.
  • if the host instead responds with a SYN|ACK, the port is known to be open, and an RST is sent by the kernel tcptraceroute is running on to tear down the connection without completing three-way handshake.

this is the same half-open scanning technique that nmap(1) uses when passed the -sS flag. iconic behaviour honestly. πŸŽ€


✨ OPTIONS ✨

one bullet per flag because i respect you and i want you to actually read them. 🌈

  • -n β€” display numeric output, rather than doing a reverse DNS lookup for each hop. by default, reverse lookups are never attempted on RFC1918 address space, regardless of the -n flag. like, no matter what, private addresses don't get the DNS treatment.
  • -N β€” perform a reverse DNS lookup for each hop, including RFC1918 addresses. so this one does do the private-address lookups.
  • -f β€” set the initial TTL used in the first outgoing packet. the default is 1.
  • -m β€” set the maximum TTL used in outgoing packets. the default is 30.
  • -p β€” use the specified local TCP port in outgoing packets. the default is to obtain a free port from the kernel using bind(2). and unlike with traditional traceroute(8), this number will not increase with each hop. it stays put. commitment. 🫢
  • -s β€” set the source address for outgoing packets. see also the -i flag.
  • -i β€” use the specified interface for outgoing packets.
  • -q β€” set the number of probes to be sent to each hop. the default is 3.
  • -w β€” set the timeout, in seconds, to wait for a response for each probe. the default is 3.
  • -S β€” set the TCP SYN flag in outgoing packets. this is the default, if neither -S or -A is specified.
  • -A β€” set the TCP ACK flag in outgoing packets. by doing so, it's possible to trace through stateless firewalls which permit outgoing TCP connections. sneaky in a smart way. 😌
  • -E β€” send ECN SYN packets, as described in RFC2481.
  • -t β€” set the IP TOS (type of service) to be used in outgoing packets. the default is not to set any TOS.
  • -F β€” set the IP "don't fragment" bit in outgoing packets.
  • -l β€” set the total packet length to be used in outgoing packets. if the length is greater than the minimum size required to assemble the necessary probe packet headers, this value is automatically increased.
  • -d β€” enable debugging, which may or may not be useful. truly the most honest sentence in this entire manpage. πŸ™ˆ
  • --dnat β€” enable DNAT detection, and display messages when DNAT transitions are observed. DNAT detection is based on the fact that some NAT devices, such as some Linux 2.4 kernels, do not correctly rewrite the IP address of the IP packets quoted in ICMP time-exceeded messages tcptraceroute solicits, revealing the destination IP address an outbound probe packet was NATed to. NAT devices which correctly rewrite the IP address quoted by ICMP messages, such as some Linux 2.6 kernels, will not be detected. for some target hosts, it may be necessary to use --dnat in conjunction with --track-port. see the examples.txt file for examples.
  • --no-dnat β€” enable DNAT detection for the purposes of correctly identifying ICMP time-exceeded messages that match up with outbound probe packets, but do not display messages when a DNAT transition is observed. this is the default behavior.
  • --no-dnat-strict β€” do not perform any DNAT detection whatsoever. no attempt will be made match up ICMP time-exceeded messages with outbound probe packets, and when tracerouting through a NAT device which does not rewrite the IP addresses of the IP packets quoted in ICMP time-exceeded messages, some hops along the path may appear to be unresponsive. this option should not be needed in the vast majority of cases, but may be utilized if it is suspected that the DNAT detection code is misidentifying ICMP time-exceeded messages.

✨ EXAMPLES ✨

please see the examples.txt file included in the tcptraceroute distribution for a few real world examples. real ones. 🌍

to trace the path to a web server listening for connections on port 80:

tcptraceroute webserver

to trace the path to a mail server listening for connections on port 25:

tcptraceroute mailserver 25

see? so easy. port 80 web, port 25 mail, the classics. πŸ’Œ


✨ BUGS ✨

no error checking is performed on the source address specified by the -s flag, and it is therefore possible for tcptraceroute to send out TCP SYN packets for which it has no chance of seeing a response to.

so like, if you hand it a bad source address with -s, it will just… do it. no complaints, no warnings, no vibe check. it's out there sending packets into the void and you will get nothing back. be careful with -s bestie, fr fr. 😭


✨ AUTHOR ✨

Michael C. Toren <mct@toren.net> β€” the legend, the icon. 🫑


✨ AVAILABILITY ✨

for updates, please see:

http://michael.toren.net/code/tcptraceroute/

✨ SEE ALSO ✨

traceroute(8), ping(8), nmap(1)


okay that's the whole thing, you're basically a network engineer now, slay πŸ’…βœ¨ this was the tcptraceroute page from the General Commands Manual, dated 2006 March 28 β€” yes it's an oldie but she's still serving. mwah. πŸŽ€πŸ’–πŸ¦‹