ctrace [options]

The only required option is -t target. The target may be specified as a hostname or IPv4 address. Other valid execution modes are -W (web traceroute gateway database update), and -l (list gateways).


ctrace is an IPv4 traceroute tool that supports many features missing in standard 4.3BSD traceroute(8). It is programmed entirely in perl.

The primary difference between ctrace and other traceroute tools is its ability to trace routes in multiple protocols. ctrace also has some additional nifty features:

Automatic round-trip-time (RTT) averaging, which makes output cleaner and more intelligible.

One or more packets can be launched per TTL/hop. By way of contrast, 4.3BSD traceroute(8) forces at least two. This capability makes ctrace faster.

4.3BSD traceroute(8) emulation option, so that ctrace will hook in to existing parsers.

The ability to skip an arbitrary number of hops, saving you time that would be normally wasted tracerouting your own network.

Fine-grained control over trace packet headers, assisting in bypassing burdensome packet filters.

Web-based traceroute gateway bounce support.


Disable RTT averaging mode. RTT averaging mode shows one ms/avg. RTT per hop instead of seeing a collection of 4.3BSD traceroute(8)-like ms RTT values. This option has no effect if -q is set to 1.

-b siteid
Bounce mode. Uses the website siteid to run the traceroute, returning the results transparently. Note that this feature is still not as adaptable as hoped. Use -l to list known bounce sites.

-c icmpcode
ICMP message code. An integer in the range 0-255 is expected. The default value for this field is 0. This option affects ICMP traces only (see -p option).

-d dstport
Destination port number. The default value is 53. A value of 0 means that destination ports will be generated at random. This option affects TCP and UDP traces only (see -p option).

-f failhops
Failing failhops consecutive hops will cause the program to abort. This is useful for preventing lengthy max-TTL timeout situations where packet filters are blocking further progress. In mass-traces of unknown networks, it drasitically improves speed. The default value is 2.

Display command line help. This is also displayed if the -t argument is ommitted.

-i icmptype
ICMP message type. An integer in the range 0-255 is expected. The default value for this field is 8. This option affects ICMP traces only (see -p option).

-j jumphops
Start on the jumphops'th hop (ie: initilise the TTL to jumphops). This is useful for saving the time you waste mapping the first few hops (you and your ISP's networks) thousands of times over. The default is not to jump.

List the web traceroute gateways currently in the local database, along with their siteid. Used with -b.

-m ttl
Max time to live (TTL). This is the maximum number of hops that you want to make before giving up on reaching your target. The default value is 35.

`Numeric mode'. In this mode, the program will not use DNS to resolve host names. The output in this mode is supposed to be compatible with 4.3BSD traceroute(8)'s -n mode.

`Oldschool mode'. ctrace will emulate 4.3BSD traceroute(8) output almost perfectly. The only present differences from 4.3BSD traceroute(8) are that packet size is always reported as 40 bytes (irrespective of the protocol and options selected), and that ctrace will still allow -q of 1 (minimum 4.3BSD traceroute(8) is 2). Oldschool mode negates -v and implies -a.

-p [protocol]
The protocol to conduct the trace with. Valid values are icmp, tcp and udp. The default value is udp. More protocols will probably be added in the future.

-q queries
The number of queries (packets) to send per hop. Packets are dispatched one at a time, so increasing this number will slow down yout trace. One seems to be sufficient for most cases, three is the recommended maximum. The default value is one.

-s srcport
Source port number. The default value of 0 means that source ports will be generated at random. This option affects TCP and UDP traces only (see -p option).

-t target
This is the target host of your trace. It can either be specified as a hostname, or an IPv4 address.

Verbose mode. Displays additional information on ctrace's status. This feature is mainly used for debugging. This option is incompatible with -o (oldschool) mode, and will be disabled if both are specified.

-w secs
The time in seconds to wait for responses to packets before assuming that they will never come. The default value is 3.

Enables exit-reporting mode. A human-readable summary of the exit condition will be printed to STDERR prior to program termination.

Enables 'mix mode'. In this mode, STDERR and STDOUT are combined in to STDOUT. This is a parser-friendly mode, for traceroute parsers such as ct2db (

Currently non-working flag intended for IP TOS specification.

Toggles the FIN,PSH,RST,SYN,URG and reserved (unused) flags in outgoing TCP packets. These options only affect TCP traces (see -p option). Only the STN flag is turned on by default.

Update the web traceroute gateway ('bounce site') database from Note that you are better off compiling a sitelist manually, as many sites are either down or do not cooperate with ctrace.


ICMP (protocol 2)
Using the -i (ICMP type) and -c (ICMP code) switches, it is possible to send a variety of ICMP-based traces. Due to the nature of ICMP, most type/code combinations will not yield ICMP TTL expired messages (the basis of traceroute), thus will not work. Other types are either obsolete, or heavily filtered on modern routers (will not pass a couple of hops at most). Known good values for ICMP types and codes are; echo response (type 0, code 0), echo request (type 8, code 0).

TCP (protocol 6)
Destination ports of 80 (HTTP), 21 (FTP), 25 (SMTP), 110 (POP3) are probably good bets. If you cannot get through, altering TCP header flags (-F|P|R|S|U|X|Y) may be helpful. Source ports of 53 (DNS) and 20 (FTP) are often firewall 'special cases'.

UDP (protocol 17)
The classic UDP source and destination port is 53 (DNS), it is rarely filtered.

Using the -b option, it is possible to run a trace from a foreign web traceroute gateway and return the results. Useful for topology discovery.


The latest version of the code can be found at


Send to the author. The current BUGS and TODO files are distributed with the latest version of the code.


Walter Stanish <>, based upon code by ShaD0w.


Related Code
ct2db (

Man Pages
Net::RawIP, pcap(3), traceroute(8).

RFC791 Internet Protocol (IP), RFC792 Internet Control Message Protocol (ICMP).


ctrace grew out of a couple of hacks to ShaD0w's Net::RawIP demonstration traceroute script. For the full history, see the HISTORY file in the distribution archive, also available on the ctrace website.