Home > Operation and Maintenance > Linux Operation and Maintenance > What should I do if the IP address cannot be accessed under Linux?

What should I do if the IP address cannot be accessed under Linux?

王林
Release: 2020-05-27 15:39:32
Original
4805 people have browsed it

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主机开放
Copy after login

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
Copy after login

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
Copy after login

You may also need to restart the service program to access the service port, such as: 9093.

Enable firewall filtering rules:

systemctl enable iptables  //设置开启启动
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template