1、端口开放:
安装iptables
apt-get update
apt-get install iptables
配置端口:入站端口
iptables -I INPUT -p tcp --dport 8888 -j ACCEPT
保存规则:
iptables-save
为了重启生效:
apt-get install iptables-persistent
netfilter-persistent save
netfilter-persistent reload
查看防火墙规则:
iptables -L
使得指定端口生效:
nc -l -p 8888
配置防火墙命令:
sudo apt-get install ufw
要打开端口21(FTP命令端口),端口20(FTP数据端口)和30000-31000(被动端口范围),
sudo ufw allow 20:21/tcp
sudo ufw allow 30000:31000/tcp
通过禁用和重新启用UFW重新加载UFW规则:
sudo ufw disable
sudo ufw enable
测试 请求:
apt-get install curl
curl http://www.baisu.com
查看网络端口使用情况:
apt install nmap -y
nmap 127.0.0.1
————————————————
版权声明:本文为CSDN博主「limonero」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_31319235/article/details/120366343
发表回复