CentOS安裝rpcapd服務(WinPcap)

來源:互聯網
上載者:User

因為需要用Wireshark進行遠程抓包,需要在遠程主機上安裝相應的rpcapd服務。Windows上只要安裝WinPcap軟體就行了,它已經包含了rpcapd服務,只要啟動就行了。但Linux上需要自己編譯。 
註:Wireshark支援remote packet capture protocol協議遠程抓包,只要在遠程主機上安裝相應的rpcapd服務常式就可以。
安裝命令如下:

yum install glibc-staticwget http://www.winpcap.org/install/bin/WpcapSrc_4_1_2.zipunzip WpcapSrc_4_1_2.zipcd winpcap/wpcap/libpcapchmod +x configure runlex.shCFLAGS=-static ./configuremakecd rpcapdmake

然後
./rpcapd -n
就運行rpcap服務了。

但是,運行./rpcapd -n報如下錯誤

[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -nPress CTRL + C to stop the server...socket(): Address family not supported by protocol (code 97)

原因:在linux上,連接埠有可能沒有開放,這時需要修改iptables服務的配置來開放2002連接埠。
解決辦法:
1. CentOS下/etc/sysconfig/下找不到iptables檔案
2. Linux中iptables配置詳細(轉)
參考Linux中iptables配置詳細(轉)修改iptables服務的配置來開放2002連接埠。

首先要做的是給咱的SSH進行ACCEPT配置,以免直接無法串連的情況發生:

1. 如果SSH連接埠是22(這裡不建議用預設連接埠最好改掉SSH連接埠)
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
注意要/etc/rc.d/init.d/iptables save,以下每一步都最好執行一遍此語句,以下不再累述。

[root@iZ23gx7o02aZ sysconfig]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT[root@iZ23gx7o02aZ sysconfig]# iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT[root@iZ23gx7o02aZ sysconfig]# /etc/rc.d/init.d/iptables saveiptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ][root@iZ23gx7o02aZ sysconfig]#

2. 修改iptables開放2002連接埠 
iptables -A INPUT -p tcp --dport 2002 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 2002 -j ACCEPT
最後注意需要再執行一下 /etc/init.d/iptables save,這樣這兩條語句就儲存到剛才那個/etc/sysconfig/iptables 檔案中了。

[root@iZ23gx7o02aZ sysconfig]# iptables -A INPUT -p tcp --dport 2002 -j ACCEPT[root@iZ23gx7o02aZ sysconfig]# iptables -A OUTPUT -p tcp --sport 2002 -j ACCEPT[root@iZ23gx7o02aZ sysconfig]# /etc/init.d/iptables saveiptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ][root@iZ23gx7o02aZ sysconfig]# 

3. 查看iptables的內容

[root@iZ23gx7o02aZ sysconfig]# vi iptables  1 # Generated by iptables-save v1.4.7 on Wed Dec 10 21:20:39 2014  2 *filter  3 :INPUT ACCEPT [4602:266675]  4 :FORWARD ACCEPT [0:0]  5 :OUTPUT ACCEPT [5004:417513]  6 -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT  7 -A INPUT -p tcp -m tcp --dport 2002 -j ACCEPT  8 -A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT  9 -A OUTPUT -p tcp -m tcp --sport 2002 -j ACCEPT 10 COMMIT 11 # Completed on Wed Dec 10 21:20:39 2014

4. 重啟iptables
重啟指令:service iptables restart

[root@iZ23gx7o02aZ sysconfig]# service iptables restartiptables: Setting chains to policy ACCEPT: filter          [  OK  ]iptables: Flushing firewall rules:                         [  OK  ]iptables: Unloading modules:                               [  OK  ]iptables: Applying firewall rules:                         [  OK  ][root@iZ23gx7o02aZ sysconfig]# 

5. 運行./rpcapd -n

[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -nPress CTRL + C to stop the server...socket(): Address family supported by protocol (code 98)

修改成功。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.