Last active
April 1, 2022 00:03
-
-
Save njsmith/e9c0f8ef61df35839b992e617a0a6b77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a new network namespace named 'bad', which will come with its own private loopback interface | |
sudo ip netns create bad | |
# Make the loopback interface slow, drop packets, etc. | |
sudo ip netns exec bad tc qdisc add dev lo root netem delay 200ms 40ms 25% # ... add more netem options here | |
# Turn on the loopback interface | |
sudo ip netns exec bad ip link set lo up | |
# Start a shell inside the new namespace | |
sudo ip netns exec bad sudo -u $USER /bin/bash | |
# Try running 'ping 127.0.0.1' to see how bad the network is | |
# Later, when you're done and want to clean up: | |
sudo ip netns delete bad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment