Linux iptables 添加端口限制规则后不生效?

本机IP 132.228.27.62
iptables原有规则为空
[root@cssxtyxthapp03 sysconfig]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
增加规则,允许以下IP访问50083端口
[root@cssxtyxthapp03 sysconfig]# iptables -A INPUT -p tcp -m iprange --src-range 132.252.3.6-132.252.3.12 --dport 50083 -j ACCEPT
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]# iptables -A INPUT -p tcp -s 132.228.27.55,132.228.27.56,132.228.27.57,132.228.27.62,132.228.27.63,132.228.27.64,132.228.27.77 --dport 50083 -j ACCEPT
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 source IP range 132.252.3.6-132.252.3.12 tcp dpt:50083
ACCEPT tcp -- 132.228.27.55 0.0.0.0/0 tcp dpt:50083
ACCEPT tcp -- 132.228.27.56 0.0.0.0/0 tcp dpt:50083
ACCEPT tcp -- 132.228.27.57 0.0.0.0/0 tcp dpt:50083
ACCEPT tcp -- 132.228.27.62 0.0.0.0/0 tcp dpt:50083
ACCEPT tcp -- 132.228.27.63 0.0.0.0/0 tcp dpt:50083
ACCEPT tcp -- 132.228.27.64 0.0.0.0/0 tcp dpt:50083
ACCEPT tcp -- 132.228.27.77 0.0.0.0/0 tcp dpt:50083
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]#
重启服务
[root@cssxtyxthapp03 sysconfig]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
[root@cssxtyxthapp03 sysconfig]#
[root@cssxtyxthapp03 sysconfig]#

[root@cssxtyxthapp03 sysconfig]# telnet 132.228.27.62 50083
Trying 132.228.27.62...
telnet: connect to address 132.228.27.62: Connection refused
[root@cssxtyxthapp03 sysconfig]
自己访问自己失败

请问你,你本机有 50083 的侦听吗?如果没有,就肯定不能telnet,因为你都没对应的端口在侦听。