Iptables entry-level application cases

Source: Internet
Author: User

Linux provides a very good firewall tool netfilter/Iptables. This article briefly introduces the use of netfilter/IptablesImplements firewall setup, Internet Connection Sharing, and other applications to maintain server security vulnerabilities.

Disable Firewall

 
 
  1. iptables -P INPUT ACCEPT 

Open Firewall

 
 
  1. iptables -F INPUT  
  2. iptables -P INPUT DROP 

-- Disable port 3306 (Mysql database)

 
 
  1. iptables -I INPUT -i eth0 -p tcp --dport 3306 -j DROP  
  2. iptables -I INPUT -i eth0 -p tcp --dport 3306  -j ACCEPT 

In linux, port 81 is usually disabled.

Enable port 81:

 
 
  1. iptables -I INPUT -i eth0 -p tcp --dport 81 -j ACCEPT  
  2. iptables -I OUTPUT -o eth0 -p tcp --sport 81 -j ACCEPT 

Close port 81:

 
 
  1. iptables -I INPUT -i eth0 -p tcp --dport 81 -j DROP  
  2. iptables -I OUTPUT -o eth0 -p tcp --sport 81 -j DROP 

Then save:

 
 
  1. #/etc/rc.d/init.d/iptables save  

Check whether there are already:

 
 
  1. [root@vcentos ~]# /etc/init.d/iptables status 

Save as follows.

Summary:

IptablesThe content of the Getting Started application case has been introduced.IptablesLearning the entry content is helpful to you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.