Skip to content

Instantly share code, notes, and snippets.

@ruslander
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save ruslander/c5f6c82dd1ddd47a2b42 to your computer and use it in GitHub Desktop.

Select an option

Save ruslander/c5f6c82dd1ddd47a2b42 to your computer and use it in GitHub Desktop.
Net splits
# Simulates a network partition scenario by blocking all TCP LAN traffic for a node.
# This will prevent the node from talking to other nodes in the cluster.
# The rules are not persisted, so a restart of the iptables service (or indeed the whole box) will reset things to normal.
# First add special exemption to allow loopback traffic on the LAN interface.
# Without this, riak-admin gets confused and thinks the local node is down when it isn't.
sudo iptables -I OUTPUT -p tcp -d $(hostname -i) -j ACCEPT
sudo iptables -I INPUT -p tcp -s $(hostname -i) -j ACCEPT
# Now block all other LAN traffic.
sudo iptables -I OUTPUT 2 -p tcp -d 10.0.0.0/8 -j REJECT
sudo iptables -I INPUT 2 -p tcp -s 10.0.0.0/8 -j REJECT
http://www.andrewconnell.com/allowing-a-host-machine-to-talk-to-guest-vms-in-hyper-v
http://www.ehloworld.com/257
http://wipfw.sourceforge.net/doc.html
http://info.iet.unipi.it/~luigi/dummynet/#3d2a
https://nbevans.wordpress.com/2013/02/10/simulating-the-p-of-cap-on-a-riak-cluster/
http://superuser.com/questions/694523/netsh-block-all-ip-addresses-in-a-text-file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment