one , Article background
Yesterday at the company server linux In the development environment , Several were deployed spring
boot Projects and nginx agent , After successful startup , Found local unreachable （Xshell It can be connected ）. So all kinds of wonder , Online search solution . In fact, the first thing I think of is, of course, whether the firewall is turned on , However, enter the command to query the firewall status , Found no permissions . After continuing the search , Found an article , The most critical point , Said it was an order “iptables
-F” It can be solved . Under the psychology of eager to solve , No matter 3721 executed this order , Not for a while , find Xshell Disconnected , Then it couldn't be connected . I thought the server was down , So I kept waiting .
two , Problem confirmation
After work today , The discovery server is still unable to connect , So I went online to check this order , It was found to be a huge pit . For unfamiliar linux System developers , Definitely a “ Big killer ”. If this order is in drop Implemented under policy , So congratulations , You can't connect to the server . Contact the administrator to restart .
three , Solution
By command 【sudo iptables -L | more】 View firewall policy , If the output is 【Chain INPUT (policy
DROP)】, Then enter the command 【sudo iptables -P INPUT ACCEPT】 Modify strategy , Then execute the command 【sudo iptables -L |
more】 The confirmation strategy is 【Chain INPUT (policy ACCEPT)】 after , Re execution 【sudo iptables -F】 You can clear all rules to temporarily stop the firewall .
PS： With the Internet , The server had better turn on the firewall , Recent and future , Network security is the most important high-voltage line in the information industry .