<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>wireshark &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/wireshark/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Fri, 02 Dec 2022 07:59:12 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Wireshark Debug 遠端的機器</title>
		<link>https://richliu.com/2014/12/18/1715/wireshark-debug-%e9%81%a0%e7%ab%af%e7%9a%84%e6%a9%9f%e5%99%a8/</link>
					<comments>https://richliu.com/2014/12/18/1715/wireshark-debug-%e9%81%a0%e7%ab%af%e7%9a%84%e6%a9%9f%e5%99%a8/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 18 Dec 2014 12:40:17 +0000</pubDate>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[nc]]></category>
		<category><![CDATA[tcpdump]]></category>
		<category><![CDATA[wireshark]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1715</guid>

					<description><![CDATA[<p>這個是最近從客戶那邊看到的, 回來之後覺得很有趣, 應該要學起來, 以後 debug 比較方便. 一般要 mi [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2014/12/18/1715/wireshark-debug-%e9%81%a0%e7%ab%af%e7%9a%84%e6%a9%9f%e5%99%a8/">Wireshark Debug 遠端的機器</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>這個是最近從客戶那邊看到的, 回來之後覺得很有趣, 應該要學起來, 以後 debug 比較方便.</p>



<p>一般要 mirror 遠端機器上的流量會使用具有 port mirror 的 switch, 這樣就可以得到完整的封包了, 但是如果沒有 port mirror 的機器怎麼辦呢? 這時候就只好用其他方式, 像是 ssh or nc</p>



<span id="more-1715"></span>



<p>這邊就不講 ssh 了, 很多 embedded system 是沒有 ssh 的.</p>



<p>這個方式不適用於 Windows 版的 Wireshark, 但是理論上 Windows 版的 Wireshrak 應該可以配合 Winpcap 做到同樣的事情. 以下講的是 Linux 版的</p>



<p>首先, 在 wireshark 的機器上先執行 nc , nc 沒有辦法直接輸出到 fifo 的檔案上, 所以要接個 tee 指令</p>



<pre class="wp-block-preformatted">mkfifo /tmp/temp.pcap
nc -k -l -p 9999| tee > /tmp/temp.pcap</pre>



<p>然後在 target 機器上執行</p>



<pre class="wp-block-preformatted">tcpdump -s 0 -U -n -w - -i eth0 not host 10.1.1.1 | nc 10.1.1.1 9999</pre>



<p>再回來 wireshark 的機器上執行</p>



<pre class="wp-block-preformatted">cat /tmp/temp.pcap | wireshark -k -i -</pre>



<pre class="wp-block-preformatted">這樣應該就可以順利的執行了. BUT, 人生最機車的就是還有這個 BUT.</pre>



<p>我有一組機器 Wireshark 跑在 ubuntu 12.04 上沒有辦法照上面那些指令執行, 猜想可能是 wireshark 版本的問題, 這時候請改用以下命令</p>



<p>首先, 在 wireshark 的機器上先執行 nc</p>



<pre class="wp-block-preformatted">mkfifo /tmp/temp.pcap
nc -k -l -p 9999| tee > /tmp/temp.pcap</pre>



<p>然後在 target 機器上執行</p>



<pre class="wp-block-preformatted">dumpcap -P -w - -i eth0 -f 'not host 10.1.1.1' | nc 10.1.1.1 9999</pre>



<p>再回來 wireshark 的機器上執行</p>



<pre class="wp-block-preformatted">wireshark -k -i /tmp/temp.pcap</pre>



<p>這樣, 祝各位順利.</p>



<p>如果沒有 dumpcap 可以改用 tcpdump<br />在有 GUI 的機器執行</p>



<pre class="wp-block-preformatted"><br />wireshark -k -i /tmp/temp.pcap</pre>



<p>在 Target Board 上執行</p>



<pre class="wp-block-preformatted"><br />ssh root@192.168.110.2 "tcpdump -s 0 -U -n -w - -i eth0 not port 22" > /tmp/temp.pcap;</pre>



<p></p>



<p>這樣也可以</p>



<p>ref:<br /><a href="http://d0pefishsec.blogspot.tw/2010/04/monitoring-remote-traffic-with-tcpdump.html" target="_blank" rel="noopener">Monitoring remote traffic with tcpdump and netcat </a><br /><a href="http://wiki.wireshark.org/CaptureSetup/Pipes" target="_blank" rel="noopener">Pipes</a> (ssh 可以參考這一篇)<br /><a href="https://bytefreaks.net/applications/how-to-process-tcpdump-live-data-stream-from-a-remote-machine-on-a-local-wireshark" target="_blank" rel="noopener">How to process tcpdump live data stream from a remote machine on a local WireShark</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2014/12/18/1715/wireshark-debug-%e9%81%a0%e7%ab%af%e7%9a%84%e6%a9%9f%e5%99%a8/">Wireshark Debug 遠端的機器</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2014/12/18/1715/wireshark-debug-%e9%81%a0%e7%ab%af%e7%9a%84%e6%a9%9f%e5%99%a8/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Linux] Wireshark 抓到超過 MTU 的封包.</title>
		<link>https://richliu.com/2013/09/11/1505/linux-wireshark-%e6%8a%93%e5%88%b0%e8%b6%85%e9%81%8e-mtu-%e7%9a%84%e5%b0%81%e5%8c%85/</link>
					<comments>https://richliu.com/2013/09/11/1505/linux-wireshark-%e6%8a%93%e5%88%b0%e8%b6%85%e9%81%8e-mtu-%e7%9a%84%e5%b0%81%e5%8c%85/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 11 Sep 2013 14:30:45 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[ethtool]]></category>
		<category><![CDATA[gro]]></category>
		<category><![CDATA[offload]]></category>
		<category><![CDATA[packet]]></category>
		<category><![CDATA[wireshark]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1505</guid>

					<description><![CDATA[<p>在 Linux Wireshark 有時候會抓到比 MTU Size 更大的封包, ex: 2336, 516 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2013/09/11/1505/linux-wireshark-%e6%8a%93%e5%88%b0%e8%b6%85%e9%81%8e-mtu-%e7%9a%84%e5%b0%81%e5%8c%85/">[Linux] Wireshark 抓到超過 MTU 的封包.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>在 Linux Wireshark 有時候會抓到比 MTU Size 更大的封包, ex: 2336, 5160 .. etc.</p>
<p>這個問題源自於 Linux NIC driver enable GRO (Generic Receive Offload), 這功能會將數個封包組合成一個大封包以增加速度.</p>
<p><span id="more-1505"></span>這時可以用 ethtool 去修改網路卡的參數</p>
<p>使用 ethtool -k &lt;interface&gt; 查看狀況.</p>
<p>[TEXT]</p>
<p># ethtool -k eth0<br />
Features for eth0:<br />
rx-checksumming: on<br />
tx-checksumming: off<br />
tx-checksum-ipv4: off<br />
tx-checksum-ip-generic: off [fixed]<br />
tx-checksum-ipv6: off [fixed]<br />
tx-checksum-fcoe-crc: off [fixed]<br />
tx-checksum-sctp: off [fixed]<br />
scatter-gather: off<br />
tx-scatter-gather: off<br />
tx-scatter-gather-fraglist: off [fixed]<br />
tcp-segmentation-offload: off<br />
tx-tcp-segmentation: off<br />
tx-tcp-ecn-segmentation: off [fixed]<br />
tx-tcp6-segmentation: off [fixed]<br />
udp-fragmentation-offload: off [fixed]<br />
generic-segmentation-offload: off [requested on]<br />
generic-receive-offload: on<br />
large-receive-offload: off [fixed]<br />
rx-vlan-offload: on<br />
tx-vlan-offload: on<br />
ntuple-filters: off [fixed]<br />
receive-hashing: off [fixed]<br />
highdma: off [fixed]<br />
rx-vlan-filter: off [fixed]<br />
vlan-challenged: off [fixed]<br />
tx-lockless: off [fixed]<br />
netns-local: off [fixed]<br />
tx-gso-robust: off [fixed]<br />
tx-fcoe-segmentation: off [fixed]<br />
fcoe-mtu: off [fixed]<br />
tx-nocache-copy: off<br />
loopback: off [fixed]<br />
rx-fcs: off<br />
rx-all: off<br />
[/TEXT]</p>
<p>我們發現 generic-receive-offload: on<br />
然後可以用這個命令<br />
# ethtool &#8211;offload eth0 gro off<br />
關掉GRO, 這樣抓下來的封包就會正常了.</p>
<p>ref.</p>
<p><a href="http://www.wireshark.org/lists/wireshark-users/201206/msg00076.html" target="_blank" rel="noopener">Re: [Wireshark-users] wireshark sees jumbo TCP packets in linux</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2013/09/11/1505/linux-wireshark-%e6%8a%93%e5%88%b0%e8%b6%85%e9%81%8e-mtu-%e7%9a%84%e5%b0%81%e5%8c%85/">[Linux] Wireshark 抓到超過 MTU 的封包.</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2013/09/11/1505/linux-wireshark-%e6%8a%93%e5%88%b0%e8%b6%85%e9%81%8e-mtu-%e7%9a%84%e5%b0%81%e5%8c%85/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
