Hacker News new | past | comments | ask | show | jobs | submit login

I'm late to the party, but this article inspired me to write this script to slow down connections to reddit

     #!/usr/bin/env bash
     DEV=enxe04f439470d2
     DOMAIN=reddit.com
     LATENCY=5200ms 
     
     sudo tc qdisc del dev $DEV root # Ensure you start from a clean slate
     sudo tc qdisc add dev $DEV root handle 1: prio
     sudo tc qdisc add dev $DEV parent 1:3 handle 30: netem delay $LATENCY 
     for IPADDR in $(dig @8.8.8.8 +nocmd $DOMAIN any +multiline +noall +answer | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}")
     do
         echo "Slowing down connections to $IPADDR on $DEV"
         sudo tc filter add dev $DEV protocol ip parent 1:0 prio 3 u32 match ip dst $IPADDR flowid 1:3
     done



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: