Open System port number
A./sbin/iptables-i input-p TCP--dport 8181-j ACCEPT
B./etc/rc.d/init.d/iptables Save
C. The status of the port can be viewed through the following command:
/etc/init.d/iptables status
[Root@localhost qpid]#/etc/init.d/iptables Status
Table:filter
Chain INPUT (Policy ACCEPT)
Num Target prot opt source destination
1 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:5672
2 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:8181
3 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:3036
4 ACCEPT All--0.0.0.0/0 0.0.0.0/0 State related,established
5 ACCEPT ICMP--0.0.0.0/0 0.0.0.0/0
6 ACCEPT All--0.0.0.0/0 0.0.0.0/0
7 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:22
8 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
View Port Usage
[Root@localhost ~]# Netstat-an | grep 5672
TCP 0 0 0.0.0.0:5672 0.0.0.0:* LISTEN
TCP 0 0 127.0.0.1:54601 127.0.0.1:5672 established
TCP 0 0 127.0.0.1:54597 127.0.0.1:5672 established
TCP 0 0 127.0.0.1:54598 127.0.0.1:5672 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54595 established
TCP 0 0 172.16.8.40:5672 172.16.17.58:37440 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54596 established
TCP 0 0 127.0.0.1:54596 127.0.0.1:5672 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54599 established
TCP 0 0 127.0.0.1:54594 127.0.0.1:5672 established
TCP 0 0 172.16.8.40:5672 172.16.13.43:27250 established
TCP 0 0 172.16.8.40:5672 172.16.13.45:56504 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54600 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54601 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54594 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54598 established
TCP 0 0 172.16.8.40:5672 172.16.13.26:59208 established
TCP 0 0 127.0.0.1:54600 127.0.0.1:5672 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54597 established
TCP 0 0 127.0.0.1:5672 127.0.0.1:54325 established
TCP 0 0 127.0.0.1:54595 127.0.0.1:5672 established
TCP 0 0 127.0.0.1:54599 127.0.0.1:5672 established
TCP 0 0::: 5672:::* LISTEN
TCP 0 0:: ffff:127.0.0.1:54325:: ffff:127.0.0.1:5672 established
[Root@localhost ~]#
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////
Ps:
[root@localhost ~]# service iptables stop
iptables:setting chains to policy accept:filter &NB Sp [ ok ]
iptables:flushing firewall rules: &N Bsp [ ok ]
iptables:unloading modules: [ ok ]
[root@localhost ~]# service Iptables Start
iptables:applying firewall rules: [ ok ]