"Linux" Iptables open port 80

Source: Internet
Author: User

Friends who often use CentOS may encounter the same problems as me. The firewall is turned on and the 80 port is inaccessible, and the friend who just started learning CentOS can refer to it.

Friends who often use CentOS may encounter the same problems as me. Recently installed in Linux CentOS firewall configuration ORACLE
Database, the total display is due to the network port caused by the EM installation failure, so you want to shut down the CentOS firewall first. Accidentally see the configuration of the CentOS firewall operation instructions, feel good. Practice

Line "Setup" command to start the text mode configuration Utility, select "Firewall Configuration" in "Select a tool", then select "Run Tool" button, the CentOS firewall configuration interface appears,
Set the security level to disabled, and then select OK.

After restarting the computer, the CentOS firewall defaults to 80 and 22 ports

Description: CentOS is a branch of the Linux family.

CentOS firewall in the virtual machine CentOS installed good Apache can not be used, depressed, the solution is as follows

/sbin/iptables-i input-p TCP--dport 80-j ACCEPT
/sbin/iptables-i input-p TCP--dport 22-j ACCEPT

Then Save:

/etc/rc.d/init.d/iptables Save
CentOS 5.3, more than 5.4 versions are required
Service Iptables Save
To implement the save to configuration file.
The CentOS firewall has already opened 80 and 22 ports by default after restarting the computer.

This should also be done without restarting the computer:

/etc/init.d/iptables restart

The CentOS firewall shuts down and shuts down its service:

View the CentOS Firewall information:/etc/init.d/iptables status

Turn off the CentOS Firewall service:/etc/init.d/iptables stop

Permanently closed? Do not know how a permanent method:

Chkconfig–level iptables off

the above content is for the older version of CentOS, the following is based on the new version.

Iptables-p INPUT DROP

This will deny all access to CentOS 5.3 system data, in addition to Chain Rh-firewall-1-input (2 references) rules, hehe.

Configured with a command iptables must also be service iptables save to save to the configuration file.

Cat/etc/sysconfig/iptables can view firewall iptables configuration file contents

# Generated by Iptables-save v1.3.5 on Sat Apr 14 07:51:07 2001
*filter
: INPUT DROP [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [1513:149,055]
: Rh-firewall-1-input-[0:0]
-A input-j Rh-firewall-1-input
-A forward-j Rh-firewall-1-input
-A rh-firewall-1-input-i lo-j ACCEPT
-A rh-firewall-1-input-p icmp-m ICMP--icmp-type any-j ACCEPT
-A rh-firewall-1-input-p esp-j ACCEPT
-A rh-firewall-1-input-p ah-j ACCEPT
-A rh-firewall-1-input-d 224.0.0.251-p udp-m UDP--dport 5353-j ACCEPT
-A rh-firewall-1-input-p udp-m UDP--dport 631-j ACCEPT
-A rh-firewall-1-input-p tcp-m tcp--dport 631-j ACCEPT
-A rh-firewall-1-input-m state--state related,established-j ACCEPT
-A rh-firewall-1-input-p tcp-m state--state new-m TCP--dport 22-j ACCEPT
-A rh-firewall-1-input-j REJECT--reject-with icmp-host-prohibited
COMMIT
# completed on Sat APR 14 07:51:07 2001

Additionally add:
CentOS firewall configuration 80 Port
Read several page content is wrong, the following is the correct method:
#/sbin/iptables-i input-p TCP--dport 80-j ACCEPT
#/sbin/iptables-i input-p TCP--dport 22-j ACCEPT

Then Save:
#/etc/rc.d/init.d/iptables Save

Check to see if it already has:
[Email protected] ~]#/etc/init.d/iptables status
Table:filter
Chain INPUT (Policy ACCEPT)
Num Target prot opt source destination
1 ACCEPT UDP--0.0.0.0/0 0.0.0.0/0 UDP dpt:80
2 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:80
3 Rh-firewall-1-input All--0.0.0.0/0 0.0.0.0/0

Chain FORWARD (Policy ACCEPT)
Num Target prot opt source destination
1 Rh-firewall-1-input All--0.0.0.0/0 0.0.0.0/0

* Set Iptables to auto start
Chkconfig--level 2345 iptables on

It may be because the version you are using is different, and all of the methods are used slightly differently.

If you need to manage MySQL remotely, use the following command to open it temporarily and close it when you are done

* Open command
Iptables-a input-p tcp-s xxx.xxx.xxx.xxx--dport 3306-j ACCEPT

* Close command
iptables-d input-p tcp-s xxx.xxx.xxx.xxx--dport 3306-j ACCEPT

"Linux" Iptables open port 80

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.