Enable port in Centos Linux-solve the problem that the Centos publishing service cannot be accessed through the Internet
Last Update:2014-05-15
Source: Internet
Author: User
CentosLinux open port-solve Centos publish service internet access problems -------------- view server port status -------------------- [root @ zjxl-2etc] etcinitdiptablesstatusTable: filterChainI Centos Linux enable port-solve the problem that Centos publishing service cannot access the Internet # ---------------- view the server port status ------------------ [root @ zjxl-2 etc] #/etc/init. d/iptables status Table: filter Chain INPUT (policy DROP) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 2 ACCEPT icmp- -0.0.0.0/0 0.0.0.0/0 3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 22 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports :30, 80,110,443,330 0: 3500,5700: 6100,7001, 8000: 13000 5 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED, ESTABLISHED Chain FORWARD (policy ACCEPT) num target prot opt source destination OUTPUT Chain (policy ACCEPT) num target prot opt source destination #------------------------ ---- Port 6379 and Port 6380 were not enabled ------------------------------ # enabled Port 6379 hosts [root @ zjxl-2 etc] #/sbin/iptables-I INPUT-p tcp -- dport 6379-j ACCEPT [root @ zjxl-2 etc] #/etc/init. d/iptables status Table: filter Chain INPUT (policy DROP) num target prot opt source destination 1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 6379 2 ACCEPT all -- 0.0. 0.0/0 0.0.0.0/0 3 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 22 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports, 80,110,443,330 0: 3500,5700: 6100,7001, 8000: 13000 6 ACCEPT all -- 0.0.0.0.0/0 0.0.0.0/0 state RELATED, ESTABLISHED Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destina Tion # configure enable Port 6380 hosts [root @ zjxl-2 etc] #/sbin/iptables-I INPUT-p tcp -- dport 6380-j ACCEPT # -------------------------- view server port status ----------------------- [root @ the zjxl-2 etc] #/etc/init. d/iptables status Table: filter Chain INPUT (policy DROP) num target prot opt source destination 1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 6380 2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 6379 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 22 6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports, 80,110,443,330 0: 3500,5700: 6100,7001, 8000: 13000 7 ACCEPT all -- 0.0.0.0.0/0 0.0.0.0/0 state RELATED, ESTABLISHED Chain FORWARD (policy ACCEPT) num target prot opt source desti Nation Chain OUTPUT (policy ACCEPT) num target prot opt source destination # ---------------------------------- save modification configuration ------------------------------- [root @ zjxl-2 etc] #/etc/rc. d/init. d/iptables save Saving firewall rules to/etc/sysconfig/iptables: [OK] [root @ zjxl-2 etc] # Problem description: After the Redis Cache service is installed on the Centos server, the connection times out when other machines cannot be accessed ., Depressed, find a solution on the Internet: /sbin/iptables-I input-p tcp -- dport 6379-j ACCEPT/sbin/iptables-I INPUT-p tcp -- dport 6380-j ACCEPT and then save:/etc/rc. d/init. d/iptables save. after the computer is restarted, the CentOS firewall opens ports 6379 and 6380 by default. You may not restart the computer either here:/etc/init. d/iptables restart view CentOS firewall information:/etc/init. d/iptables status disable the CentOS firewall service:/etc/init. d/iptables stop: chkconfig-level 35 iptables off