I tried with sudo ethtool -G eth0 rx 1020, but im getting this error Cannot get device ring settings: Operation not supported. Is there any other way to change network buffer to simulate NIC card errors and Packet drops. Thanks

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide your own answer and accept it. – Ron Maupin Aug 6 '17 at 22:39

That's what the netem queue discipline is for.

For outgoing traffic, just set the qdisc of the outgoing interface to netem:

modprobe sch_netem
tc qdisc add dev eth0 root netem loss 3%

You can reset it to normal with

tc qdisc del dev eth0 root

For incoming traffic, the setup is a little more complicated, please check netem on incoming traffic.

  • Thanks for the replay. I think, netem works at network layer. But, I need at NIC card level. If I issue command like "netstat -i", it must show PKT_DROP and Errors. – Veerendra Aug 20 '15 at 16:37
  • 2
    There's no way to get the NIC (driver) to simulate failures. At best, you could try setting the ring buffer to 1 (very small), but the driver must support this. – Ricky Beam Aug 20 '15 at 18:27
  • Thanks Ricky Beam,,,I have one more question, Can we simulate packet errors at NIC(Physical layer) level like hash fails, etc? – Veerendra Aug 22 '15 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.