<?xml version="1.0" encoding="ISO-8859-1"?>
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>
	<channel>
		<title>The Corelatus Blog - Entries from March 2010</title>
		<description>Entries from March 2010</description>
                <link>../../../</link>

	
	<item>
		<title>Decoding the Gb Interface with Wireshark</title>
		<link>../../../Decoding_the_Gb_Interface_with_Wireshark.html</link>        
		<guid isPermaLink="true">../../../Decoding_the_Gb_Interface_with_Wireshark.html</guid>
                <pubDate>Wed, 31 Mar 2010 22:26:29 GMT</pubDate>
		<description>&lt;p&gt; 
The Gb interface is part of the packet radio data network (GPRS) in GSM,
it sits between the BSC and the SGSN and carries subscriber data headed
to and from the internet.&lt;/p&gt;

&lt;p&gt;
Wireshark understands how to decode the Gb interface, so you can use
wireshark to look through data sniffed from a Gb interface by a
Corelatus GTH.  Here&#39;s what it looks like:
&lt;/p&gt;

&lt;img alt=&#39;wireshark screenshot&#39; style=&#39;margin-left:-170px&#39; src=&#39;static/gsm_gb_interface_screenshot.png&#39;/&gt;

&lt;h3&gt;How to tell the GTH to capture Gb&lt;/h3&gt;

&lt;p&gt;To look at a GPRS network like this, you need to do a few things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connect one of the GTH&#39;s E1 interfaces to the E1 (or T1) interface
carrying the Gb interfaces. You typically do that at a cross connect
panel, using a G.772 monitor point.&lt;/li&gt;

&lt;li&gt;Enable the E1 interface you connected.&lt;/li&gt;

&lt;li&gt;Tell the GTH to start decoding frame relay on that interface&lt;/li&gt;

&lt;li&gt;Convert the captured data to the file format which wireshark understands,
  libpcap.&lt;/li&gt;

&lt;li&gt;Open the captured file in wireshark. (On unix-like operating systems,
  including OSX, you can also pipe into wireshark to get a live view of
  the capture.)&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;Taking those steps one at a time, starting with #2:&lt;/p&gt;

&lt;h4&gt;Enable the E1 interface&lt;/h4&gt;

&lt;pre&gt;
&lt;code&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;set &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;pcm3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;&amp;gt;&amp;lt;attribute &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;monitoring&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;true&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&amp;lt;/set&amp;gt;&lt;/span&gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;h4&gt;Tell GTH start decoding frame relay&lt;/h4&gt;

&lt;p&gt;The Gb interface uses frame relay on E1. Different sites use
different configurations of timeslots. One common setup is to use
timeslots 1--15. Another common setup is to 1--15 + 17--31. The
GTH can handle any setup.&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;new&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;fr_monitor &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;ip_addr&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;172.16.2.1&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;ip_port&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;1234&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;pcm_source &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;span&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;timeslot&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;1&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;pcm_source &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;span&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;timeslot&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;2&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;pcm_source &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;span&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;timeslot&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
      ..
      &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;pcm_source &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;span&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;3A&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt; &lt;/span&gt;&lt;span class=&quot;synType&quot;&gt;timeslot&lt;/span&gt;=&lt;span class=&quot;synConstant&quot;&gt;&#39;15&#39;&lt;/span&gt;&lt;span class=&quot;synIdentifier&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;/fr_monitor&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;&amp;lt;/new&amp;gt;&lt;/span&gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;h4&gt;Convert the captured data&lt;/h4&gt;

&lt;p&gt;GTH sends out data in a format described in
the &lt;a href=&#39;www.corelatus.com/gth/api/gth_api.pdf&#39;&gt;API manual&lt;/a&gt;.
Wireshark wants the data to be in libpcap format. save_to_pcap.erl, in
the &lt;a href=&#39;http://www.corelatus.com/gth/api/gth_erlang_api.zip&#39;&gt;sample
Erlang code for GTH&lt;/a&gt; can do the conversion, like this:
&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;save_to_pcap:from_file&lt;/span&gt;(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;/tmp/captured.raw&amp;quot;&lt;/span&gt;, &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;/tmp/captured.pcap&amp;quot;&lt;/span&gt;)&lt;span class=&quot;synSpecial&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;
  A lazier approach is to let save_to_pcap.erl configure the GTH and
start the capture:
&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
  &lt;span class=&quot;synIdentifier&quot;&gt;save_to_pcap:frame_relay&lt;/span&gt;(&lt;span class=&quot;synConstant&quot;&gt;&amp;quot;172.16.2.7&amp;quot;&lt;/span&gt;, &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;3A&amp;quot;&lt;/span&gt;, &lt;span class=&quot;synIdentifier&quot;&gt;lists:seq&lt;/span&gt;(&lt;span class=&quot;synConstant&quot;&gt;1&lt;/span&gt;,&lt;span class=&quot;synConstant&quot;&gt;15&lt;/span&gt;), &lt;span class=&quot;synConstant&quot;&gt;&amp;quot;gprs.pcap&amp;quot;&lt;/span&gt;)&lt;span class=&quot;synSpecial&quot;&gt;.&lt;/span&gt;
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;  
  The &lt;a href=&#39;http://www.corelatus.com/gth/api/gth_c_examples.zip&#39;&gt;C version
    &lt;/a&gt;of save_to_pcap can currently only convert MTP-2, not frame
    relay. If you want it extended, send mail.
&lt;/p&gt;


&lt;h4&gt;Start up wireshark&lt;/h4&gt;

&lt;p&gt;
By default, wireshark decodes frame relay as &#39;FRF 3.2/CISCO HDLC&#39;.
That&#39;s not quite what we want. Go to Edit/Preferences/Protocols/FR
and change the encapsulation to &#39;GPRS Network Service&#39;. Now you
get full decoding.
&lt;/p&gt;

</description>
	</item>
	
        </channel>
</rss>

