Ubuntu/iptables
From r00tedvw.com wiki
(Difference between revisions)
Line 14: | Line 14: | ||
allow related and established | allow related and established | ||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | ||
+ | prevent packets from forwarding (like a router) | ||
+ | iptables -P FORWARD DROP | ||
delete chain from iptables | delete chain from iptables | ||
iptables -X chain.name | iptables -X chain.name |
Revision as of 22:48, 24 April 2014
- iptables
- allows you to configure network ports and more
lookup current active rules
iptables -L -n -v
remove a rule from IP Tables
iptables -D INPUT 1
specify policy default
-P INPUT DROP
allow anything from itself (loopback)
-A INPUT -i lo -j ACCEPT
allow connection from specific address, inbound, using only TCP on a specific port
-A INPUT -s ip.address -p tcp --dport 22 -j ACCEPT
allow related and established
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
prevent packets from forwarding (like a router)
iptables -P FORWARD DROP
delete chain from iptables
iptables -X chain.name
save current IP Tables config
sudo sh -c "iptables-save > /etc/iptables.rules"
restore IP Tables config (also add this line to rc.local for it to auto run during boot)
iptables-restore < /etc/iptables.rules