Linux 命令(開放系統連接埠號碼/查看連接埠使用方式)__Linux

來源:互聯網
上載者:User

開放系統連接埠號碼

a.      /sbin/iptables -I INPUT -p tcp --dport 8181 -j ACCEPT

b.      /etc/rc.d/init.d/iptables save

c.      可以通過以下命令查看連接埠的狀態:

/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


查看連接埠使用方式

[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          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@localhost ~]# service iptables start
iptables: Applying firewall rules:                         [  OK  ]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.