I'm using Scapy to replay some dumped packets in which I change the TTL value. I've been getting very odd results even with TTL=1.
When I run my test hours apart from each other, I can get from roughly 40% to 95% of packets replied to with an ICMP time-exceeded message. Then I can recursively replay unanswered packets and get each time more or less the same percentage of answered packets as before.
Why is that?
I've been sending packets with an interval of 0.1 seconds between each other. This should be ok, right? My timeout value is 10s, which should be very conservative.
What's wrong here?
The ICMP - Time exceeded message is generated when the gateway processing the datagram (or packet, depending on how you look at it) finds the Time To Live field (this field is in the IP header of all packets) is equal to zero and therefore must be discarded.
Whenever a packet or message is sent on a network, a Time to Live (TTL) value is attached. The TTL value decreases after passing reach layer 3 devices such as a router along the way to the destination.
Time Exceeded error messages are used to indicate that a forwarding or reassembly operation took too long to complete and that the reporting device is discarding the data.
Time Exceeded—Type 11. The time exceeded message occurs when a router receives a datagram with a TTL (Time To Live) of 0 or 1.
What you're saying is essentially you can only test for so many unreachable hosts in a given span of time. One possible reason: many routers rate-limit ICMP messages.
It is much better to test for a ping
success to a host before doing something else; this way you have positive confirmation of reachability. The downside is MS Windows blocks pings by default.
If you can't ping
first, then you'll need to increase the time between your probes, or raise the ICMP unreachable rate on the router that is returning the ICMP messages.
EDIT:
Based on the comments, it looks like you're hitting a wall for scapy
's ability to process traffic. I have improved throughput in the past by sending with scapy
and spawning tcpdump
in the background to receive traffic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With