<?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>The Imaginary Part &#187; ipv6</title>
	<atom:link href="http://1.21jiggawatts.net/blog/tag/ipv6/feed/" rel="self" type="application/rss+xml" />
	<link>http://1.21jiggawatts.net/blog</link>
	<description>Just another Australian geek&#039;s perspective</description>
	<lastBuildDate>Thu, 29 Jul 2010 11:33:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Tracking ipv4/ipv6 usage</title>
		<link>http://1.21jiggawatts.net/blog/2010/02/tracking-ipv4ipv6-usage/</link>
		<comments>http://1.21jiggawatts.net/blog/2010/02/tracking-ipv4ipv6-usage/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 06:29:32 +0000</pubDate>
		<dc:creator>TK</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://arctanx.id.au/blog/?p=115</guid>
		<description><![CDATA[I discovered earlier today that through my trial ipv6 access I am using mostly ipv6 to access Google services. This made me wonder: just how much of my home network's communication with the outside world is through ipv6 compared with ipv4? I don't have any results yet, but this is how I'm measuring it using [...]]]></description>
			<content:encoded><![CDATA[<p>I discovered earlier today that through my trial ipv6 access I am using mostly ipv6 to access Google services. This made me wonder: just how much of my home network's communication with the outside world is through ipv6 compared with ipv4?</p>
<p>I don't have any results yet, but this is how I'm measuring it using Debian Linux.</p>
<p>Network traffic in the Linux kernel is managed through the tool iptables. Conveniently there are completely separate tables for ipv4 and ipv6 so I don't have to do anything to separate those. There are several chains which packets traverse depending on where they came from, where they're going and whether or not they're being routed on behalf another computer.</p>
<p>The chains of interest are INPUT, FORWARD and OUTPUT on the default table. INPUT receives all packets destined for this particular computer, FORWARD receives all packets which are being ferried on behalf of other computers (in my case, sharing Internet access with NAT) and OUTPUT receives all packets being sent from this particular computer, not on behalf of anyone else. By default all of these will simply allow the packets to pass unmolested.</p>
<p>What I've done is create four custom chains: ipv4_input_ppp0, ipv4_forward_in, ipv4_forward_out and ipv4_output_ppp0. They don't actually do anything, which permits the packets to continue onward, but iptables will keep track of how much traffic travels through each rule, both as a number of packets and in bytes.</p>
<p>Here is some output from "iptables -x -n -v -L" with these chains set up:</p>
<p><code>Chain INPUT (policy ACCEPT 617 packets, 92499 bytes)<br />
pkts      bytes target     prot opt in     out     source               destination<br />
41     5511 ipv4_input_ppp0  all  --  ppp0   *       0.0.0.0/0            0.0.0.0/0</code></p>
<p><code>Chain FORWARD (policy ACCEPT 46173 packets, 28090499 bytes)<br />
pkts      bytes target     prot opt in     out     source               destination<br />
21742 10919366 ipv4_forward_out  all  --  *      ppp0    0.0.0.0/0            0.0.0.0/0<br />
24431 17171133 ipv4_forward_in  all  --  *      eth0    0.0.0.0/0            0.0.0.0/0</code></p>
<p><code>Chain OUTPUT (policy ACCEPT 487 packets, 113453 bytes)<br />
pkts      bytes target     prot opt in     out     source               destination<br />
61     4783 ipv4_output_ppp0  all  --  *      ppp0    0.0.0.0/0            0.0.0.0/0</code></p>
<p>The rules are set up to use iptables' built in filtering capability. The ipv4_input_ppp0 rule will only collect packets which have an "in" interface of "ppp0". This means that packets from me sshing to my router from my LAN will not be counted. ipv4_output_ppp0 is handled the same way.</p>
<p>Similarly the destination interface is used to differentiate between incoming and outgoing traffic which is being forwarded by my router doing its router job, leading to counts in ipv4_forward_in and ipv4_forward_out.</p>
<p>This means we have direct byte counts which we can pull out of iptables and add together to get total incoming and outgoing ipv4 traffic. To make the information easier to process the counts can be zeroed at any time by running "iptables -Z".</p>
<p>The ipv6 setup is exactly the same except you use the tool ip6tables instead.</p>
<p>Here's my configuration for datalogging. I use the following in my firewall script which is run on boot to set up the chains and rules:</p>
<p><code><br />
iptables -F<br />
iptables -X</code></p>
<p><code>iptables -N ipv4_input_ppp0<br />
iptables -N ipv4_forward_in<br />
iptables -N ipv4_forward_out<br />
iptables -N ipv4_output_ppp0</code></p>
<p><code>iptables -A INPUT -i ppp0 -j ipv4_input_ppp0<br />
iptables -A FORWARD -o ppp0 -j ipv4_forward_out<br />
iptables -A FORWARD -o eth0 -j ipv4_forward_in<br />
iptables -A OUTPUT -o ppp0 -j ipv4_output_ppp0</code></p>
<p><code>iptables -Z</code></p>
<p><code>ip6tables -F<br />
ip6tables -X</code></p>
<p><code>ip6tables -N ipv6_input_ppp0<br />
ip6tables -N ipv6_forward_out<br />
ip6tables -N ipv6_forward_in<br />
ip6tables -N ipv6_output_ppp0</code></p>
<p><code>ip6tables -A INPUT -i ppp0 -j ipv6_input_ppp0<br />
ip6tables -A FORWARD -o eth0 -j ipv6_forward_in<br />
ip6tables -A FORWARD -o ppp0 -j ipv6_forward_out<br />
ip6tables -A OUTPUT -o ppp0 -j ipv6_output_ppp0</code></p>
<p><code>ip6tables -Z</code></p>
<p>Then I run this script every day at midnight from root's crontab:</p>
<p><code><br />
#!/bin/bash</code></p>
<p><code>ipv4_input_ppp0=`iptables -x -n -v -L | grep 'ipv4_input_ppp0' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`<br />
ipv4_forward_in=`iptables -x -n -v -L | grep 'ipv4_forward_in' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`<br />
ipv4_forward_out=`iptables -x -n -v -L | grep 'ipv4_forward_out' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`<br />
ipv4_output_ppp0=`iptables -x -n -v -L | grep 'ipv4_output_ppp0' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`</code></p>
<p><code>iptables -Z</code></p>
<p><code>ipv6_input_ppp0=`ip6tables -x -n -v -L | grep 'ipv6_input_ppp0' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`<br />
ipv6_forward_in=`ip6tables -x -n -v -L | grep 'ipv6_forward_in' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`<br />
ipv6_forward_out=`ip6tables -x -n -v -L | grep 'ipv6_forward_out' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`<br />
ipv6_output_ppp0=`ip6tables -x -n -v -L | grep 'ipv6_output_ppp0' | grep all | sed -e "s/\s\+/\t/g" | cut -f 3`</code></p>
<p><code>ip6tables -Z</code></p>
<p><code>ipv4_in=`echo "$ipv4_input_ppp0 + $ipv4_forward_in" | bc`<br />
ipv4_out=`echo "$ipv4_forward_out + $ipv4_output_ppp0" | bc`<br />
ipv6_in=`echo "$ipv6_input_ppp0 + $ipv6_forward_in" | bc`<br />
ipv6_out=`echo "$ipv6_forward_out + $ipv6_output_ppp0" | bc`</code></p>
<p><code>echo "$ipv4_in $ipv4_out $ipv6_in $ipv6_out" >> /var/log/traffic/ip</code></p>
]]></content:encoded>
			<wfw:commentRss>http://1.21jiggawatts.net/blog/2010/02/tracking-ipv4ipv6-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Native PPP IPv6 in Debian</title>
		<link>http://1.21jiggawatts.net/blog/2009/11/native-ppp-ipv6-in-debian/</link>
		<comments>http://1.21jiggawatts.net/blog/2009/11/native-ppp-ipv6-in-debian/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 12:59:10 +0000</pubDate>
		<dc:creator>TK</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://arctanx.id.au/blog/?p=94</guid>
		<description><![CDATA[My ISP has been doing a lot of work in the IPv6 department recently and amongst all their IPv6 offerings they have just started a trial for ADSL customers to run a dual IPv4/IPv6 PPP connection. They also run a broker to provide an IPv6 tunnel over IPv4, but this native solution is much neater. [...]]]></description>
			<content:encoded><![CDATA[<p>My ISP has been doing a lot of work in the IPv6 department recently and amongst <a href="http://ipv6.internode.on.net/">all their IPv6 offerings</a> they have just started a trial for ADSL customers to run a dual IPv4/IPv6 PPP connection. They also run a broker to provide an IPv6 tunnel over IPv4, but this native solution is much neater.</p>
<p>Here's how I've set it up on my home Debian server so that it will provide IPv6 addresses to my home network:</p>
<ol>
<li>Add <code>+ipv6</code> to /etc/ppp/peers/dsl-provider</li>
<li>I had to change the username in dsl-provider and in /etc/ppp/chap-secrets to use a different hostname, as this is how Internode knows you want to connect to the IPv6 trial server.</li>
<li>Start the DSL connection with "pon dsl-provider", resulting in a connection ppp0 which has both an IPv4 internet address, and a <em>local</em> fe80:: IPv6 address</li>
<li>Ensure eth0 has a local IPv6 address too, using ifconfig. I was messing about and lost it, and got it back by resetting with <code>ifdown eth0; ifup eth0</code></li>
<li>Now to get a real IPv6 prefix you need an IPv6 DHCP client. At Internode's suggestion I installed the WIDE client (package wide-dhcpv6-client in Debian). The given working configuration for a PPP connection ppp0 and local ethernet connection eth0 is placed in /etc/wide-dhcpv6/dhcp6c.conf as follows:<br />
<code>interface ppp0 {<br />
send ia-pd 0;<br />
script "/etc/wide-dhcpv6/dhcp6c-script";<br />
};</code><code><br />
id-assoc pd {<br />
prefix-interface eth0 {<br />
sla-id 0;<br />
sla-len 4;<br />
};<br />
};</code></li>
<li>When you install the WIDE DHCPv6 client it starts automatically, with an non-useful config. Restart it with <code>invoke-rc.d wide-dhcpv6-client restart</code>. Hopefully now an "ifconfig" will show that you have successfully attached a 2001:: prefix address to your eth0 interface.</li>
<li>Add a default route -- this doesn't happen automatically. Run the command:<br />
<code>route --inet6 add default dev ppp0</code><br />
This will add a default route through the gateway on your PPP connection.</li>
<li>At this point there is working IPv6 connectivity on the local machine. It can be tested with "ping6 ipv6.google.com":<br />
<code># ping6 ipv6.google.com<br />
PING ipv6.google.com(tx-in-x68.1e100.net) 56 data bytes<br />
64 bytes from tx-in-x68.1e100.net: icmp_seq=1 ttl=56 time=171 ms<br />
64 bytes from tx-in-x68.1e100.net: icmp_seq=2 ttl=56 time=172 ms</code></li>
<li>To set up advertising of addresses and routing I referred to Martin Krafft's excellent <a href="http://madduck.net/docs/ipv6/">IPv6 with Debian</a> documentation. In summary, the configuration I had to do was to set /proc/sys/net/ipv6/conf/all/forwarding to 1, which can be made permanent by setting it in /etc/sysctl.conf, and to set up radvd.</li>
<li>radvd (which is also the name of the package) will provide IPv6 addresses from the allocated /64 prefix to hosts on the local network. Install the package. I set my /etc/radvd.conf to the following, which uses the prefix I was allocated, as found from ifconfig:<br />
<code>interface eth0<br />
{<br />
AdvSendAdvert on;<br />
AdvLinkMTU 1280;<br />
prefix 2001:44b8:7c90:be0::/64<br />
{<br />
AdvOnLink on;<br />
AdvAutonomous on;<br />
};<br />
};</code></li>
<li>Now other machines with IPv6 support which are connected via the eth0 interface should be allocated an address and will be able to access the IPv6 Internet too.</li>
</ol>
<p>I have a fun ISP who gives me toys to play with. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://1.21jiggawatts.net/blog/2009/11/native-ppp-ipv6-in-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
