In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
How to solve the problem that linux cannot be accessed by external hosts? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Reason:
Firewall issu
Solution:
Method 1: turn off the firewall
[root@localhost ~] # service iptables stop # turn off the firewall [root@localhost ~] # service iptables start # turn on the firewall [root@localhost ~] # service iptables status # View the firewall status
The command for cenOS7 or Red Hat7 to operate the firewall has changed, as follows:
[root@localhost ~] # systemctl stop firewalld.service # turn off the firewall [root@localhost ~] # systemctl start firewalld.service # turn on the firewall [root@localhost ~] # systemctl status firewalld.service # View the firewall status
Method 2: open the designated port
[root@localhost ~] # vim / etc/sysconfig/iptables:INPUT ACCEPT [0:0]: FORWARD ACCEPT [0:0]: OUTPUT ACCEPT [0:0]-An INPUT-m state-state RELATED ESTABLISHED-j ACCEPT-An INPUT-p icmp- j ACCEPT-An INPUT-I lo-j ACCEPT-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 22-j ACCEPT-An INPUT-m state-state NEW-m tcp-p tcp-dport 8080-j ACCEPT-An INPUT-j REJECT-reject-with icmp-host-prohibited-A FORWARD-j REJECT-- reject-with icmp-host-prohibited
Note: find the line-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 22-j ACCEPT, and add-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 8080-j ACCEPT after this line to open port 8080
[root@localhost ~] # service iptables restart # restart the firewall to take effect
CenOS7 or Red Hat7 open the port as follows:
[root@localhost ~] # firewall-cmd-- zone=public-- add-port=8080/tcp-- permanentsuccess [root@localhost ~ # firewall-cmd-- reload # Open port only needs to restart the firewall to take effect success
Note: open port command explanation
-zone scope
-add-port=8080/tcp add port, format: Port / communication protocol
-- permanent is in effect forever
So much for the answer on how to solve the problem that linux cannot be accessed by external hosts. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.