Home >Operation and Maintenance >Linux Operation and Maintenance >What should I do if the IP address cannot be accessed under Linux?
The solution is as follows:
1. Edit the /etc/sysconfig/iptables configuration file and add the following configuration:
-A INPUT -m state --state NEW -m tcp -p tcp -s 127.0.0.1 --dport 6379 -j ACCEPT //对本机开放 -A INPUT -m state --state NEW -m tcp -p tcp -s 126.212.173.185 --dport 6379 -j ACCEPT //对126.212.173.185主机开放
If you do not restrict the ip to be open to all hosts, you can remove -s [ip].
In a newly installed Linux system, the firewall is disabled by default, and generally no firewall policy is configured, so the /etc/sysconfig/iptables file does not exist.
Solution:
Installation:
yum install iptables-services
After successful installation: you can find the /etc/sysconfig/iptables configuration file and follow the above steps to write the port that is open to the outside world. .
2. After modification, you need to restart the iptables service. The command is as follows:
systemctl start iptables
You may also need to restart the service program to access the service port, such as: 9093.
Enable firewall filtering rules:
systemctl enable iptables //设置开启启动
Recommended tutorial: linux tutorial
The above is the detailed content of What should I do if the IP address cannot be accessed under Linux?. For more information, please follow other related articles on the PHP Chinese website!