Skip to content

Instantly share code, notes, and snippets.

@kerus1024
Last active December 19, 2020 10:41
Show Gist options
  • Save kerus1024/c7f7e731eaffcfcd82fb413c6ae179a0 to your computer and use it in GitHub Desktop.
Save kerus1024/c7f7e731eaffcfcd82fb413c6ae179a0 to your computer and use it in GitHub Desktop.
#!/bin/bash
TARGET=1.1.1.1
iptables -D OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -D OUTPUT --destination 173.245.48.0/20 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 103.21.244.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 103.22.200.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 103.31.4.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 141.101.64.0/18 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 108.162.192.0/18 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 190.93.240.0/20 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 188.114.96.0/20 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 197.234.240.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 198.41.128.0/17 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 162.158.0.0/15 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 104.16.0.0/12 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 172.64.0.0/13 -j DNAT --to-destination=$TARGET
iptables -t nat -D OUTPUT --destination 131.0.72.0/22 -j DNAT --to-destination=$TARGET
if [ "$1" = "down" ]; then
echo "just down."
exit
fi
echo "Start !"
iptables -I OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A OUTPUT --destination 173.245.48.0/20 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 103.21.244.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 103.22.200.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 103.31.4.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 141.101.64.0/18 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 108.162.192.0/18 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 190.93.240.0/20 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 188.114.96.0/20 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 197.234.240.0/22 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 198.41.128.0/17 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 162.158.0.0/15 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 104.16.0.0/12 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 172.64.0.0/13 -j DNAT --to-destination=$TARGET
iptables -t nat -A OUTPUT --destination 131.0.72.0/22 -j DNAT --to-destination=$TARGET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment