Skip to content

Instantly share code, notes, and snippets.

@johanek
Created March 5, 2018 10:24
Show Gist options
  • Save johanek/92f4a76b6c3f2727ebaf330a22d34b0c to your computer and use it in GitHub Desktop.
Save johanek/92f4a76b6c3f2727ebaf330a22d34b0c to your computer and use it in GitHub Desktop.
[ip route unreachable] Simulate dropped data or unreachable destination with ip route
# blackhole all packets destined for 192.168.2.1
ip route add blackhole 192.168.2.1
# to delete the same route, replace add with del
ip route del blackhole 192.168.2.1
#Depending on your use case, an unreachable route may work better, as it returns ICMP-unreachable instead of discarding the packets, although they tend to have the same effect.
ip route add unreachable 192.168.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment