<?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>Jkx@home &#187; firewall</title>
	<atom:link href="http://www.larsen-b.com/tags/firewall/feed" rel="self" type="application/rss+xml" />
	<link>http://www.larsen-b.com</link>
	<description>Titanium Exposé</description>
	<lastBuildDate>Wed, 20 May 2026 16:33:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Media Player (Dvico 3100) + Netgear WGT634U = Cheap Wifi Media Player</title>
		<link>http://www.larsen-b.com/Article/258.html</link>
		<comments>http://www.larsen-b.com/Article/258.html#comments</comments>
		<pubDate>Thu, 05 Apr 2007 21:10:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[dvico]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[rs232]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[Wifi]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This year, for my birthday I have a very nice Media Player M3100. This stuff is really usefull, no need to use a noisy computer to watch recorded Divx. It&#8217;s pretty kool to watch films from beds you know.. The &#8230; <a href="http://www.larsen-b.com/Article/258.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This year, for my birthday I have a very nice Media Player <a class="reference" href="http://www.tvix.co.kr/eng/Products/M3100U.aspx">M3100</a>. This stuff is really usefull, no need to use a noisy computer to watch recorded Divx. It&#8217;s pretty kool to watch films from beds you know..</p>
<p>The only issue: I need to take it back to my computer when I want to upload a new film, that&#8217;s it .. When I first received this gift, I went back to the shop to exchange it against a networked one. But 1) they cost a lot more money, 2) not available at the shop. (even if it&#8217;s a really big one).</p>
<p>Last week, somebody sent me a mail. He found some cheap wireless access point with a USB port: Netgear <a class="reference" href="http://kbserver.netgear.com/products/WGT634U.asp">WGT634U</a>. (50Euro) Hum, ok let&#8217;s give it a try. First test, plug a Media Player to this USB port&#8230; ok It&#8217;s working fine. But you know, I don&#8217;t have a network cable near my bed, so I decided to transform the Access Point in a Wireless client. By this way, I can simply plug the Media Player on the WGT634U and remotely put some Divx via FTP, without any wire.</p>
<div id="step-1-install-openwrt" class="section">
<h1><a name="step-1-install-openwrt">Step 1 / Install OpenWRT</a></h1>
<p>The default firmware on the WGT634 doesn&#8217;t support wireless client mode (It&#8217;s a AP). So I switched it to <a class="reference" href="http://wiki.openwrt.org/OpenWrtDocs/Hardware/Netgear/WGT634U">OpenWRT</a> Kamikaze. I build the firmware from source, but the kamikaze snapshot shoud work too. I followed the OpenWRT guide step by step with a external serial plug. You can find the complete howto for the serial connection <a class="reference" href="http://members.shaw.ca/swstuff/wgt634u.html">here</a></p>
<pre class="literal-block"># hit Ctrl-C on the bootloader
CFE&gt; ifconfig eth0 -auto
CFE&gt; flash -noheader tftp_host:openwrt-wgt634u.bin flash0.os
CFE&gt; reboot</pre>
<p>The first boot is a bit long, but all is fine&#8230;</p>
</div>
<div id="step-2-install-tools" class="section">
<h1><a name="step-2-install-tools">Step 2  / Install tools</a></h1>
<p>Here the short list of needed tools:</p>
<ul class="simple">
<li>kmod-usb2</li>
<li>kmod-usb-storage</li>
<li>kmod-vfat</li>
<li>kmod-nls-base, kmod-nls-cp437, kmod-nls-iso8859-1</li>
<li>pure-ftpd</li>
</ul>
<p>with a simple ipkg install via the serial console</p>
</div>
<div id="step-3-configure-openwrt-in-wireless-client" class="section">
<h1><a name="step-3-configure-openwrt-in-wireless-client">Step 3 / Configure OpenWRT in wireless client</a></h1>
<p>This is really simple in kamikaze, only change some files:</p>
<p>The wireless config file need to be tweaked, as I want it to join my MyDummySSID network</p>
<p><em>/etc/config/wireless</em></p>
<pre class="literal-block">config wifi-iface
option device   wifi0
option network  lan
option mode     sta
option ssid     MyDummySSID
option hidden   0
option encryption none</pre>
<p>Let&#8217;s go for the network config: MyDummySSID Access Point is 192.168.3.0/24, gateway in 3.1 and local DNS server is 1.254</p>
<p><em>/etc/config/network</em></p>
<pre class="literal-block">#### LAN configuration
config interface lan
option type     bridge
option ifname   "eth0.0"
option proto    'static'
option ipaddr   '192.168.3.2'
option netmask  '255.255.255.0'
option gateway  '192.168.3.1'
option dns      '192.168.1.254'</pre>
<p>First test: <em>ifdown wan</em> (switch off network) / <em>ifdown br-lan</em> / <em>ifup br-lan</em></p>
</div>
<div id="step-4-firewall" class="section">
<h1><a name="step-4-firewall">Step 4 / Firewall</a></h1>
<p>Ok that&#8217;s fine, but I want to restrict the access to my local network only.. so I need to hack the firewall a little to avoid remote access from other wireless clients (my wireless network is open you know..). Simply linked this little script in /etc/rc.d/</p>
<p><em>/opt/ftp-firewall</em></p>
<pre class="literal-block">#!/bin/sh

# clear all firewall rules
for T in filter nat mangle ; do
iptables -t $T -F
iptables -t $T -X
done

# drop incomming packet
iptables -P FORWARD ACCEPT
iptables -P OUTPUT  ACCEPT
iptables -P INPUT   DROP

# accept traffic on localhost
iptables -A INPUT -p tcp -i lo -j ACCEPT
iptables -A INPUT -p udp -i lo -j ACCEPT

# accept ftp only from my home network
iptables -A INPUT -s 192.168.1.0/24 -p tcp -i br-lan --dport 21 -j ACCEPT

# accept incoming http / ssh
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT

# finaly accept already open Cnx
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</pre>
</div>
<div id="step-5-misc" class="section">
<h1><a name="step-5-misc">Step 5 / Misc</a></h1>
<p>After some tests, I discover that I need a way to know if the WGT634U managed to join the wireless network or no. So I added this little script, that check for the wireless BSSID, and turn the power led in yellow if something goes wrong .. this is really usefull in fact.</p>
<p><em>/opt/led-daemon</em></p>
<pre class="literal-block">#!/bin/sh

while true
do
{
STATE=$(iwconfig ath0 |grep  00:13:13:53:DA:D1 | wc -l)
[ $STATE -eq 1 ] &amp;&amp; echo 0 &gt; /proc/diag/led/power
[ $STATE -eq 0 ] &amp;&amp; echo 1 &gt; /proc/diag/led/power
sleep 20
}
done</pre>
<p>Foo</p>
</div>
<div id="step-6-finally" class="section">
<h1><a name="step-6-finally">Step 6 / Finally</a></h1>
<p>Here the result:</p>
<div class="image"><img src="http://jkx.larsen-b.com/photos/Electronic/DSC02573.sized.jpg" alt="http://jkx.larsen-b.com/photos/Electronic/DSC02573.sized.jpg" /></div>
<p>The finished product (grrr) works really fine and managed to achieve something like 850Ko/sec, I mean full speed ;) (11Mbs network) I need to remove the serial port right now, and close the box..</p>
<p><strong>Important update</strong></p>
<p>I read on Engadget that I use this to stream video to my TV, (like the Apple TV do), but this is absolutely wrong. This media player has a <strong>320Go hard-drive</strong>. Why would stream film on this ? I just put it on that&#8217;s it :)</p>
<p>This is really amazing how people doesn&#8217;t read the article to see what I&#8217;ve done. It&#8217;s not the first time this happen in fact.</p>
<p>Here in France, most advanded users have some network TV from a long time, and this little boxes can play network stream (like the Apple TV) for a long time now. Beside you don&#8217;t pay for this service (rent for the boxes are included in DSL bill), the only issue is that you must have another computer to stream.</p>
<p>I guess nobody here (in France) would by a Apple TV, since we already have this kind of products for free for a long time. Look at a <a class="reference" href="http://fr.wikipedia.org/wiki/Freebox">Freebox</a> for example.</p>
<p><strong>It&#8217;s time to watch a film :)</strong></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/258.html/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Packet filtering w/ Python and Linux</title>
		<link>http://www.larsen-b.com/Article/177.html</link>
		<comments>http://www.larsen-b.com/Article/177.html#comments</comments>
		<pubDate>Mon, 01 Nov 2004 14:32:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Network]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[While looking for a fun way to filter my WIFI traffic, I decided to look at userland firewall API in Python. I found: ipqueue. I haven&#8217;t really wrote a full featured app with it, but here the first things to &#8230; <a href="http://www.larsen-b.com/Article/177.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>While looking for a fun way to filter my WIFI traffic, I decided to look at userland firewall API in Python. I found: <a class="reference" href="http://woozle.org/~neale/src/ipqueue/">ipqueue</a>.</p>
<p>I haven&#8217;t really wrote a full featured app with it, but here the first things to make it work.</p>
<pre class="literal-block"># load the kernel queue module
modprobe ip_queue
# all outgoing ping will pass throught the queue
iptables -A OUTPUT -p icmp -j QUEUE</pre>
<p>Now here a little script that act as the queue</p>
<pre class="literal-block">import ipqueue

q = ipqueue.IPQ(ipqueue.IPQ_COPY_PACKET)

while 1:
p = q.read()
pID = p[ipqueue.PACKET_ID]

print pID
# accept the packet
q.set_verdict(pID,ipqueue.NF_ACCEPT)</pre>
<p>Next step, simply run this script with the root privilege, and you will see outgoing ping print on the stdout.</p>
<p>Additionnal note: <a class="reference" href="http://woozle.org/~neale/src/ipqueue/">ipqueue</a> only works on python2.2 right now, I hope Neale will fix that soon. Anyway this is really a nice piece of code thanks guy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/177.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
