{"id":1539,"date":"2013-07-23T22:03:44","date_gmt":"2013-07-24T02:03:44","guid":{"rendered":"http:\/\/www.eyoungwon.com\/journal\/?p=1539"},"modified":"2024-07-15T22:30:26","modified_gmt":"2024-07-16T02:30:26","slug":"stop-start-restart-the-firewall","status":"publish","type":"post","link":"https:\/\/eyoungwon.com\/journal\/stop-start-restart-the-firewall\/","title":{"rendered":"Stop \/ Start \/ Restart the Firewall"},"content":{"rendered":"<h3>#1.2: To display INPUT or OUTPUT chain rules, enter:<\/h3>\n<p><code># iptables -L INPUT -n -v<br \/>\n# iptables -L OUTPUT -n -v --line-numbers<\/code><\/p>\n<h2>#2: Stop \/ Start \/ Restart the Firewall<\/h2>\n<p>If you are using CentOS \/ RHEL \/ Fedora Linux, enter:<br \/>\n<code># service iptables stop<br \/>\n# service iptables start<br \/>\n# service iptables restart<\/code><\/p>\n<p>You can use the iptables command itself to stop the firewall and delete all rules:<br \/>\n<code># iptables -F<br \/>\n# iptables -X<br \/>\n# iptables -t nat -F<br \/>\n# iptables -t nat -X<br \/>\n# iptables -t mangle -F<br \/>\n# iptables -t mangle -X<br \/>\n# iptables -P INPUT ACCEPT<br \/>\n# iptables -P OUTPUT ACCEPT<br \/>\n# iptables -P FORWARD ACCEPT<\/code><\/p>\n<p>Where,<\/p>\n<ul>\n<li><strong>-F<\/strong>\u00a0: Deleting (flushing) all the rules.<\/li>\n<li><strong>-X<\/strong>\u00a0: Delete chain.<\/li>\n<li><strong>-t table_name<\/strong>\u00a0: Select table (called nat or mangle) and delete\/flush rules.<\/li>\n<li><strong>-P<\/strong>\u00a0: Set the default policy (such as DROP, REJECT, or ACCEPT).<\/li>\n<\/ul>\n<h2>#4: Insert Firewall Rules<\/h2>\n<p>To insert one or more rules in the selected chain as the given rule number use the following syntax. First find out line numbers, enter:<br \/>\n# iptables -L INPUT -n &#8211;line-numbers<br \/>\nSample outputs:<\/p>\n<pre>Chain INPUT (policy DROP)\r\nnum  target     prot opt source               destination\r\n1    DROP       all  --  202.54.1.1           0.0.0.0\/0\r\n2    ACCEPT     all  --  0.0.0.0\/0            0.0.0.0\/0           state NEW,ESTABLISHED<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Stop \/ Start \/ Restart the Firewall<\/p>\n","protected":false},"author":62,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,394],"tags":[732,731],"class_list":["post-1539","post","type-post","status-publish","format-standard","hentry","category-servers","category-vps","tag-iptables","tag-stop-start-restart-the-firewall"],"_links":{"self":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/1539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/users\/62"}],"replies":[{"embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/comments?post=1539"}],"version-history":[{"count":3,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/1539\/revisions"}],"predecessor-version":[{"id":1541,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/1539\/revisions\/1541"}],"wp:attachment":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/media?parent=1539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/categories?post=1539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/tags?post=1539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}