BLOG

Iptables Sheet

13 Aug 2013, Posted by BoB in All Posts, Computer Talk, Network Talk

Here is a breakdown of some iptable commands.

udp – User Datagram Protocol (streams without checking)
tcp – Transmission Control Protocol (checks if destination is available)

# input and output commands
-A OUTPUT -d [IP ADDRESS] -o eth0 -p tcp –dport [DESTINATION PORT NUMBER] -j ACCEPT
-A INPUT -d [IP ADDRESS] -i eth0 -p tcp –dport [DESTINATION PORT NUMBER] -j ACCEPT
-A OUTPUT -d [IP ADDRESS] -o eth0 -p udp –sport [SOURCE PORT NUMBER] -j ACCEPT
-A INPUT -d [IP ADDRESS] -i eth0 -p udp –sport [SOURCE PORT NUMBER] -j ACCEPT

# moves iptables config to a file
iptables-save > file

# copies changes to file back to iptables configuration
iptables-restore file

# saves current (running) configuration to the bootup configuration
service iptables save

More examples can be found at www.linuxhomenetworking.com

Post a comment