How to open a 8080-port confession in Linux external access and open ports allowed for external access 8000

Source: Internet
Author: User

Example:

The steps to open port 10000 are as follows:

1, modify the/etc/sysconfig/iptables file, add the following line:

-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 10000-j ACCEPT

Restart Iptables

Service Iptables Restart

2, restart the firewall, there are two ways to restart the firewall

A) effective after reboot

Open: Chkconfig iptables on

OFF: Chkconfig iptables off

b) immediate effect, failure after reboot

Open: Service iptables start

Close: Service iptables stop

3, or with Menu-system-administration-firewall

To add the port that the user needs.

By the To:

A. NETSTAT-TANP to display the port status.

/usr/sbin/lsof-i

B. telnet ipaddr port

To check if the IP and port is available before making connection.

Http://www.cnblogs.com/simonhaninmelbourne/archive/2012/10/06/2713233.html

Linux uses the following command to open a network port that allows for external access:

/sbin/iptables-i input-p TCP--dport 8000-j ACCEPT #开启8000端口

/etc/rc.d/init.d/iptables Save #保存配置

/etc/rc.d/init.d/iptables Restart #重启服务

See if the port is open
/etc/init.d/iptables status

After the installation of TOMCAT7, found in addition to the function to visit the outside world, in the cost of a few twists and turns, the summary steps are as follows:

1. Modify the file/etc/sysconfig/iptables

[Email protected] ~]# cd/etc/sysconfig/
[Email protected] sysconfig]# VI iptables

The contents of the file are as follows, note that the red line is newly added to open 8080 ports to the outside world.

# Firewall configuration written by System-config-firewall
# Manual Customization of this file are not recommended.
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [0:0]
: Rh-firewall-1-input-[0:0]
-A input-j Rh-firewall-1-input
-A rh-firewall-1-input-i lo-j ACCEPT
-A rh-firewall-1-input-p ICMP--icmp-type any-j ACCEPT
-A rh-firewall-1-input-p 50-j ACCEPT
-A rh-firewall-1-input-p 51-j ACCEPT
-A rh-firewall-1-input-p UDP--dport 5353-d 224.0.0.251-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 established,related-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 21-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 443-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 8080-j ACCEPT
-A rh-firewall-1-input-j REJECT--reject-with icmp-host-prohibited
-A forward-j REJECT--reject-with icmp-host-prohibited
COMMIT

This line of text is actually from the previous line copy modified from, in vi copy line with YY, copy multi-line with Yyn, paste with P. It's convenient.

2. Restart the Iptables service.

[Email protected] sysconfig]# service iptables restart
Flushing firewall rules: [OK]
Setting chains to Policy Accept:filter [OK]
Unloading iptables modules: [OK]
Applying iptables firewall rules: [OK]
Loading additional iptables modules:ip_conntrack_ftp [OK]
[Email protected] sysconfig]#

3. If you do not want to modify the Iptables table, you can enter the following command directly:

# iptables-i input-p TCP--dport 8080-j ACCEPT

Linux iptables Open Port command

Windows: This machine can access the 8080 port, the solution that the external network cannot access

How to open a 8080-port statement in Linux external access and open ports that allow external access 8000

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.