<?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; linux</title>
	<atom:link href="http://1.21jiggawatts.net/blog/tag/linux/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>SLIP and slattach</title>
		<link>http://1.21jiggawatts.net/blog/2009/11/slip-and-slattach/</link>
		<comments>http://1.21jiggawatts.net/blog/2009/11/slip-and-slattach/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 05:11:51 +0000</pubDate>
		<dc:creator>TK</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[slip]]></category>

		<guid isPermaLink="false">http://arctanx.id.au/blog/?p=101</guid>
		<description><![CDATA[After some experimenting I've managed to get a semi-permanent 115kb/s SLIP connection between my main Debian server and a 486 running BSD. By semi-permanent, I mean as soon as there's a power cycle I'm going to have to run out with a laptop with DHCP server, a crossover cable and some patience to make it [...]]]></description>
			<content:encoded><![CDATA[<p>After some experimenting I've managed to get a semi-permanent 115kb/s SLIP connection between my main Debian server and a 486 running BSD. By semi-permanent, I mean as soon as there's a power cycle I'm going to have to run out with a laptop with DHCP server, a crossover cable and some patience to make it work again.</p>
<p>Here's a bit of odd behaviour from the BSD machine shown from /var/log/messages:</p>
<pre>Nov 20 03:08:33 cogline slattach[644]: SIGHUP on /dev/ttyd0 (sl-1); exiting</pre>
<p>This occurs when I run <code>slattach -s 115200 /dev/ttyd0</code> with nothing attached to the port, or when the other computer is connected and has been running slattach for "a while" (a minute or two?). Debian slattach has no difficulty running with the serial port in any condition, and if it's started reasonably soon before the BSD slattach, everything is fine.</p>
<p>Unfortunately this kind of problem makes it difficult to set up computers that will automatically negotiate a SLIP connection when they first turn on. I configured the BSD system to run slattach and the required ifconfig command on boot and it never works.</p>
<p>Normally SIGHUP is used to indicate that the carrier has dropped and a redial is necessary. The BSD slattach code reveals that the above message is simply what the SIGHUP handler does when no redial command is set, presumably before the interface has finished initialising because the "unit" is still "sl-1" instead of "sl0". I'm using a null modem cable so it makes sense that the carrier will go down when nothing is attached, but that doesn't explain the failure when both are running for a while.</p>
<p>Curious. Stay tuned, I might learn something.</p>
]]></content:encoded>
			<wfw:commentRss>http://1.21jiggawatts.net/blog/2009/11/slip-and-slattach/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>
		<item>
		<title>Gah, Fanboys</title>
		<link>http://1.21jiggawatts.net/blog/2009/08/gah-fanboys/</link>
		<comments>http://1.21jiggawatts.net/blog/2009/08/gah-fanboys/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 08:47:33 +0000</pubDate>
		<dc:creator>TK</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[annoying]]></category>
		<category><![CDATA[fanboy]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[righttoolforthejob]]></category>

		<guid isPermaLink="false">http://arctanx.id.au/blog/?p=55</guid>
		<description><![CDATA[I would like to put an uncomfortable spotlight on those computer geeks who think that they're cool because they use some particular piece of software. I have some authority to talk about those kind of people because I've been one before, but I hope that I've since grown out of such trivial rubbish. One common [...]]]></description>
			<content:encoded><![CDATA[<p>I would like to put an uncomfortable spotlight on those computer geeks who think that they're cool because they use some particular piece of software. I have some authority to talk about those kind of people because I've been one before, but I hope that I've since grown out of such trivial rubbish.</p>
<p>One common example of this in geek circles is LaTeX, the typesetting software distribution. There seems to be a gene in some people that gives them the warm fuzzies as soon as they find a cool piece of software which few others are using, <em>especially</em> if there's some slightly cryptic-looking syntax to prevent others from getting in on the action.</p>
<p>LaTeX is good, yes. It is not, however, a justification for the destruction of all word processors ever created and branding their users as people who work in dumb ways. Nor will it kill you to use a word processor if you have to, or if, heaven forbid, it's more convenient in a given situation. Your pathetic cries of inferiority only cause the attention you yearn for to be directed at somebody else.</p>
<p>Linux is a bigger example. If you like Linux, that's fine by me, whatever your reasons. I use it and love it too. But the moment you tell me that you cannot do your work on a Windows computer, it's not Windows' inferiority that's the problem. It's your inability to adjust, your lack of general technical expertise and your ego trying not to get crushed by the fact that your reputation for only using cool non-mainstream software will be sundered.</p>
<p>So what's acceptable here? I think it's pretty simple:</p>
<ul>
<li>Don't associate yourself with your tools (conversely, don't judge others by their tools)</li>
<li>Use the right tool for the job!</li>
</ul>
<p>We all like to poke fun at companies or their software which we don't like. I'm not complaining about that. A certain amount of banter and bitchiness is healthy and fun. But for goodness' sake, please don't get personal. It is the <em>software</em> which has strengths and weaknesses. Not you. What defines you as an effective computer person is being able to evaluate competing software products or technologies fairly and accurately, and being able to get the most of out each one.</p>
<p>Having done that you can use what you like, but don't come to me for help when you've hamstrung yourself with your own obsessions.</p>
]]></content:encoded>
			<wfw:commentRss>http://1.21jiggawatts.net/blog/2009/08/gah-fanboys/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Making iTunes Suck Less With Firefly</title>
		<link>http://1.21jiggawatts.net/blog/2009/06/making-itunes-suck-less-with-firefly/</link>
		<comments>http://1.21jiggawatts.net/blog/2009/06/making-itunes-suck-less-with-firefly/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 07:07:05 +0000</pubDate>
		<dc:creator>TK</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[compatibility]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[firefly]]></category>
		<category><![CDATA[flac]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[vorbis]]></category>
		<category><![CDATA[wma]]></category>

		<guid isPermaLink="false">http://arctanx.id.au/blog/?p=45</guid>
		<description><![CDATA[Friends of mine know that I have much to complain about where iTunes is concerned. To summarise what is a long rant (which I may someday write), the problems are poor support for file formats---Ogg Vorbis and FLAC in particular---and various UI issues. Getting a better music-playing program running on OS X is a secondary [...]]]></description>
			<content:encoded><![CDATA[<p>Friends of mine know that I have much to complain about where iTunes is concerned. To summarise what is a long rant (which I may someday write), the problems are poor support for file formats---Ogg Vorbis and FLAC in particular---and various UI issues. Getting a better music-playing program running on OS X is a secondary task in which I haven't yet succeeded. So let's think about how to bandaid some of iTunes' problems.</p>
<p>Today I'm going to present a possible solution to the first complaint: poor file format support. The accepted way to extend your OS X machine to play (oddball?) formats like FLAC seems to be to install the Xiph components for Quicktime. In my experience, this will usually convince Quicktime to play most things. Getting iTunes to look at the songs and store them in your library is another matter entirely. The best success I ever had with this method was getting about 1/3 of my considerable collection of FLACs to import.</p>
<p>Let's fix things up with a little bit of Firefly. No, not the unbelievably awesome Joss Whedon show (blast you, Fox!) but the also rather awesome <a href="http://www.fireflymediaserver.org/">Firefly Media Server</a>, formerly known as mt-daapd. I last played with this project a couple of years ago and it took some tinkering to make it work. There's been a bit of work done since then and now the latest build is in the Debian stable repository, so it's dead simple to set this up now.</p>
<p>"Debian? Isn't this a problem with iTunes on OS X?" you might be wondering to yourself now. Yes. You're right. Allow me to present the recipe for this particular solution:</p>
<p><strong>iTunes Make Support Go-Go</strong></p>
<p><span style="text-decoration: underline;">Ingredients</span></p>
<ul>
<li>One computer running Mac OS X with iTunes</li>
<li>One computer running Debian Linux</li>
<li>Your music in any of normal formats: MP3, OGG, FLAC, WMA, etc. stored on the Linux computer</li>
<li>Firefly Media Server</li>
<li>A LAN connecting to the two computers</li>
</ul>
<ol>
<li>Install the package with aptitude install mt-daapd</li>
<li>Edit /etc/mt-daapd.conf and set admin_pw to an admin password, mp3_dir to where your music is (<em>with</em> a trailing slash) and add any file extensions to the list of those it will serve. In my case, I had to add wma. You can also change the name of your server if you like.</li>
<li>/etc/init.d/mt-daapd start</li>
<li>Head to iTunes on the mac and notice either the name you set or "Firefly ..." appears in the shared libraries list.</li>
<li>Play your music. Observe how you can play songs in all formats regardless of whether iTunes supports them directly.</li>
</ol>
<p>The magic at work here is that Firefly will use ffmpeg to transcode any songs not natively supported by iTunes on the fly to uncompressed wave format.</p>
<p>One extra advantage is that you no longer need to use all the hard drive space on your mac, which can be handy if it's a laptop. One disadvantage is that you can only listen to your music when you're on the same LAN as the Linux box. Perhaps you should have thought about that before you paid the Mac tax and expected them to support your open formats properly. *sigh*</p>
<p><em>(serves as many as your Firefly server has the bandwidth to serve)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://1.21jiggawatts.net/blog/2009/06/making-itunes-suck-less-with-firefly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
