tag:blogger.com,1999:blog-47913358924040096772024-03-13T20:35:03.917-07:00Stateful NAT64 Anonymoushttp://www.blogger.com/profile/10331422087419827765noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-4791335892404009677.post-73553729092715384082013-12-12T10:08:00.000-08:002013-12-12T10:12:23.103-08:00Maintain that State...<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<br /></div>
<br />
Ankur : Taking into consideration TCP ,we have defined how the mappings are maintained for TCP session ,once the session expires this mapping is removed from cache the entry.<br />
<div>
<br /></div>
<div>
Charitha: So we need to keep track of tcp states and a timer that tracks the remaining lifetime of the TCP session .Once the timer expires the dynamically created mapping is removed from the cache entry.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Ankur : Now to define the states </div>
<div>
<br /></div>
<div>
V6 INIT: An IPv6 packet containing a TCP SYN was received,translated, and forwarded by the NAT64, implying that a TCP connection is being initiated from the IPv6 side. The NAT64 is</div>
<div>
now waiting for a matching IPv4 packet containing the TCP SYN in the opposite direction.</div>
<div>
<div>
the opposite direction.</div>
<div>
<br /></div>
<div>
ESTABLISHED: Represents an open connection, with data able to flow in both directions.</div>
<div>
<br /></div>
<div>
V4 FIN RCV: An IPv4 packet containing a TCP FIN was received by the NAT64, data can still flow in the connection, and the NAT64 is waiting for a matching TCP FIN in the opposite direction.</div>
<div>
<br /></div>
<div>
V6 FIN RCV: An IPv6 packet containing a TCP FIN was received bythe NAT64, data can still flow in the connection, and the NAT64 is waiting for a matching TCP FIN in the opposite direction.</div>
<div>
<br /></div>
<div>
V6 FIN + V4 FIN RCV: Both an IPv4 packet containing a TCP FIN and an IPv6 packet containing an TCP FIN for this connection were received by the NAT64. The NAT64 keeps the connection state alive and forwards packets in both directions for a short period of time to allow remaining packets (in particular, the ACKs) to be delivered.</div>
<div>
<br /></div>
<div>
TRANS: The lifetime of the state for the connection is set to TCP_TRANS minutes either because a packet containing a TCP RST was received by the NAT64 for this connection or simply because the</div>
<div>
lifetime of the connection has decreased and there are only TCP_TRANS minutes left. The NAT64 will keep the state for the connection for TCP_TRANS minutes, and if no other data packets for</div>
<div>
that connection are received, the state for this connection is then terminated.</div>
</div>
<div>
<br /></div>
<div>
<div>
CLOSED: CLOSED is a fictional state because it represents the state when there is no state for this</div>
<div>
particular cache entry, and therefore no connection.</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Charitha :we need a state machine for TCP processing.It should be noted that there is one state machine per connection, so only packets belonging to a given connection are inputs to the state machine associated to that connection.</div>
<div>
<br /></div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1b9Nks_cjgc9HGWPVhAV1HlREjiapac45cWXF1tc73Jb1Ajs4cqaPBIfspLFdg6yB8hhrFJ5k65ciwLnVuuDtTn0tQg7eo4HXHe936T0aDNkER6MUJfm_kgwd9eJDBWWsCH702L0nFPk/s1600/tayga+pool3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="332" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1b9Nks_cjgc9HGWPVhAV1HlREjiapac45cWXF1tc73Jb1Ajs4cqaPBIfspLFdg6yB8hhrFJ5k65ciwLnVuuDtTn0tQg7eo4HXHe936T0aDNkER6MUJfm_kgwd9eJDBWWsCH702L0nFPk/s400/tayga+pool3.png" width="400" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/10331422087419827765noreply@blogger.com0tag:blogger.com,1999:blog-4791335892404009677.post-30556250044406813142013-11-07T23:45:00.000-08:002013-11-08T03:06:27.079-08:00Walkthrough. Part 3<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: #fff9ee; color: #222222; font-family: Arial; font-size: 12px; font-style: italic; line-height: 13px; white-space: pre-wrap;">Getting to know finer details....end of Week 5</span><br />
<span style="background-color: #fff9ee; color: #222222; font-family: Arial; font-size: 12px; font-style: italic; line-height: 13px; white-space: pre-wrap;"><br /></span>
<br />
<div style="margin-bottom: 0in;">
<b>Ankur - </b>RFCs are so difficult to read.</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Charitha -</b> The IPv6 - IPv4 packet translation that is implemented by tayga is according to the RFC 6145. It defines how the IP header is translated for ICMP, TCP and UDP packets.</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Ankur -</b> Now Time to define and move step
by step about what we are going to do in the project</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Charitha -</b> Lets keep our goal simple
initial work at tranport layer then move up the stack.</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Ankur - </b>so We need to map many IPv6 to
one IPv4 system (in genral n to m mapping) Some how we need to
maintain the mapping .Better way would be extracting the port number
in tcp segment + IPv6 address –> mapped to new port number
generated by us + IPv4 address</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
<b>Charitha - </b>Yup got it we maintain a list
of values
</div>
<div style="margin-bottom: 0in;">
<br /></div>
<div style="margin-bottom: 0in;">
Our Binding Information Base of IP addresses would look like this.</div>
<div style="margin-bottom: 0in;">
<br /></div>
<table cellpadding="4" cellspacing="0" style="width: 100%px;">
<colgroup><col width="64*"></col>
<col width="64*"></col>
<col width="64*"></col>
<col width="64*"></col>
</colgroup><tbody>
<tr valign="TOP">
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0.04in;" width="25%"><div align="CENTER">
IPv6</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0.04in;" width="25%"><div align="CENTER">
Port</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: 1px solid #000000; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0.04in;" width="25%"><div align="CENTER">
IPv4</div>
</td>
<td style="border: 1px solid #000000; padding: 0.04in;" width="25%"><div align="CENTER">
New Port</div>
</td>
</tr>
<tr valign="TOP">
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%">2001:db8:1:ffff::1</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%"><div align="CENTER">
12345</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%"><div align="CENTER">
192.255.0.1</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0.04in; padding-top: 0in;" width="25%"><div style="text-align: center;">
23456</div>
</td>
</tr>
<tr valign="TOP">
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%">2001:db8:1:ffff::3</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%"><div align="CENTER">
80</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%"><div align="CENTER">
192.255.0.1</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0.04in; padding-top: 0in;" width="25%"><div style="text-align: center;">
34568</div>
</td>
</tr>
<tr valign="TOP">
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%">2001:db8:1:2010::1</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%"><div align="CENTER">
80</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in; padding-top: 0in;" width="25%"><div align="CENTER">
192.255.0.1</div>
</td>
<td style="border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: none; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0.04in; padding-top: 0in;" width="25%"><div style="text-align: center;">
27890</div>
</td>
</tr>
</tbody></table>
<div style="margin-bottom: 0in;">
</div>
<div style="margin-bottom: 0in;">
<br /></div>
<br />
<div style="margin-bottom: 0in;">
Ankur : exactly,We can have Port
numbers included in the cache structure which currently now maintains
one to one mapping. </div>
</div>
ankur sardahttp://www.blogger.com/profile/11710784592236881129noreply@blogger.com0tag:blogger.com,1999:blog-4791335892404009677.post-41834112555452837692013-11-07T23:44:00.000-08:002013-11-07T23:44:31.054-08:00Walkthrough. Part 2<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="background-color: #fff9ee; color: #222222; font-family: Arial; font-size: x-small; font-style: italic; line-height: 13px; white-space: pre-wrap;">Getting to know finer details....end of Week 5</span></div>
<div style="text-align: left;">
<br /></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Charitha -</b> Long time since we have updated the blog.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Ankur -</b> Yes, analyzing the code, we totally forget about updating the blog.
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">C
code is implemented here with great expertise. Even the simple list
implementation uses Macros, which is quite interesting.
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Charitha -</b> Yes, saw through it.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">#define
list_entry(x, TYPE, FIELD) \</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">({ \</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> const typeof( ((type *)0)->field )
*__mptr = (x); \</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> (type
*)( (char *)__mptr - offsetof(type, field) ); \</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">})</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
</div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">This gets
a pointer to the object containing x of type TYPE. This is something
new.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<br /></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Ankur -</b> Lets get back to where we stopped i.e read_from_tun(). </span><span style="font-family: Arial, Helvetica, sans-serif;">Once
the tun driver gets the packet, the stream is filled into <b>"recv_buf" </b>buffer. This stream is defined by structure below for IPv6, IPv4 and ICMP. </span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> struct </span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> {</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> struct tun_pi pi;</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> struct ip6 ip6;</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> struct ip6_frag ip6_frag;</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> } __attribute__ ((__packed__)) header;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> OR</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> struct</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;">struct tun_pi pi;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> struct ip4 ip4;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> } </span><span style="font-family: Arial, Helvetica, sans-serif;">__attribute__ ((__packed__)) header;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> OR</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;">struct</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;">struct tun_pi pi;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> struct ip4 ip4; or struct ip6 ip6;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> struct icmp icmp;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> } </span><span style="font-family: Arial, Helvetica, sans-serif;">__attribute__ ((__packed__)) header;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">T</span><span style="font-family: Arial, Helvetica, sans-serif;">un
driver adds its own header to the packet received. Hence it </span><span style="font-family: Arial, Helvetica, sans-serif;">has
to be excluded while taking the packet for conversion. </span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
</div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> data_len
= ret - sizeof(struct tun_pi);</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> where </span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> <b>struct tun_pi</b> is the header Tun driver adds to the packet it receives. </span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> <b>ret</b> = length of recv_buf.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">After
this, depending on the request, IPv4 or IPv6 handle
function is called </span><span style="font-family: Arial, Helvetica, sans-serif;">which gets the packet for manipulation.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"> handle_ip6(struct pkt *) or </span><span style="font-family: Arial, Helvetica, sans-serif;"> </span><span style="font-family: Arial, Helvetica, sans-serif;">handle_ip4(struct pkt *)</span><span style="font-family: Arial, Helvetica, sans-serif;"> </span></div>
<div style="margin-bottom: 0in; text-align: left;">
</div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">This
is where all the parsing ,check summing, checking of TTL(time to live)
and translation is taken care of by calling appropriate function.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Charitha -</b> Great !! Now concentrating on the function <b>xlate_4to6_data(struct pkt *) or </b></span><b style="font-family: Arial, Helvetica, sans-serif;">xlate_6to4_data(struct pkt *)</b><span style="font-family: Arial, Helvetica, sans-serif;"><b>,</b> </span><span style="font-family: Arial, Helvetica, sans-serif;">which
does the main translation.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">And what is </span><span style="font-family: Arial, Helvetica, sans-serif;">__attribute__ ((__packed__)) header? This is something new.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Ankur -</b> Oh ya, as we know structure definition basically has padding embedded into it
and hence sizeof will not always be the same sum member size. Well, "__attribute__ ((__packed__)" doesn't allow padding.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
</div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Charitha -</b> Now moving on.</span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;">Above mentioned function creates a cache entry where the mapping of IPv4 and IPv6 addresses are stored. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">But as we know this project aims to make NAT64 stateful, we need to store some extra information about the mapping, which is the port number of TCP or UDP packet.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div style="margin-bottom: 0in; text-align: left;">
<span style="font-family: Arial, Helvetica, sans-serif;"><b>Ankur - </b>Exactly, Next we will look at what needs to be done to accommodate port numbers as part of the mapping and how the translation happens.</span></div>
</div>
ankur sardahttp://www.blogger.com/profile/11710784592236881129noreply@blogger.com0tag:blogger.com,1999:blog-4791335892404009677.post-23140050929186412132013-10-14T22:37:00.002-07:002013-12-12T10:42:01.480-08:00Walkthrough. Part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-align: left;">
<br /></div>
<span style="font-family: Arial; font-size: 12px; font-style: italic; line-height: 1.15; white-space: pre-wrap;">Getting to know finer details....end of Week 3</span><br />
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 12px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - I guess the most difficult thing to do is figuring out the code others have written.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Yeah, I had a look at tayga implementation. It polls.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Same here! Tayga is written in C. As I was looking through the code, it consists of 5 implementation files and few header files.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The "main" is in tayga.c file, which reads command line arguments and the configuration file parameters.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For eg: tayga --mkTUN to make a TUN driver</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span> tayga --rmTUN to remove the TUN driver</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Configuration file parameters</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-indent: 36pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">TUN-device nat64 <span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span> # Name of the TUN driver</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-indent: 36pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ipv4-addr 192.168.255.1<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span> # Tayga’s IPv4 address</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-indent: 36pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">prefix 2001:db8:1:ffff::/96<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span># /96 prefix for IPv6 clients</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt; text-indent: 36pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">dynamic-pool 192.168.255.0/24<span class="Apple-tab-span" style="white-space: pre;"> </span># pool of assignable IPv4 addresses</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha -</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> As I remember from our previous conversation, TUN interfaces are a feature offered by Linux that can do user space networking, allowing user space programs to see raw network traffic at IP level.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Absolutely! You mentioned something about polling.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Once the TUN driver is created, the program attaches to the TUN interface where it gets a special file descriptor. The program uses poll() to wait for some event on the file descriptor.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> int poll(struct pollfd *fds, nfds_t nfds, int timeout);</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Poll waits for one of a set of file descriptors to become ready to perform I/O. The file descriptor we are talking about here is the TUN fd.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Another set of fd which it keeps track of is signals. These are user interrupt signals like SIGINT, SIGSTOP and also few other signals like SIGUSR1, SIGUSR2. </span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">From description of TUN interface, we know that it sends both IPv4 and IPv6 packet.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Yes So basically, the Program manipulates the IP packets(IPv4 to IPv6 and vice versa) and sends it back to the TUN interface.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Exactly. Have a look at this function in tayga.c file.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span> static void read_from_tun(void)</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> It reads the packets from TUN fd and forwards it for translation. </span></div>
<br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - Let me go and have a look at how the translation happens!</span></div>
</div>
ankur sardahttp://www.blogger.com/profile/11710784592236881129noreply@blogger.com1tag:blogger.com,1999:blog-4791335892404009677.post-27351946679248708582013-09-21T23:14:00.000-07:002013-12-12T10:44:24.090-08:00Intricacies in Simplicity<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: center;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<span style="font-family: Arial; font-size: 12px; font-style: italic; line-height: 13px; white-space: pre-wrap;">How does it work?....Week 1</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<b id="docs-internal-guid-2a6fa16c-444b-ec36-122a-b429a527998f" style="font-weight: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 12px; font-style: italic; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - I thought stateful implementation of TAYGA was going to be easy..!</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> - I know, when i looked at the number of files in the source code, it seemed so less. But nevertheless, this is an important project considering the fast depletion of IPv4 addresses. Hopefully it will be useful to people. </span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha -</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> That is true. The current version of TAYGA, which currently supports stateless NAT64 implementation uses TUN driver to exchange packets with the kernel. TAYGA maps IPv6 address to IPv4 address. But this mapping is 1:1. All we need to do it make this mapping N:1.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur - </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">You mean N number of IPv6 addresses have a single IPv4 address associated with it?</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha - </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Yes. By the way how did you install and see its working?</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur - </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Aha..! I downloaded the source from the website and did a normal installation as specified in the ReadMe. Initially I wasn't sure about the mapping is actually made. But it turned out to be quite simple.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">TAYGA first creates a NAT64 network interface.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">sudo tayga --mktun</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It directs set of IPv6 addresses to the network interface(NAT64). Lets say 2001:db8:1:ffff::/96(prefix). Also it has a pool of IPv4 addresses(192.168.255.0/24). So this is how it works. </span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If I ping to an address assigned to any network interface in the system, say 192.168.0.1, I need to ping from an IPv6 source to address 2001:db8:1:ffff::192.168.0.1 . TAYGA translates this packet to an IPv4 packet. It picks an IPv4 address from its pool(192.168.255.0/24) dynamically, unless specified statically in the config file and records this mapping.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Source IPv6 client to 2001:db8:1:ffff::192.168.0.1</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">192.168.255.x to 192.168.0.1</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Reverse order is used when sending packet back from IPv4 address to IPv6 address.</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Look at this for instance.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The mapping done in TAYGA for the ping request : </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">ping6 2001:db8:1:ffff::192.168.0.1</span><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaQL_zWAIHBw34-23MBlcp33V-hGXPxQCbESLctG0jymB3xDrCH9bW5MDC_OeWBAnhxJLB8-vQprucTnjWiNF1zLxDbqEoDfJ9uUJSojsKx88bK2y49XyXmO2g6RNdz4ZPhmjToWrkxJ0/s1600/blog2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="115" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaQL_zWAIHBw34-23MBlcp33V-hGXPxQCbESLctG0jymB3xDrCH9bW5MDC_OeWBAnhxJLB8-vQprucTnjWiNF1zLxDbqEoDfJ9uUJSojsKx88bK2y49XyXmO2g6RNdz4ZPhmjToWrkxJ0/s400/blog2.png" width="400" /></a></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha - </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Oh..! Does this mean that first and IPv6 client has to initiate the connection? And how did you see the functioning you just described?</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur - </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Yes, thats true. I used wireshark. The information was pretty detailed.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmPoz-i_dFEeZyXbiPyATD57pdRNk2U684sGUKsVLPxFSkOZPdboB29nbTW0nRyKjgV6weB8QnoPxlhnOO3dIxEtZtHTYlO3cs4b4cOxifX2vaS4VuxbUY958M9uYz_SWeIeOb4KC9mfQ/s1600/blog1.png" imageanchor="1" style="font-family: Arial; font-size: 15px; line-height: 1.15; margin-left: 1em; margin-right: 1em; text-align: center; white-space: pre-wrap;"><img border="0" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmPoz-i_dFEeZyXbiPyATD57pdRNk2U684sGUKsVLPxFSkOZPdboB29nbTW0nRyKjgV6weB8QnoPxlhnOO3dIxEtZtHTYlO3cs4b4cOxifX2vaS4VuxbUY958M9uYz_SWeIeOb4KC9mfQ/s400/blog1.png" width="400" /></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Ankur - </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">But how do we plan to make it stateful?</span></div>
<b style="font-weight: normal;"><br /><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></b>
<br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Charitha -</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> As you said, currently what TAYGA is doing is when you get a new hit from IPv6 network side it assigns a new IPv4 address from pool of IPv4 address .</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The response from IPv4 network side is attached with the NAT64 IPv6 prefix to get a valid IPv6 address and this packet is sent IPv6 destination.</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In brief How we could change this is when we get new request from IPv6</span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">generate a port number attach IPv4 to it.The IPv6 packets from same source will go to same mapping.In case a new IPv6 request is encountered a new port number is generated and same IPv4 is attached to it. We'll maintain this table in TAYGA. It is like multiplexing many IPv6 devices into a single IPv4 address.</span></div>
<br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span><span style="font-family: Arial; font-size: 15px; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;">Ankur - </span><span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;">Time to dive into the code..!</span></div>
Anonymoushttp://www.blogger.com/profile/10331422087419827765noreply@blogger.com1tag:blogger.com,1999:blog-4791335892404009677.post-24195959026753576172013-09-21T01:57:00.000-07:002013-10-14T22:07:29.077-07:00Stateful implementation of NAT64<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: center;">
<div style="text-align: left;">
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><b><br /></b></span></div>
</div>
<div style="text-align: left;">
<span id="docs-internal-guid-4e628f39-ba1b-a32c-4673-718cf29bd970"><span style="font-family: Arial; font-size: 12px; font-style: italic; vertical-align: baseline; white-space: pre-wrap;">The Beginning....Week 0</span></span></div>
<br /></div>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><b>What is NAT64? Why NAT64?</b></span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span><span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Lets answer <b>why</b> first! As we know IPv4 is 32 bits long address and it has an address range of 2<sup>32</sup> which is a total of <b>4,294,967,296</b> addresses. Due to expansion of network, setting up of huge data centers etc., IPv4 address will soon exhaust. <a href="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</a> has given lot of thought on the current scenario and hence concept of migration to IPv6 has come into picture.</span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Well, where does NAT64 come in all this discussion going on? If you didn't realize most of our network is <http: tayga="" www.litech.org="">attached to IPv4 address space. With emerging of new network of IPv6 , intercommunication with older IPv4 systems will be a potential problem. Both IPv6 and IPv4 have entire different architecture plus the translation isn't symmetric, i.e., IPv6 address space is a lot larger than IPv4 address space <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Frzai2%2Frzai2compipv4ipv6.htm">[read more]</a>. This is where NAT64 comes to the rescue. </http:></span><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span><span style="font-family: Arial; font-size: 15px; line-height: 17px; white-space: pre-wrap;">So <b>What</b> exactly is NAT64?<b> </b></span><span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><a href="http://en.wikipedia.org/wiki/NAT64">NAT64</a> is address translation mechanism that facilitates IPv6 network to communicate with IPv4 network and vice-versa. TAYGA implements NAT64.</span><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b>TAYGA! Now what's this?</b></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b><br /></b></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">TAYGA is stateless implementation of NAT64. It is a daemon that performs translation of packets between IPv4 and IPv6. TAYGA is coded in C language .</span></div>
<b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></b><b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">What is our role in this ?</b><br />
<b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></b>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">As we know, TAYGA is a stateless implementation. What we plan to do as a part of our project is to make it stateful.</span><br />
<b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></b>
<b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Ahh! Now what is the difference between TAYGA stateless and TAYGA stateful?</b><br />
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">In brief, currently TAYGA is implemented in such a way that it performs transparent mapping ,that is 1 to 1 mapping. For every IPv6 it assigns an IPv4 address. To make it <b>Stateful,</b> we are going to make N:1 mapping by maintaining the state via port number and IP address combination. Follow our blog to keep yourself posted.</span><br />
<b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><br /></b>
<b style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;">Want to enhance further understanding, to dive in deeeeeeeeep refer to.</b><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<ul style="text-align: left;">
<li><span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><a href="http://www.cisco.com/en/US/prod/collateral/iosswrel/ps6537/ps6553/white_paper_c11-676277.html">NAT64 stateless vs stateful</a> </span></li>
<li><span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><a href="http://www.litech.org/tayga/">TAYGA simple,no-fuss</a></span></li>
<li><span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><a href="http://tools.ietf.org/html/rfc6146">RFC(6146)</a></span></li>
</ul>
</div>
<span style="font-family: Arial; font-size: 15px; line-height: 1.15; white-space: pre-wrap;"><b>Want to try it out practically ?</b></span><br />
<div dir="ltr" style="line-height: 1.15; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Download TAYGA source code from <a href="http://www.litech.org/tayga/tayga-0.9.2.tar.bz2">here.</a></span></div>
<br />
<span style="font-family: Arial; font-size: 15px; vertical-align: baseline; white-space: pre-wrap;"></span></div>
Anonymoushttp://www.blogger.com/profile/10331422087419827765noreply@blogger.com0