{"id":452,"date":"2010-05-25T17:03:40","date_gmt":"2010-05-25T17:03:40","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2010\/05\/25\/iptables-template\/"},"modified":"2021-07-30T15:13:37","modified_gmt":"2021-07-30T15:13:37","slug":"iptables-template","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/UNIX-Linux\/General-UNIX\/iptables-template.html","title":{"rendered":"IPTables Template"},"content":{"rendered":"
Below is a basic template for setting up IPTables on a Linux box :<\/p>\n
Create LOGDROP CHAIN. Add LOG and DROP to chain.<\/strong><\/em><\/p>\n Create input and output policies<\/strong><\/em><\/p>\n Add inbound rules<\/strong><\/em><\/p>\n Add outbound rules<\/strong><\/em><\/p>\n Save Config<\/strong><\/em><\/p>\n Below is a basic template for setting up IPTables on a Linux box : Create LOGDROP CHAIN. Add LOG and DROP to chain. iptables -N LOGDROP iptables -A LOGDROP -j LOG –log-level 6 iptables -A LOGDROP -j DROP Create input and output policies iptables –policy INPUT DROP iptables –policy OUTPUT DROP Add inbound rules iptables … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"yoast_head":"\niptables -N LOGDROP\r\niptables -A LOGDROP -j LOG --log-level 6\r\niptables -A LOGDROP -j DROP<\/pre>\n
iptables --policy INPUT DROP\r\niptables --policy OUTPUT DROP<\/pre>\n
iptables -A INPUT\u00a0 -m state --state ESTABLISHED,RELATED \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A INPUT -p icmp \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--icmp-type echo-request \u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A INPUT -p tcp \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--dport ssh \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A INPUT -j LOGDROP<\/pre>\n
iptables -A OUTPUT\u00a0 -m state --state ESTABLISHED,RELATED \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -p icmp \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--icmp-type echo-request\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -p tcp \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--dport 443 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -p tcp \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--dport 80 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -p udp \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0--dport 53 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -p udp \u00a0\u00a0 \u00a0-d [syslog server ip]\u00a0\u00a0 \u00a0--dport 514 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -o lo\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0-j ACCEPT\r\niptables -A OUTPUT -j LOGDROP<\/pre>\n
iptables-save<\/pre>\n","protected":false},"excerpt":{"rendered":"