在Linux系统下,使用iptables或firewalld来配置防火墙规则,以允许或拒绝Telnet(默认端口23)流量。以下是两种常见的方法:
iptables查看当前的iptables规则:
sudo iptables -L -n
允许Telnet流量:
sudo iptables -A INPUT -p tcp --dport 23 -j ACCEPT
保存iptables规则:
sudo iptables-save > /etc/iptables/rules.v4
sudo service iptables save
重启iptables服务(如果需要):
sudo systemctl restart iptables
sudo systemctl restart iptables
firewalld查看当前的firewalld状态:
sudo firewall-cmd --state
允许Telnet流量:
sudo firewall-cmd --permanent --add-port=23/tcp
重新加载firewalld配置:
sudo firewall-cmd --reload
验证规则是否生效:
sudo firewall-cmd --list-all
通过以上步骤,你可以在Linux系统下配置防火墙规则,允许或拒绝Telnet流量。