I have installed and web application which is running on port 8080 on centOS. I only have command line access (through putty) to that machine. I have tried to access that application from my windows machine from which I am connected through putty, but it is giving connection time out error.
我已经安装了web应用程序,它在centOS的8080端口上运行。我只有命令行访问权限(通过putty)到那台机器。我试图从我的windows机器*问这个应用程序,我是通过putty连接的,但是它会产生连接超时错误。
Then I have tried to open port 8080. I have added following entry into the iptables.
然后我试着打开8080端口。我在iptables中添加了以下条目。
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
一个输入-m状态-状态新-m tcp -p tcp -dport 8080 -j接受。
After adding this into the iptables I have restarted it with - /etc/init.d/iptables restart
在将其添加到iptables之后,我使用- /etc/ initon重新启动了它。d / iptables重启
But still I am not able to access that application from my windows machine.
但我仍然无法从windows机器*问该应用程序。
Am I doing any mistake or missing something?
我做错什么了吗?
2 个解决方案
#1
34
First, you should disable selinux
, edit file /etc/sysconfig/selinux
so it looks like this:
首先,您应该禁用selinux,编辑文件/etc/sysconfig/selinux,使其看起来如下:
SELINUX=disabled
SELINUXTYPE=targeted
Save file and restart system.
保存文件并重新启动系统。
Then you can add the new rule to iptables
:
然后可以将新规则添加到iptables:
iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
and restart iptables with /etc/init.d/iptables restart
并使用/etc/ initter重新启动iptables。d / iptables重启
If it doesn't work you should check other network settings.
如果它不工作,你应该检查其他网络设置。
#2
49
The following configs works on Cent OS 6 or earlier
下面的configs在分OS 6或更早的时候工作
As stated above first have to disable selinux.
如上所述,首先必须禁用selinux。
Step 1 nano /etc/sysconfig/selinux
步骤1纳米/etc/sysconfig/selinux
Make sure the file has this configurations
确保文件具有这种配置
SELINUX=disabled
SELINUXTYPE=targeted
Then restart the system
然后重新启动系统
Step 2
步骤2
iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
Step 3
步骤3
sudo service iptables save
For Cent OS 7
分操作系统7
step 1
步骤1
firewall-cmd --zone=public --permanent --add-port=8080/tcp
Step 2
步骤2
firewall-cmd --reload
#1
34
First, you should disable selinux
, edit file /etc/sysconfig/selinux
so it looks like this:
首先,您应该禁用selinux,编辑文件/etc/sysconfig/selinux,使其看起来如下:
SELINUX=disabled
SELINUXTYPE=targeted
Save file and restart system.
保存文件并重新启动系统。
Then you can add the new rule to iptables
:
然后可以将新规则添加到iptables:
iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
and restart iptables with /etc/init.d/iptables restart
并使用/etc/ initter重新启动iptables。d / iptables重启
If it doesn't work you should check other network settings.
如果它不工作,你应该检查其他网络设置。
#2
49
The following configs works on Cent OS 6 or earlier
下面的configs在分OS 6或更早的时候工作
As stated above first have to disable selinux.
如上所述,首先必须禁用selinux。
Step 1 nano /etc/sysconfig/selinux
步骤1纳米/etc/sysconfig/selinux
Make sure the file has this configurations
确保文件具有这种配置
SELINUX=disabled
SELINUXTYPE=targeted
Then restart the system
然后重新启动系统
Step 2
步骤2
iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
Step 3
步骤3
sudo service iptables save
For Cent OS 7
分操作系统7
step 1
步骤1
firewall-cmd --zone=public --permanent --add-port=8080/tcp
Step 2
步骤2
firewall-cmd --reload