当前位置:首页 > 技术文档 > 正文内容

CentOS安装rpcapd服务(WinPcap)

admin10年前 (2017-02-09)技术文档1711

因为需要用Wireshark进行远程抓包,需要在远程主机上安装相应的rpcapd服务。Windows上只要安装WinPcap软件就行了,它已经包含了rpcapd服务,只要启动就行了。但Linux上需要自己编译。 
注:Wireshark支持remote packet capture protocol协议远程抓包,只要在远程主机上安装相应的rpcapd服务例程就可以。
安装命令如下:

yum install glibc-static
wget http://www.winpcap.org/install/bin/WpcapSrc_4_1_2.zip
unzip WpcapSrc_4_1_2.zipcd winpcap/wpcap/libpcap
chmod +x configure runlex.sh
CFLAGS=-static ./configure
makecd rpcapd
make

然后
./rpcapd -n
就运行rpcap服务了。

但是,运行./rpcapd -n报如下错误

[root@iZ23gx7o02aZ rpcapd]# ./rpcapd -n
Press 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 save
iptables: 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 save
iptables: 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 restart
iptables: 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 -n
Press CTRL + C to stop the server...socket(): Address family supported by protocol (code 98)

修改成功!


分享到:

扫描二维码推送至手机访问。

版权声明:本文由云河空间发布,如需转载请注明出处。

本文链接:https://yuyunhe.cn/index.php/post/224.html

分享给朋友:

“CentOS安装rpcapd服务(WinPcap)” 的相关文章

PHP分页函数仿Google分页

/**  * 分页函数  * @param int $total    总页数  * @param int $pagesize 每页几条 &n...

抓取最近八天天气(非利用接口,直接从网站提取)

<?php    /*     *特别注意,第一天没有最高气温数据,第八天没有最低气温数据     *注意对数字进行过滤时不要忘记对负号进行判断   &nb...

dz中“QQ互联”出现Discuz! Database Error解决办法

dz中“QQ互联”出现Discuz! Database Error解决办法

dz中QQ登陆出现Discuz! Database Error解决办法dz站长朋友相信肯定有人遇到做的QQ互联登录,根本没法用,这让网站的社交登录性能大打折扣,这么解决?下面就看大神的神操作!...

Zend Studio 8打开utf-8文件出现乱码解决方法

Zend Studio 8打开utf-8文件出现乱码解决方法

今天安装了zend studio 8.0.1,运行了一个PHP程序项目(项目文件编码为utf-8),发现utf-8文件中的中文全部变成乱码了,后面终于经过寻找探索,找到了问题所 在:虽然你的项目是UTF-8编码文件,但是当通过zend studio工具运行打开时,是以工具里设定的GBK编码...

wamp虚拟主机配置

1、首先打开apache的配置文件httpd.conf,并去掉#Include conf/extra/httpd-vhosts.conf前面的#,启用虚拟主机功能2、先把localhost配置好,免得以后访问localhost出现问题,我的wamp项目根目录是D:\wamp\www。将下面信息添加到...

PHP数组和Json之间的转换

        之所以要用到Json,很多时候是因为使用ajax对象时,程序与JS函数之间的数据交互。因为JS不认识PHP中的数组,PHP也不认识JS中的数组或对象。Json很好的解决了这个问题。Json简介  ...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。