In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Linux system how to operate the network port, in response to this problem, this article details the corresponding analysis and solutions, hoping to help more small partners who want to solve this problem to find a simpler and easier way.
close port
The code is as follows:
iptables -A INPUT -p tcp --dport 111 -j DROP
open ports
The code is as follows:
iptables -A INPUT -p tcp --dport 111 -j ACCEPT
Develop discrete ports (including single):
The code is as follows:
iptables -A INPUT -p tcp -m multiport --dport 21,20 -j ACCEPT
Everything else is closed:
The code is as follows:
iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
Open Continuous Ports:
The code is as follows:
iptables -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 8001:8140 -j ACCEPT
You can also modify/etc/sysconfig/iptables directly. How to write it, refer to the open port, or fill in the command above.
Restart iptables
The code is as follows:
service iptables restart
Linux port occupied solution
Sometimes after closing the software, the background process dies, causing the port to be occupied. Take JBoss port 8083 occupied as an example to list the detailed resolution process.
Solution:
1. Find occupied ports
The code is as follows:
netstat -tln
netstat -tln | grep 8083
netstat -tln View port usage, while netstat -tln| grep 8083 is only used to view port 8083
2. Which program does the port belong to? Which process is the port occupied by?
The code is as follows:
lsof -i :8083
3. Kill the process occupying the port
The code is as follows:
kill -9
process ID
About Linux system how to operate the network port problem answer to share here, hope the above content can have some help to everyone, if you still have a lot of doubts not solved, you can pay attention to the industry information channel to learn 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.