Install and configure iptables firewall in redhat and CentOS systems

Source: Internet
Author: User
How can I install iptables in the Redhat (RHEL), CentOS, or FedoraLinux release? Iptables is installed by default in most Linux releases, including Redhat, CentOS, and Fedora. This is basically the standard practice for all releases. It is very likely that the server, personal computer, or VPS already has iptables, how to install it in Redhat (RHEL), CentOS, or Fedora Linux release IptablesWhat about it? Most Linux distributions, including Redhat, CentOS, and Fedora, are installed by default. Iptables. This is basically the standard practice for all releases.
It is very likely that the server, personal computer, or VPS already have iptables. If you are not sure, you can use the following method to check whether iptables has been installed.

Open a terminal window (similar to the command line window in Windows), or use an SSH client to log on to a remote server or VPS. Make sure that the user has the root permission.

Enter the following command:
Iptables

Or for IPv6, enter:
Ip6tables

The input is similar:
Ip6tables v1.4.7: no command specified
Try 'ip6tables-H' or 'ip6tables -- help' for more information.
If iptables has been correctly installed, you can obtain the above output information. V1.4.7 is the version number of the current iptables. You can also view the detailed information of the iptables command using the following command:
Yum info iptables

The output is similar:
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
* Base: pai.bit.edu.cn
* Epel: mirrors.ustc.edu.cn
* Extras: pai.bit.edu.cn
* Remi: rpms.famillecollet.com
* Updates: 2.16.bit.edu.cn
Installed Packages
Name: iptables
Arch: i686
Version: 1.4.7
Release: 5.1.el6 _ 2
Size: 702 k
Repo: installed
From repo: updates
Summary: Tools for managing Linux kernel packet filtering capabilities
URL: http://www.netfilter.org/
License: GPLv2
Description: The iptables utility controls the network packet filtering code in
: Linux kernel. If you need to set up firewils and/or IP masquerading,
: You should install this package.

If the above information does not appear, you need to install it. Run the following command to install iptables:
Yum install iptables

Now the iptables installation package contains ip6tables for IPv6. After installation, you can run the following command to add iptables to the service that runs automatically upon startup:
/Sbin/chkconfig -- levels 23456 iptables on

However, this only automatically starts iptables for IPv4. To start ip6tables for IPv6, run the following command:
/Sbin/chkconfig -- levels 23456 ip6tables on

If you want to disable automatic startup, you only need to change on in the above command to off.

Of course, it is not enough to install it. You still need to configure it. This is wise. If you are using your own VPS, The iptables configuration in my VPS security policy can be used as a reference.

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.