六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 70|回复: 0

Linux下用wireshark

[复制链接]

升级  78%

9

主题

9

主题

9

主题

童生

Rank: 1

积分
39
 楼主| 发表于 2013-2-7 03:50:12 | 显示全部楼层 |阅读模式
down了wireshark工具在linux机器上很久了,但每次打开都不能像windows下那样正常运行,还以为自己安装的有问题,直到前几天才从一个同事那里的得知,在linux下用wireshark需要root权限的,试了一下,哈,果然是这样.结果搜了一下,人家wireshark安装平台信息里白纸黑字的写着呢,自己从来就没读过:Running Wireshark (or any other network capture/analyzer, for that matter) on Linux needs root privileges. Therefore, you have to have root privileges when starting Wireshark, else you can't capture data. Please note that you don't have to login as root when starting your computer, you can use su(1) or sudo(8) for that purpose.

如果觉得在su模式下不安全,wireshark开发组建议使用tcpdump.(especially when you want to do a remote capture and do not want the network load associated with running Wireshark remotely).命令格式:tcpdump -i <interface> -s 65535 -w <some-file>
,(note:/tcpdump still run as root).常用的方法其实是写到脚本里,放到/usr/bin 下运行。比如:
      A=fxp0
      B=fxp1
      SU tcpdump -i $A -s 2000 -w /tmp/A.pcap  &
      pidA=$!
      SU tcpdump -i $B -s 2000 -w /tmp/B.pcap &
      pidB=$!
      trap "kill $pidA $pidB 2>/dev/null" 0 1 2 15
      wait
(note:terminate the capture with ^C ),
然后在普通模式下,直接wireshark /tmp/A.pcap 就可以看到抓取的包信息了。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表