<?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>64k &#187; communication</title>
	<atom:link href="http://www.64k-tec.de/tag/communication/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.64k-tec.de</link>
	<description>Software development and more ...</description>
	<lastBuildDate>Tue, 10 Jan 2012 21:58:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>FRITZ!Box tuning part 3: Using the VoIP phone line from everywhere</title>
		<link>http://www.64k-tec.de/2010/02/fritzbox-tuning-part-3-using-the-voip-phone-from-everywhere/</link>
		<comments>http://www.64k-tec.de/2010/02/fritzbox-tuning-part-3-using-the-voip-phone-from-everywhere/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 12:24:27 +0000</pubDate>
		<dc:creator>cp</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Root]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[FritzBox]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[phone calls]]></category>
		<category><![CDATA[remote access]]></category>
		<category><![CDATA[softphone]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://www.64k-tec.de/?p=667</guid>
		<description><![CDATA[The contract with my Internet service provider includes a VoIP connection. Together with the FRITZ!Box 7270 all phone calls are done over the Internet, an additional conventional phone connection isn't necessary anymore. One of the benefits of this is that you can connect to your registrar from everywhere in the world. But that's theory, cause [...]]]></description>
			<content:encoded><![CDATA[<p>The contract with my Internet service provider includes a VoIP connection. Together with the FRITZ!Box 7270 all phone calls are done over the Internet, an additional conventional phone connection isn't necessary anymore. One of the benefits of this is that you can connect to your registrar from everywhere in the world. But that's theory, cause e.g. my provider doesn't allow a connection if you are not in the network of the provider itself. Of course there are free services like <a href="http://www.sipgate.de" target="_blank">sipgate</a> or even Skype. There you could make free calls within the services itself, but as soon as you like to call a real phone number you have to pay. They are cheap, no question, but my contract includes a flat rate within Germany. That's even cheaper. So what I like to do is to use my VoIP phone connection even when I'm not at home. In the following third part of the FRITZ!Box tuning <a href="/tag/fritzbox/">series</a>, I will explain how to achieve this. As already said in the first two post, where you at least should read the <a href="http://www.64k-tec.de/2010/01/fritzbox-tuning-part-1-enable-remote-access-over-ssh/">first</a> one, I'm not responsible for anything happens to your FRITZ!Box after you have tried what is described here.</p>
<h2>Adding a softphone to the FRITZ!Box</h2>
<p>The FRITZ!Box fully supports softphones in its basic configuration. Adding new softphones is done in the web frontend in the extended configuration section. There is a wizard for this, where you have to answer some question about your new device. Select phone as device, LAN/WLAN (IP-Phone) for the connection type, choose a name and a password. You get a new internal phone number which usually starts at 620 for the first created device. The FRITZ!Box try's than to connect to the new device. You can skip this for now. After that you have to select which official phone number the new device should use. This is important cause this will be displayed as the caller id when you make a call. Now you could choose if the new softphone should react on all incoming calls, regardless of the phone number called, or only on a specific one.</p>
<h2>Configuring the client software</h2>
<p>I will explain the client setup with the help of a free VoIP software called <a href="http://code.google.com/p/telephone/" target="_blank">Telephone</a>. It's only available for Mac OS X, but there are many other VoIP clients out there which also works for other operation systems. After downloading and installing it you have to create a new account. Select a descriptive name for the account. For the domain use <em>fritz.box</em>, as username you have to use the internal number the FRITZ!Box selected above. Lets use 620 for now. The password is the one you chose previously. After the account is created, I had to select <em>Substitute "00" for "+"</em> in the advanced settings, cause the phone numbers in my address book are all saved with the international phone prefix of Germany which is +49. Assuming you are working in your home network right now, you should be able to connect with Telephone to your FRITZ!Box. Some simple tests like making an outgoing and incoming call with an additional mobile phone should verify a working setup. Some nice features like the Mac OS X Address Book integration, which also transfers incoming caller id's to real names if they are found in the address book, making Telephone a really useful application. For further phone call management functionality on Mac OS X, I can advice you to take a look at the also free software <a href="http://nexem.info/nexem-dev/" target="_blank">Frizzix</a>.</p>
<h2>Allowing calls from everywhere</h2>
<p>All the previously isn't any magic, cause it uses build in support of the FRITZ!Box. But this article is about allowing connections to the VoIP part of the FRITZ!Box from everywhere. To make this happen we have to edit an internal configuration file of the FRITZ!Box. This time we aren't change the ar7.cfg file, but a file called <code class="path">/var/flash/voip.cfg</code>. As the name suggest there is most of the VoIP configuration included. Use nvi to edit it and search for a section called <em>extensions</em>. There should be a newly created one which have a value <em>extension_number</em> with 620. Change the value <em>reg_from_outside</em> from <em>no</em> to <em>yes</em>. This section should then look like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">extensions <span style="">&#123;</span>
    <span style="color: #000099;">enabled</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><span style="color: #666666; font-style: italic;">;</span>
    <span style="color: #000099;">username</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;$$$$SSFSDFSOPKSFDOPK;LWE§REWSDFMKFSLDF3232SDFSDFSDF&quot;</span><span style="color: #666666; font-style: italic;">;</span>
    <span style="color: #000099;">authname</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;&quot;</span><span style="color: #666666; font-style: italic;">;</span>
    <span style="color: #000099;">passwd</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;$$$$DFS342ASDFSDFDSFDS§344WLKKHMSJHAJHASDAHQASLKADJSA&quot;</span><span style="color: #666666; font-style: italic;">;</span>
    <span style="color: #000099;">extension_number</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 620</span><span style="color: #666666; font-style: italic;">;</span>
    <span style="color: #000099;">reg_from_outside</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><span style="color: #666666; font-style: italic;">;</span>
    <span style="color: #000099;">tx_packetsize_in_ms</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span><span style="color: #666666; font-style: italic;">;</span>
<span style="">&#125;</span></pre></div></div>

<p>Save the file and reboot your FRITZ!Box by typing <code>reboot</code>. Next we have to tell Telephone to use a proxy when connecting to the FRITZ!Box. Go to the advanced settings and add your DynDNS name, in this example it would be <em>xtestx.dyndns.org</em>, to the proxy field. That's all. Now you should be able to make calls from every network you are currently logged in.</p>
<h2>Conclusion</h2>
<p>This simple change to the internal configuration of the FRITZ!Box allows you to use your VoIP account from everywhere over the world. As nice this feature is, I like to add some words of caution at the end. First you need a good download and especially a good upload connection speed in your home setup, cause all phone calls are routed over the FRITZ!Box. Secondly I didn't know if VoIP transfers are encrypted in any way, so be aware that there is the possibility someone monitor your calls. And as last note you should understand that you opened a port on your FRITZ!Box for everyone, which in the case your password is stolen, could be abused. In the worst case someone use your account to SPAM other people or call expensive service numbers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.64k-tec.de/2010/02/fritzbox-tuning-part-3-using-the-voip-phone-from-everywhere/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>FRITZ!Box tuning part 2: Access your home network with OpenVPN</title>
		<link>http://www.64k-tec.de/2010/02/fritzbox-tuning-part-2-access-your-home-network-with-openvpn/</link>
		<comments>http://www.64k-tec.de/2010/02/fritzbox-tuning-part-2-access-your-home-network-with-openvpn/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 18:38:47 +0000</pubDate>
		<dc:creator>cp</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Root]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[FritzBox]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[PKI]]></category>
		<category><![CDATA[remote access]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://www.64k-tec.de/?p=379</guid>
		<description><![CDATA[AVM has built a VPN server into the FRITZ!Box, why should I use some other software for this job, you may ask. The reason is quite simple: the build in one is a piece of closed source software written by AVM and there is only one official client which could be used to connect to [...]]]></description>
			<content:encoded><![CDATA[<p>AVM has built a VPN server into the FRITZ!Box, why should I use some other software for this job, you may ask. The reason is quite simple: the build in one is a piece of closed source software written by AVM and there is only one official client which could be used to connect to it, the FRITZ!VPN software. This client software is only available for the Windows operation system family and so by no means anything useful to me. I'm pretty sure they are using some official protocol like <a href="http://en.wikipedia.org/wiki/IPsec" target="_blank">IPSec</a>, so it might be possible to connect to the FRITZ!Box with other clients as well, but that's something I didn't want to try. <a href="http://openvpn.net" target="_blank">OpenVPN</a> on the other side is a rock solid open source software which could be used from many popular OS's these days. Even graphical clients, like <a href="http://code.google.com/p/tunnelblick/" target="_blank">TunnelBlick</a> for Mac OS X, are available. So here comes the second article of the FRITZ!Box tuning <a href="/?s=FRITZ!Box+tuning">series</a>, which will explain how to convert your FRITZ!Box into a OpenVPN server, where any number of clients can concurrently be connected. I highly recommend to read the <a href="http://www.64k-tec.de/2010/01/fritzbox-tuning-part-1-enable-remote-access-over-ssh/">first part</a> of this series, because this post is build on top of the stuff done there. This count especially for the filesystem layout on the usbstick and the way additional software is started. Also in the following it will be helpful to have ssh access to the FRITZ!Box all the time. As already written in the first part, there is no guarantee that the information presented here will work on your side or that I'm responsible for anything happen to your FRITZ!Box. In preparation of the following you need access to a second OpenVPN installation which will be used to create all necessary certificates and keys and which could be used to test the installation afterward. I'm using a Gentoo Linux host where you could install OpenVPN simply by executing <code>emerge openvpn</code>. Make sure you have the <strong>examples</strong> USE flag set to get all the helper scripts which make the life much more easier.</p>
<h2>The agony of choice</h2>
<p>OpenVPN could be configured in many different ways. So first of all we have to decide which features of OpenVPN we will use. In its simplest variant OpenVPN could be used with one preshared static key. The advantage of this setup type is the easy configuration. The disadvantage is that only one client could be connected at the time. That is not what we want, so we will configure our setup to be using a <a href="http://en.wikipedia.org/wiki/Public_key_infrastructure" target="_blank">Public Key Infrastructure</a> (PKI). This allows more than one client to be connected at the time and it is possible to mark single keys invalid without affecting other client keys. The second question which has to be answered is, if we want use routing or bridging in our setup. Again, routing is simpler to set up and also a little bit faster than bridging. Bridging on the other side allows the tunneling of non IP protocols such as IPX, tunnel all the IP broadcast and make it possible to use the same subnet on the client side as on the server-side. Especially the last point is a nice feature as with routing all hosts on the server-side needs a routing table entry to find the connected clients. But my main reason for preferring bridging over routing is the broadcast feature of the first one. In my home network works a NAS station as a file server. This includes of course simple filesystem sharing with AFP and NFS, but also serves this box audio data with the <a href="http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol" target="_blank">Digital Audio Access Protocol</a> (DAAP). DAAP is used by Apple in iTunes to share music with other clients in the network and that is what my NAS station does. This protocol, as well AFP, using broadcast messages (ZeroConf) to find some potential clients. So now it should be clear why I want bridging, it allows me to hear music or to simply connect to my file station without any interaction.</p>
<h2>Building up a PKI</h2>
<p>To create all necessary certificates and keys we are using the <em>easy-rsa</em> scripts from OpenVPN. They are located under <code class="path">/usr/share/openvpn/easy-rsa</code>. First we change the <code class="path">vars</code> file. On the bottom of the file are personal information defined which should be changed to fit to your environment. The entries looking as follow on my side (with a pseudo email address).</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">export KEY_COUNTRY<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;DE&quot;</span>
export KEY_PROVINCE<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;Sachsen&quot;</span>
export KEY_CITY<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;Dresden&quot;</span>
export KEY_ORG<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;64k&quot;</span>
export KEY_EMAIL<span style="color: #000066; font-weight:bold;">=</span><span style="color: #933;">&quot;you@yourdomain.org&quot;</span></pre></div></div>

<p>You could also increase the <strong>KEY_SIZE</strong> from 1024 to 2048 within that file. This should make your keys unbreakable for the next few <span style="text-decoration: line-through;">decades</span> years. Now we are ready to create the master-key and the master certificate of the Certificate Authority (CA) by executing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> vars
.<span style="color: #000000; font-weight: bold;">/</span>clean-all
.<span style="color: #000000; font-weight: bold;">/</span>build-ca</pre></div></div>

<p>Please be aware that this will delete all previously created keys. Answering all questions with the default values should be sufficient. Next the key for the server has to be created.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build-key-server server</pre></div></div>

<p>You can again accept all default values. A challenge password is not necessary, but you have to sign the certificate. Now its time for our first client key and certificate. You could the following repeat again and again, for every new client you want allow to access the OpenVPN server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build-key client</pre></div></div>

<p>Again, don't forget to sign the key. If you ever have to mark a client certificate invalid you could do it with the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>revoke-full client</pre></div></div>

<p>This will create or update a Certificate Revocation List (CRL)<em> </em> file which will be later used by the server to verify the certificate integrity of a connecting client. For now we create an empty one with</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">KEY_CN</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #007800;">KEY_OU</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #007800;">KEY_NAME</span>=<span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #007800;">$OPENSSL</span> ca <span style="color: #660033;">-gencrl</span> <span style="color: #660033;">-out</span> keys<span style="color: #000000; font-weight: bold;">/</span>crl.pem <span style="color: #660033;">-config</span> <span style="color: #007800;">$KEY_CONFIG</span></pre></div></div>

<p>The last step in this key building marathon is to create a <a href="http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange" target="_blank">Diffie-Hellman</a> key. This key will be used to initiate the secure channel between the two parties. Its created by:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build-dh</pre></div></div>

<h2>Creating the server and client configuration</h2>
<p>We start with the configuration of the server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># set the path to the tap device</span>
dev tap
dev-node <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tap0
mssfix
tun-mtu <span style="color: #000000;">1500</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># TCP or UDP server?</span>
proto udp
port <span style="color: #000000;">1194</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># CA and key files</span>
ca <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>ca.crt
cert <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>server.crt
key <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>server.key
crl-verify <span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>crl.pem <span style="color: #666666; font-style: italic;"># this is opened after the chroot</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Diffie hellman parameters</span>
<span style="color: #c20cb9; font-weight: bold;">dh</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>dh1024.pem
&nbsp;
<span style="color: #666666; font-style: italic;"># bridge setup</span>
server-bridge 192.168.220.1 255.255.255.0 192.168.220.50 192.168.220.99
mode server
tls-server
push <span style="color: #ff0000;">&quot;dhcp-option DNS 192.168.220.1&quot;</span>
&nbsp;
ifconfig-pool-persist ipp.txt
client-to-client
&nbsp;
<span style="color: #666666; font-style: italic;"># compression?</span>
comp-lzo
&nbsp;
<span style="color: #666666; font-style: italic;"># The maximum number of concurrently connected clients we want to</span>
<span style="color: #666666; font-style: italic;"># allow.</span>
max-clients <span style="color: #000000;">20</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># It's a good idea to reduce the OpenVPN daemon's privileges after</span>
<span style="color: #666666; font-style: italic;"># initialization.</span>
user nobody
group nobody
&nbsp;
<span style="color: #666666; font-style: italic;"># Put openvpn in a jail.</span>
<span style="color: #c20cb9; font-weight: bold;">chroot</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>openvpn
&nbsp;
<span style="color: #666666; font-style: italic;"># The persist options will try to avoid accessing certain resources on</span>
<span style="color: #666666; font-style: italic;"># restart that may no longer be accessible because of the privilege</span>
<span style="color: #666666; font-style: italic;"># downgrade.</span>
persist-key
persist-tun
&nbsp;
<span style="color: #666666; font-style: italic;"># where to log</span>
log-append <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>openvpn.log
&nbsp;
<span style="color: #666666; font-style: italic;"># verbose level for debugging</span>
;verb <span style="color: #000000;">4</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># make sure the connection is kept alive</span>
keepalive <span style="color: #000000;">10</span> <span style="color: #000000;">120</span></pre></div></div>

<p>For bridged mode it is essential that OpenVPN uses a TAP device and not the TUN device mode (see <a href="http://en.wikipedia.org/wiki/TUN/TAP" target="_blank">here</a> for the reason). We use UDP as the transport protocol and enable compression. Also we want that OpenVPN drops its privileges after the initialization and chroot into a jail to make it a little bit more secure. As the subnet for clients 192.168.220.0/24 is used. That is the same as my internal network uses. OpenVPN is allowed to use addresses ranging from 192.168.220.50 to 192.168.220.99. You have to make sure that the FRITZ!Box (or any other DHCP server in your network) doesn't serve addresses from that range. Of course you could change some of the settings to your needs, but then you have to make sure they match the configuration of the client.</p>
<p>Next we create the client configuration, which looks as follow:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Specify that we are a client and that we will be pulling certain</span>
<span style="color: #666666; font-style: italic;"># config file directives from the server.</span>
client
&nbsp;
<span style="color: #666666; font-style: italic;"># The hostname/IP and port of the server.</span>
remote xtestx.dyndns.org <span style="color: #000000;">1194</span>
&nbsp;
proto udp
dev tap
&nbsp;
pull
&nbsp;
mssfix
tun-mtu <span style="color: #000000;">1500</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># SSL/TLS parms.</span>
tls-client
ca keys<span style="color: #000000; font-weight: bold;">/</span>ca.crt
cert keys<span style="color: #000000; font-weight: bold;">/</span>client.crt
key keys<span style="color: #000000; font-weight: bold;">/</span>client.key
&nbsp;
ns-cert-type server
&nbsp;
<span style="color: #666666; font-style: italic;"># Keep trying indefinitely to resolve the host name of the OpenVPN</span>
<span style="color: #666666; font-style: italic;"># server. Very useful on machines which are not permanently connected</span>
<span style="color: #666666; font-style: italic;"># to the Internet such as laptops.</span>
resolv-retry infinite
&nbsp;
<span style="color: #666666; font-style: italic;"># Don't enable this; It must be disabled for iTunes to find the iTunes</span>
<span style="color: #666666; font-style: italic;"># server and for AFP broadcast in general.</span>
<span style="color: #666666; font-style: italic;">#nobind</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Downgrade privileges after initialization (non-Windows only)</span>
user nobody
group nobody
&nbsp;
<span style="color: #666666; font-style: italic;"># Try to preserve some state across restarts.</span>
persist-key
persist-tun
&nbsp;
<span style="color: #666666; font-style: italic;"># Enable compression on the VPN link.</span>
comp-lzo
&nbsp;
<span style="color: #666666; font-style: italic;"># debug level</span>
;verb <span style="color: #000000;">4</span>
&nbsp;
mute-replay-warnings
mute <span style="color: #000000;">20</span></pre></div></div>

<p>You have to change the <em>remote</em> hostname to your needs. You may also add the full path to the certificates and keys depending on your client OpenVPN installation.</p>
<p>Next we pack all files up for the server and the client respectively. The server needs the following one:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">server.conf
keys<span style="color: #000000; font-weight: bold;">/</span>ca.crt
keys<span style="color: #000000; font-weight: bold;">/</span>crl.pem
keys<span style="color: #000000; font-weight: bold;">/</span>dh1024.pem
keys<span style="color: #000000; font-weight: bold;">/</span>server.crt
keys<span style="color: #000000; font-weight: bold;">/</span>server.key</pre></div></div>

<p>The client needs this one:<a name="client_pack"></a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">client.conf
keys<span style="color: #000000; font-weight: bold;">/</span>ca.crt
keys<span style="color: #000000; font-weight: bold;">/</span>client.crt
keys<span style="color: #000000; font-weight: bold;">/</span>client.key
keys<span style="color: #000000; font-weight: bold;">/</span>server.crt</pre></div></div>

<h2>Customizing the FRITZ!Box</h2>
<p>Connect to your FRITZ!Box and copy all the server files to the usbstick. I created a directory <code class="path">openvpn</code> under the <code class="path">/var/media/ftp/FLASH-DISK-01/addons</code> path. Next we need the OpenVPN binary for the FRITZ!Box. You can get it <a href="http://www.cswpro.de/_files/openvpn_kernel_2_6.zip">here</a>. Unpack the file and copy the openvpn binary to <code class="path">/var/media/ftp/FLASH-DISK-01/addons/bin</code> on the FRITZ!Box. Make sure the file mode has the executable bit set for the user. All files are now on the right places, so we can adjust our start script. Add the following code to the <code class="cmd">startup.sh</code> file.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Add a nobody user</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'nobody:x:65534:65534:nobody:/:/bin/false'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Add some groups</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'root:x:0:'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>group
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'nobody:x:65534:'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>group
&nbsp;
<span style="color: #666666; font-style: italic;"># Create a tap device for openvpn</span>
<span style="color: #c20cb9; font-weight: bold;">mknod</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>tap0 c <span style="color: #000000;">10</span> <span style="color: #000000;">200</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Start openvpn</span>
<span style="color: #800000;">${BASE}</span><span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>openvpn <span style="color: #660033;">--config</span> <span style="color: #800000;">${BASE}</span><span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>server.conf <span style="color: #660033;">--daemon</span></pre></div></div>

<p>As you see, we add a new <em>nobody</em> user to the Linux system. Then the device node for the TAP device is created and at the end the OpenVPN server is started. As we using the bridged setup, we have to add the new device to a bridge. Fortunately we haven't to create one, cause the FRITZ!Box itself is working in bridged mode. You can confirm this by executing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brctl show lan</pre></div></div>

<p>To let the system automatically add our TAP device to the <em>lan</em> bridge, we change the internal FRITZ!Box configuration. Edit the <code class="path">/var/flush/ar7.cfg</code> file with nvi and search for the string <em>brinterfaces</em>. There should be one section with the name <em>lan</em>. Simply add the new <em>tap0</em> interface to the interfaces value. The section should then look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">brinterfaces <span style="">&#123;</span>
     <span style="color: #000099;">name</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;lan&quot;</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">dhcp</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> no</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">ipaddr</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.220.1</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">netmask</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 255.255.255.0</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">dstipaddr</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0.0.0.0</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">interfaces</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;eth0&quot;</span>, <span style="color: #933;">&quot;ath0&quot;</span>, <span style="color: #933;">&quot;tap0&quot;</span>, <span style="color: #933;">&quot;wdsup1&quot;</span>, <span style="color: #933;">&quot;wdsdw1&quot;</span>,
                  <span style="color: #933;">&quot;wdsdw2&quot;</span>, <span style="color: #933;">&quot;wdsdw3&quot;</span>, <span style="color: #933;">&quot;wdsdw4&quot;</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">dhcpenabled</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">dhcpstart</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.220.100</span><span style="color: #666666; font-style: italic;">;</span>
     <span style="color: #000099;">dhcpend</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.220.200</span><span style="color: #666666; font-style: italic;">;</span>
<span style="">&#125;</span></pre></div></div>

<p>Now, as soon the tap0 interface is created it will be added to the bridge. The last important point in the server setup is to change the internal firewall to allow connections to port 1194 from the outside. Search for <em>forwardrules</em> in the <code class="path">ar7.cfg</code> file and add this new rule:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">forwardrules</span> <span style="color: #000066; font-weight:bold;">=</span>
               <span style="color: #933;">&quot;tcp 0.0.0.0:7777 0.0.0.0:22 0 # SSH-Server&quot;</span>,
               <span style="color: #933;">&quot;udp 0.0.0.0:1194 0.0.0.0:1194 0 # VPN-Server&quot;</span><span style="color: #666666; font-style: italic;">;</span></pre></div></div>

<p>Thats all for the server. A reboot of the FRITZ!Box should start the new OpenVPN server. If you have trouble you should manually start the OpenVPN server and increase the debugging level, as shown in the above configuration with the keyword <em>verb</em>.</p>
<h2>Setting up the client</h2>
<p>On the client side we need the files we packed <a href="#client_pack">above</a>. On Gentoo the OpenVPN configuration is located at <code class="path">/etc/openvpn</code>. Copy the configuration, the certificates and the key file to that place. The OpenVPN start script of Gentoo looks for the configuration file, based on the start script name. So we have to create a link like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> client.conf openvpn.conf</pre></div></div>

<p>By the way, this lets you configure more than one OpenVPN connection at the time. Just create a link in <code class="path">/etc/init.d</code> with the new configuration name and link it to the <code class="path">openvpn</code> start script.</p>
<p>To make a first attempt to start the OpenVPN connection type</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>openvpn start</pre></div></div>

<p>If  all goes well you should have a new device <em>tap0</em> when you  execute <code>ifconfig</code>. Also there should be a route set,  which point to the tap0  device when the 192.168.220.0/24 subnet is the  target. Of course now you should be able to connect to any host in your  home network by the IP. I didn't experiment enough with the pushing of  the name server from the OpenVPN server, instead I just added the  FRITZ!Box as an additionally name server to my <code class="path">/etc/resolv.conf</code>. So here is room for further experiments.</p>
<p>To let the OpenVPN client start at boot time add it to the default runlevel by executing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rc-update add openvpn default</pre></div></div>

<p>Also note that with the above configuration the client always try to  reconnect to the server, even if the FRITZ!Box is rebooted, which is a nice feature.</p>
<h2>Conclusion</h2>
<p>This setup allows you to connect to your home network in a very secure way without loosing any functionality. You are able to browse network shares on the local network or using services like DAAP without any further interaction.  The public key infrastructure make this setup a candidate for small business installations. If an employee leave the company his certificate is simply revoked without affecting the access of other employees.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 1754px; width: 1px; height: 1px; overflow: hidden;"><a href="http://www.cswpro.de/Howto/FritzBox_OpenVPN.aspx" target="_blank">http://wwww.cswpro.de</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.64k-tec.de/2010/02/fritzbox-tuning-part-2-access-your-home-network-with-openvpn/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>FRITZ!Box tuning part 1: Enable remote access over ssh</title>
		<link>http://www.64k-tec.de/2010/01/fritzbox-tuning-part-1-enable-remote-access-over-ssh/</link>
		<comments>http://www.64k-tec.de/2010/01/fritzbox-tuning-part-1-enable-remote-access-over-ssh/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 10:44:17 +0000</pubDate>
		<dc:creator>cp</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Root]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[FritzBox]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[remote access]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[telnet]]></category>

		<guid isPermaLink="false">http://www.64k-tec.de/?p=257</guid>
		<description><![CDATA[Recently I changed my Internet service provider to Kabel Deutschland which offers some really good bandwidth for a reasonable price. You get 32 MBit in the download direction and 2 Mbit in the upload direction. Additionally to this you can order a FRITZ!Box 7270 which allows you to use VoIP for the phone part. As [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I changed my Internet service provider to Kabel Deutschland which offers some really good bandwidth for a reasonable price. You get 32 MBit in the download direction and 2 Mbit in the upload direction. Additionally to this you can order a FRITZ!Box 7270 which allows you to use VoIP for the phone part. As I always try to maximize the usage of new hardware I started to explore what is possible with this combination. In this post I will explain how you get access to your FRITZ!Box using ssh. Following this post, some articles about how you can turn the FRITZ!Box into a OpenVPN server and how you can use the VoIP access point remotely from any computer having a VoIP software installed, will be done. As I said the hardware used is a FRITZ!Box Fon WLAN 7270 with the firmware 54/74.04.80 from 2009/12/15 which is an official one from AVM. Other firmware versions may work also, but I haven't tested that. The following topics are all for advanced user. So if you aren't in touch with Linux or start asking what the hell is vi and how get I out of it, stop reading now. All the information in this and the following posts are based on several websites I found in the Internet. Mainly this are some forum entries at <a href="http://www.ip-phone-forum.de" target="_blank">http://www.ip-phone-forum.de</a>, the series about the FRITZ!Box at <a href="http://www.tecchannel.de/server/extra/432803/tuning_hacks_fritzbox_fritz_box_erweiterungen_ftp_telnet/" target="_blank">http://www.tecchannel.de</a>, the posts on <a href="http://www.teamarbyte.de/ssh-fritzbox.html" target="_blank">http://www.teamarbyte.de</a>, the blog at <a href="http://www.realriot.de/category/hardware/fritzbox/" target="_blank">http://www.realriot.de</a> and this article at <a href="http://www.cswpro.de/Howto/FritzBox_OpenVPN.aspx" target="_blank">http://www.cswpro.de</a>. So thanks to all the people for sharing this kind of information. Before we start some words of caution: It's easily possible to render the FRITZ!Box unusable. So there is no warranty of any kind if you do some of the things mentioned in this blog. Also I'm not responsible for anything happen to your FRITZ!Box or the Internet connection. After all making a backup of your current configuration might be a good idea.</p>
<h2>Preparing the FRITZ!Box</h2>
<p>First of all you should register an account at <a href="http://www.dyndns.com" target="_blank">http://www.dyndns.com</a> or any other service for dynamic IP resolution. You can then add this information to the "DynamicDNS" tab of the Internet settings in the FRITZ!Box web frontend. This will allow you to connect to your FRITZ!Box without knowing the IP after a reconnect. Lets use us <em>xtestx.dyndns.org</em> in the following examples. Next you need telnet access to the FRITZ!Box to make the initial configuration for the ssh server. Enabling telnet is as simple as calling <strong><tt>#96*7*</tt></strong> with a local connected phone. To disable the telnet daemon later you call <strong><tt>#96*8*</tt></strong>. Now you need a usbstick where all the software will be installed on and which have to be connected to the FRITZ!Box all the time. In principle the size doesn't matter, around 5 MBytes free space should be enough. Time to connect to the FRITZ!Box for the first time. A simple <code class="cmd">telnet fritz.box</code> should do it.</p>
<h2>Installation and configuration of the ssh server</h2>
<p>For the ssh server software <a href="http://matt.ucc.asn.au/dropbear/dropbear.html" target="_blank">dropbear</a> is used. You can get a prepared version for the FRITZ!Box from the spblinux server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.spblinux.de<span style="color: #000000; font-weight: bold;">/</span>fbox.new<span style="color: #000000; font-weight: bold;">/</span>cfg_dropbear
<span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x cfg_dropbear</pre></div></div>

<p>After downloading, the server has to be installed on the usbstick by executing</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>cfg_dropbear usb_install</pre></div></div>

<p>In my case the software is installed into <code class="path">/var/media/ftp/FLASH-DISK-01/addons</code>. Now we will create a host key which will be reused even after a reboot of the FRITZ!Box.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons
dropbear<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>dropbearkey <span style="color: #660033;">-t</span> rsa <span style="color: #660033;">-f</span> dropbear<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sshd_rsa_host_key</pre></div></div>

<p>The FRITZ!Box has initial no root password entry. We have to create one and save the password hash for later usage.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">passwd</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span></pre></div></div>

<p>You have to note the part between <em>root:</em> and the next <em>colon</em>.</p>
<h2>Putting all together</h2>
<p>The initial starting point for all modifications on the FRITZ!Box is a file called <code class="path">/var/flash/debug.cfg</code>. Its executed on every boot after all the other services are started. We will use it only to start a script which is located on the usbstick. This makes sure that even after a firmware upgrade our changes are not lost. The content looks like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># execute the start script which is on the usb stick</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons<span style="color: #000000; font-weight: bold;">/</span>startup.sh</pre></div></div>

<p>Please note that you have to use the <code>nvi</code> to edit files on the flash device from the FRITZ!Box, cause all files there are marked as non regular. The <code class="cmd">startup.sh</code> will do all the work necessary for preparing and starting the ssh server. The content is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># whats the base usb directory</span>
<span style="color: #007800;">BASE</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>FLASH-DISK-01<span style="color: #000000; font-weight: bold;">/</span>addons
&nbsp;
<span style="color: #666666; font-style: italic;"># change to a temporary directory</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp
&nbsp;
<span style="color: #666666; font-style: italic;"># install and start dropbear with our host key</span>
<span style="color: #800000;">${BASE}</span><span style="color: #000000; font-weight: bold;">/</span>cfg_dropbear usb_install
<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>dropbear <span style="color: #660033;">-E</span> <span style="color: #660033;">-r</span> <span style="color: #800000;">${BASE}</span><span style="color: #000000; font-weight: bold;">/</span>dropbear<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sshd_rsa_host_key
&nbsp;
<span style="color: #666666; font-style: italic;"># set passwords</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'root:XXXXXX:0:0:root:/var/tmp/:/bin/sh'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'ftpuser:any:1000:0:ftp user:/var/media/ftp:/bin/sh'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># add fritz box itself in resolv.conf to resolv dhcp attached machines in your network</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;nameserver 192.168.220.1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>resolv.conf</pre></div></div>

<p>You have to replace XXXXXX by the password hash you created above. In my case the network is in the 192.168.220.0/24 subnet and the FRITZ!Box has the IP 192.168.220.1. You have to adjust the name server entry to your environment. After a reboot which could be initiated with <code>reboot</code> you should be able to access your FRITZ!Box over ssh.</p>
<p>To allow connections from the outside of your home you need to change the forward rules of the internal FRITZ!Box firewall. Unfortunately you can't add this rule using the web frontend cause it isn't allowed to add rules which targeting the FRITZ!Box itself. Most of the settings for the FRITZ!Box configuration are located in a file called <code class="path">/var/flash/ar7.cfg</code>. Use nvi to edit it and search for the string <strong>forwardrules</strong>. If this string is missing you could temporary create a rule in the web frontend, which will you later remove again. You have to change the line so that it looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">forwardrules</span> <span style="color: #000066; font-weight:bold;">=</span>
               <span style="color: #933;">&quot;tcp 0.0.0.0:7777 0.0.0.0:22 0 # SSH-Server&quot;</span><span style="color: #666666; font-style: italic;">;</span></pre></div></div>

<p>Here the connection port is 7777, but of course could you use any valid port number. You could also add more rules by separating them with a comma. To make the configuration change happen the execution of <code class="cmd">ar7cfgchanged</code> is sufficient.</p>
<h2>Conclusion</h2>
<p>With this setup its possible to connect to the FRITZ!Box with the very secure ssh protocol from inside of your home environment and from the outside. This makes it easily possible to change parameters without manually starting the telnet daemon which is in addition very insecure. Don't forget to remove any temporary rules from the ar7.cfg file and to disable the telnet daemon with the procedure explained above. Stay tuned for the <a href="http://www.64k-tec.de/2010/02/fritzbox-tuning-part-2-access-your-home-network-with-openvpn/">next post</a> about going one step further and making the FRITZ!Box an OpenVPN connection point for your internal network.</p>
<h2>Update</h2>
<p>There is a new article about installing ssh on the FRITZ!Box. If you are interested have a look at <a href="http://www.64k-tec.de/2011/07/fritzbox-tuning-part-4-cross-building-and-installing-additional-applications/">this post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.64k-tec.de/2010/01/fritzbox-tuning-part-1-enable-remote-access-over-ssh/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

