kevinlinxp
12/31/2016 - 6:41 AM

CMD:iptables

CMD:iptables

sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT

sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo iptables -X
## Block
# 1. Block an IP Address
iptables -A INPUT -s 14.202.170.152 -j DROP

# 2. Block by matching a string
sudo iptables -I INPUT -p tcp --dport 80 -m string --algo kmp --string 'GET /api/1.0/data' -j DROP

## Redirect
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 443