Application sends a Packet, but it should be dropped by the IP.


I want to simulate the following situation.

My Application sends a packet, but the ip packet should be dropped by the ip layer.
Is there any way on Linux using ifconfig command or any other to drop a packet intentioanlly.
Who is Participating?
svsConnect With a Mentor Commented:
A firewall (in Linux -- netfilter) is good at dropping packets.
Duncan RoeConnect With a Mentor Software DeveloperCommented:
Why do you want to do this? I only ask in case there might be a simpler way to achieve your goal.
For instance, if you are developing a user-level program which does its own session control over UDP, you could use the gdb debugger to simulate packet loss.
use firewall(iptables)
set the iptables default policy as drop or reject
another query is tell me which exact application packet to drop?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.