Linux commands (Open system port number/view port usage) __linux

Source: Internet
Author: User
Tags iptables

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  ]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.