<?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>Lanziani Blog</title>
	<atom:link href="http://www.lanziani.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lanziani.com</link>
	<description>Nss personal blog</description>
	<lastBuildDate>Wed, 05 Oct 2011 08:01:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
	<atom:link rel="hub" href="http://superfeedr.com/hubbub" />
			<item>
		<title>BlackBerry Tethering via Bluetooth on GNU/Linux</title>
		<link>http://www.lanziani.com/2011/04/06/blackberry-tethering-via-bluetooth-on-gnulinux/</link>
		<comments>http://www.lanziani.com/2011/04/06/blackberry-tethering-via-bluetooth-on-gnulinux/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 16:21:51 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[apn]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[connessione]]></category>
		<category><![CDATA[gprs]]></category>
		<category><![CDATA[pppd]]></category>
		<category><![CDATA[tre]]></category>
		<category><![CDATA[wvdial]]></category>

		<guid isPermaLink="false">http://www.lanziani.com/?p=1026</guid>
		<description><![CDATA[Essendomi trovato alle prese proprio oggi con questo problema, ho deciso di raccontarvi come effettuale tale operazione. Il tutto, nel mio caso, è stato realizzato sulla distribuzione Archlinux[1]. E&#8217; necessario da prima installare i seguenti pacchetti: bluez Necessario per instaurare (&#8230;)</p><p><a href="http://www.lanziani.com/2011/04/06/blackberry-tethering-via-bluetooth-on-gnulinux/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Essendomi trovato alle prese proprio oggi con questo problema, ho deciso di raccontarvi come effettuale tale operazione.<br />
<em>Il tutto, nel mio caso, è stato realizzato sulla distribuzione Archlinux[1].</em></p>
<p><span id="more-1026"></span></p>
<p>E&#8217; necessario da prima installare i seguenti pacchetti:</p>
<ul>
<li><strong>bluez</strong></li>
<p>Necessario per instaurare la connessione bluetooth seriale con il cellulare.</p>
<li><strong>wvdial</strong></li>
<p>Per effettuare la connessione vera e propria
</ul>
<p>Per prima cosa bisogna effettuare il pairing tra i due dispositivi, la procedura da seguire la potrete trovare sul link [2] in fondo alla pagina.</p>
<h3>Configurazione</h3>
<p>Ora configuriamo la connessione seriale, con il comando <code>hcitool scan</code> cerchiamo il MAC del nostro cellulare  e segniamocelo:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Scanning ...
        00:01:02:03:04:05       Nss</pre></div></div>

<p>Ora cerchiamo il canale su cui è in ascolto il servizio di Dialup con il comando:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sdptool browse 00:01:02:03:04:05</pre></div></div>

<p>E nell&#8217;output cerchiamo la seguente porzione e segniamoci il valore del parametro &#8220;Channel&#8221;, nel mio caso <strong>3</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">...
Service Name: Dialup Networking
Service RecHandle: 0x10002
Service Class ID List:
  &quot;Dialup Networking&quot; (0x1103)
  &quot;Generic Networking&quot; (0x1201)
Protocol Descriptor List:
  &quot;L2CAP&quot; (0x0100)
  &quot;RFCOMM&quot; (0x0003)
    Channel: 3
Profile Descriptor List:
  &quot;Dialup Networking&quot; (0x1103)
    Version: 0x0100
...</pre></div></div>

<p>Editiamo il file <code>/etc/bluetooth/rfcomm.conf</code> e inseriamoci, sostituendo i parametri visti in precedenza, le seguenti righe:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rfcomm0 {
        bind yes;
        device 00:01:02:03:04:05;
        channel 3;
}</pre></div></div>

<p>Nel file <code>/etc/wvdial.conf</code> creiamo invece la seguente sezione:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[Dialer tre]
Modem = /dev/rfcomm0
Baud = 115200
Init1 = ATH
Init2 = ATE1
Init3 = AT+CGDCONT=1,&quot;IP&quot;,&quot;tre.it&quot;,&quot;&quot;,0,0
Dial Command = ATDT
Phone = *99#
Username = tre
Password = tre
Ask Password = 0
Stupid Mode = 1
Idle Seconds = 0
Auto DNS = 1
Check Def Route = 1</pre></div></div>

<h3>Connessione</h3>
<p>Per effettuare il collegamento seriale lanciamo da shell il comando che creerà il device <code>/dev/rfcomm0</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rfcomm <span style="color: #7a0874; font-weight: bold;">bind</span> <span style="color: #000000;">0</span></pre></div></div>

<p>La connessione invece andrà effettuata invece con il comando:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">wvdial tre</pre></div></div>

<p>[1] <a href="http://www.archlinux.it">http://archlinux.it</a><br />
[2] <a href="https://wiki.archlinux.org/index.php/Bluetooth#Pairing">https://wiki.archlinux.org/index.php/Bluetooth#Pairing</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2011/04/06/blackberry-tethering-via-bluetooth-on-gnulinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scripting bash tips</title>
		<link>http://www.lanziani.com/2011/04/01/script-bash-tips/</link>
		<comments>http://www.lanziani.com/2011/04/01/script-bash-tips/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 14:51:44 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[shopt]]></category>

		<guid isPermaLink="false">http://lanziani.com/?p=969</guid>
		<description><![CDATA[Oggi mi sono trovato a dover scrivere una serie di script bash mediamente più complicati di quelli che scrivo di solito. Per evitare di usare la sintassi errata ho dato un occhiata in rete e ho trovato questa utile pagina (&#8230;)</p><p><a href="http://www.lanziani.com/2011/04/01/script-bash-tips/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Oggi mi sono trovato a dover scrivere una serie di script bash mediamente più complicati di quelli che scrivo di solito.</p>
<p>Per evitare di usare la sintassi errata ho dato un occhiata in rete e ho trovato questa utile pagina [1], che riassume gli errori tipici che vengono commessi, e un trucco per &#8220;listare&#8221; tutti i file in una directory in maniera corretta.</p>
<p>Molti consigliano di usare la seguente sintassi per scorrere i file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>.txt; <span style="color: #000000; font-weight: bold;">do</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>così da sfruttare il sistema di &#8220;Shell Expansions&#8221;, in questo caso però se non vi fossero file txt all&#8217;interno della directory, e quindi la shell non effettuasse l&#8217;espansione del carattere &#8220;*&#8221;, otterremmo un non aspettato:</p>

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

<p>Per evitare questo comportamento va inserito prima del ciclo for il comando <code>shopt -s nullglob</code>, lo script diverrà quindi:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> nullglob
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>.txt; <span style="color: #000000; font-weight: bold;">do</span>
   <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>[1] <a href="http://mywiki.wooledge.org/BashPitfalls">http://mywiki.wooledge.org/BashPitfalls</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2011/04/01/script-bash-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenVZ container e VPN con tinc</title>
		<link>http://www.lanziani.com/2011/02/20/openvz-container-vpn-tinc/</link>
		<comments>http://www.lanziani.com/2011/02/20/openvz-container-vpn-tinc/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 12:35:18 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Device]]></category>
		<category><![CDATA[file descriptor]]></category>
		<category><![CDATA[Interface]]></category>
		<category><![CDATA[OpenVZ]]></category>
		<category><![CDATA[proxmox]]></category>
		<category><![CDATA[tinc]]></category>
		<category><![CDATA[tun]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://lanziani.com/?p=888</guid>
		<description><![CDATA[Risolvere il problema, "Error while reading from Linux ethertap device /dev/net/tun: File descriptor in bad state", dato da Tinc in un container OpenVZ.]]></description>
			<content:encoded><![CDATA[<p>Nel post precedente [1] abbiamo visto come configurare un <strong>interfaccia veth</strong> in un container OpenVZ, <strong>condizione necessaria per creare una VPN con <em>tinc</em></strong> [2].</p>
<p>Pensate forse che la cosa sia andata liscia la primo colpo??<br />
ASSOLUTAMENTE NO&#8230;</p>
<p><span id="more-888"></span></p>
<p>Tinc ha bisogno di un interfaccia Tun/Tap per funzionare, questa è stata configurata grazie alla guida [3] trovata sul sito apposito, <strong>i comandi principali</strong>, che vanno eseguiti <strong>nella macchina host, per la creazione del device tun</strong>, ammesso che il nostro container sia identificato come 101, <strong>sono</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">vzctl <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #000000;">101</span> <span style="color: #660033;">--devices</span> c:<span style="color: #000000;">10</span>:<span style="color: #000000;">200</span>:rw <span style="color: #660033;">--save</span>
vzctl <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #000000;">101</span> <span style="color: #660033;">--capability</span> net_admin:on <span style="color: #660033;">--save</span></pre></div></div>

<p>Per permettere al container di usare il dispositivo tun/tap.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">vzctl <span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">101</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net
vzctl <span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">101</span> <span style="color: #c20cb9; font-weight: bold;">mknod</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun c <span style="color: #000000;">10</span> <span style="color: #000000;">200</span>
vzctl <span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">101</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun</pre></div></div>

<p>Per creare il device all&#8217;interno del container.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">vzctl <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #000000;">101</span> <span style="color: #660033;">--devnodes</span> net<span style="color: #000000; font-weight: bold;">/</span>tun:rw <span style="color: #660033;">--save</span></pre></div></div>

<p>Per ricordare a vzctl di ricreare il device ad ogni avvio del container.</p>
<p>Configurando <em>tinc</em>[4] tutto sarebbe dovuto funzionare a dovere&#8230; Peccato che lanciando il <strong>comando per visualizzare l&#8217;output di debug di <em>tinc</em></strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tincd <span style="color: #660033;">-D</span> <span style="color: #660033;">-d5</span> <span style="color: #660033;">-n</span> tulug</pre></div></div>

<p>mi sono accorto di questo <strong>strano comportamento</strong>:</p>
<p><code>Error while reading from Linux ethertap device /dev/net/tun: File descriptor in bad state</code></p>
<p><del datetime="2011-02-21T14:26:54+00:00"><strong>Per risolvere il problema</strong>, dopo una ricerca su internet e un minimo di immaginazione <strong> è stato sufficiente commentare l&#8217;opzione <code>Interface = /dev/net/tun</code> nel file di configurazione della VPN</strong>.</del><br />
<del datetime="2011-02-21T14:29:46+00:00"><br />
<em><strong>In alcuni casi invece di Interface viene usata l&#8217;opzione Device</strong>, in quel caso dovrete commentare quest&#8217;ultima</em>.</del></p>
<p><del datetime="2011-02-21T14:29:46+00:00">Ora tutto funziona a dovere e il server è raggiungibile all&#8217;interno della VPN.</del></p>
<p><strong>La soluzione sembrava trovata&#8230;</strong> in realtà il problema sembra essere un&#8217;altro, <strong>al secondo tentativo di tirare su la vpn il problema si ripropone</strong> e spulciando l&#8217;output del comando dmesg sulla macchina Host è spuntato questo &#8220;simpatico&#8221; messaggio&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">sysfs: cannot create duplicate filename '/devices/virtual/net/tulug'
...
Pid: 9675, comm: tincd Tainted: G        W  2.6.32-3-pve #1
Call Trace:
 [&lt;ffffffff811439c7&gt;] ? sysfs_add_one+0xcc/0xe4
 [&lt;ffffffff811439c7&gt;] ? sysfs_add_one+0xcc/0xe4
 [&lt;ffffffff8104dec8&gt;] ? warn_slowpath_common+0x77/0xa3
 [&lt;ffffffff8104df50&gt;] ? warn_slowpath_fmt+0x51/0x59
 [&lt;ffffffff811438f3&gt;] ? sysfs_pathname+0x35/0x3d
 [&lt;ffffffff811438f3&gt;] ? sysfs_pathname+0x35/0x3d
 [&lt;ffffffff811438f3&gt;] ? sysfs_pathname+0x35/0x3d
 [&lt;ffffffff811438f3&gt;] ? sysfs_pathname+0x35/0x3d
 [&lt;ffffffff811439c7&gt;] ? sysfs_add_one+0xcc/0xe4
 [&lt;ffffffff81143f75&gt;] ? create_dir+0x4f/0x7c
 [&lt;ffffffff81143ff5&gt;] ? sysfs_create_dir+0x53/0x68
 [&lt;ffffffff8117b00b&gt;] ? kobject_get+0x12/0x17
 [&lt;ffffffff8117b141&gt;] ? kobject_add_internal+0xcb/0x181
 [&lt;ffffffff8117b3a3&gt;] ? kobject_add+0x74/0x7c
 [&lt;ffffffff8117b27f&gt;] ? kobject_set_name_vargs+0x4e/0x56
 [&lt;ffffffff810e8a98&gt;] ? __kmalloc+0x15a/0x17f
 [&lt;ffffffff81312006&gt;] ? mutex_lock+0xd/0x31
 [&lt;ffffffff8117b00b&gt;] ? kobject_get+0x12/0x17
 [&lt;ffffffff8120ddcf&gt;] ? get_device_parent_nodep+0x125/0x19f
 [&lt;ffffffff8120edeb&gt;] ? device_add+0xce/0x53f
 [&lt;ffffffff81258bed&gt;] ? sk_prot_alloc+0x5b/0x108
 [&lt;ffffffff812671a7&gt;] ? register_netdevice+0x218/0x30c
 [&lt;ffffffffa0219dd4&gt;] ? tun_chr_ioctl+0x294/0x827 [tun]
 [&lt;ffffffff810b6587&gt;] ? find_get_page+0x1a/0x77
 [&lt;ffffffff810fc926&gt;] ? vfs_ioctl+0x21/0x6c
 [&lt;ffffffff810fce74&gt;] ? do_vfs_ioctl+0x48d/0x4cb
 [&lt;ffffffff810fceef&gt;] ? sys_ioctl+0x3d/0x5c
 [&lt;ffffffff8112729a&gt;] ? dev_ifsioc+0x10f/0x24c
 [&lt;ffffffff81127fcb&gt;] ? compat_sys_ioctl+0x3f8/0x459
 [&lt;ffffffff81037492&gt;] ? ia32_sysret+0x0/0x5
---[ end trace 5b6bc3d8be2d0a32 ]---
kobject_add_internal failed for tulug with -EEXIST, 
don't try to register things with the same name in the same directory.</pre></div></div>

<p><strong>Sono ancora alla ricerca di una eventuale soluzione al problema&#8230;</strong></p>
<p>[1] <a href="http://www.lanziani.com/2011/02/17/proxmox-openvz-e-veth/">Proxmox OpenVZ e veth</a><br />
[2] <a href="http://www.tinc-vpn.org/">http://www.tinc-vpn.org/</a><br />
[3] <a href="http://wiki.openvz.org/VPN_via_the_TUN/TAP_device">http://wiki.openvz.org/VPN_via_the_TUN/TAP_device</a><br />
[4] <a href="http://www.lanziani.com/2010/08/14/simple-vpn-with-tinc/">Una semplice VPN con tinc</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2011/02/20/openvz-container-vpn-tinc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Proxmox OpenVZ e veth</title>
		<link>http://www.lanziani.com/2011/02/17/proxmox-openvz-e-veth/</link>
		<comments>http://www.lanziani.com/2011/02/17/proxmox-openvz-e-veth/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 20:42:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[OpenVZ]]></category>
		<category><![CDATA[proxmox]]></category>
		<category><![CDATA[veth]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=847</guid>
		<description><![CDATA[Oggi mi sono trovato a configurare un container (OpenVZ) su Proxmox con un interfaccia veth settata con un ip pubblico e ho trovato qualche problema&#8230; Dati utili: vzctl version 3.0.24 ID Macchina: 101 Veth name: veth101.0 IP Pubblic: X.Y.Z.T Ho (&#8230;)</p><p><a href="http://www.lanziani.com/2011/02/17/proxmox-openvz-e-veth/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Oggi mi sono trovato a configurare un container (OpenVZ) su Proxmox con un interfaccia veth settata con un ip pubblico e ho trovato qualche problema&#8230;</p>
<p><span id="more-847"></span></p>
<p>Dati utili:</p>
<ul>
<li><strong>vzctl version</strong> 3.0.24</li>
<li><strong>ID Macchina:</strong> 101</li>
<li><strong>Veth name:</strong> veth101.0</li>
<li><strong>IP Pubblic:</strong> X.Y.Z.T</li>
</ul>
<p>Ho aggiunto nella macchina Host una rotta statica del tipo:</p>
<p><code>X.Y.Z.T     0.0.0.0         255.255.255.255 UH    0      0        0 veth101.0</code></p>
<p>E nel container ho configurato la eth0 con i seguenti parametri:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">auto eth0
iface eth0 inet static
	address X.Y.Z.T
	netmask 255.255.255.255
	up <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>ip route add default dev eth0</pre></div></div>

<p>Tutto sembrava essere corretto, peccato che la macchina in questo modo non riusciva a comunicare con l&#8217;esterno in entrambi le direzioni.</p>
<p><strong>Il problema sorgeva nel momento in cui l&#8217;interfaccia veth101.0</strong>, settata nel file di configurazione della macchina virtuale, <strong>veniva messa in bridge su vmbr0</strong>, anche se non specificato, &#8220;grazie&#8221; al file di configurazione <strong>/etc/vz/vznet.conf</strong> che dichiara:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">EXTERNAL_SCRIPT</span>=<span style="color: #ff0000;">&quot;/usr/sbin/vznetaddbr&quot;</span></pre></div></div>

<p>L&#8217;interfaccia se messa in bridge rendeva non raggiungibile il container, contrariamente togliendo veth101.0 dal bridge tutto funzionava perfettamente.</p>
<p>Per risolvere questo problema ho modificato lo script trovato qui [1] in questo modo</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># This script source VPS configuration files</span>
<span style="color: #666666; font-style: italic;">#in the same order as vzctl does</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># if one of these files does not exist</span>
<span style="color: #666666; font-style: italic;">#then something is really broken</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vz<span style="color: #000000; font-weight: bold;">/</span>vz.conf <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$VE_CONFFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># source both files. Note the order, it is important</span>
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vz<span style="color: #000000; font-weight: bold;">/</span>vz.conf
. <span style="color: #007800;">$VE_CONFFILE</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Configure veth with IP after VPS has started</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">IP</span>=X.Y.Z.T
  <span style="color: #007800;">DEV</span>=veth101.0
  <span style="color: #007800;">BRIDGE</span>=vmbr0
  <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$DEV</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>ip route add <span style="color: #007800;">$IP</span> dev <span style="color: #007800;">$DEV</span>
      brctl delif <span style="color: #007800;">$BRIDGE</span> <span style="color: #007800;">$DEV</span>
      <span style="color: #7a0874; font-weight: bold;">break</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>l&#8217;ho salvato in <strong>/etc/vz/conf/101.mount</strong> e ho dato il permesso di esecuzione al proprietario con</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">chmod</span> u+x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vz<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">101</span>.mount</pre></div></div>

<p>Così, riavviando la macchina, tutto è tornato a funzionare.</p>
<p>[1] <a href="http://wiki.openvz.org/Virtual_Ethernet_device#Configure_device_and_add_route_in_CT0">OpenVZ wiki</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2011/02/17/proxmox-openvz-e-veth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cacoo &#8211; Diagrammi collaborativi</title>
		<link>http://www.lanziani.com/2011/01/09/cacoo-diagrammi-collaborativi/</link>
		<comments>http://www.lanziani.com/2011/01/09/cacoo-diagrammi-collaborativi/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 20:21:54 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[Internet Service]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[collaborativi]]></category>
		<category><![CDATA[collaborazione]]></category>
		<category><![CDATA[diagrammi]]></category>
		<category><![CDATA[disegno]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=837</guid>
		<description><![CDATA[Ogni tanto butto un occhio a LegaNerd [1] e devo dire che mi capita di incontrare post di discreta utilità ;). In questo caso ho trovato un post su un interessante servizio di creazione di diagrammi on-line in maniera collaborativa. (&#8230;)</p><p><a href="http://www.lanziani.com/2011/01/09/cacoo-diagrammi-collaborativi/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Ogni tanto butto un occhio a LegaNerd [1] e devo dire che mi capita di incontrare post di discreta utilità ;).</p>
<p>In questo caso ho trovato un post su un interessante servizio di creazione di diagrammi on-line in maniera collaborativa.<br />
Cacoo <a href="http://cacoo.com/">http://cacoo.com/</a>.</p>
<blockquote><p>Cacoo is a <span>user friendly online drawing tool</span> that allows you to create a variety of diagrams such as site maps, wire frames, UML and network charts. <span>Cacoo can be used free of charge.</span> </p></blockquote>
<p>Me lo appunto qui per non scordarlo ;).</p>
<p>[1] <a href="http://leganerd.com/">http://leganerd.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2011/01/09/cacoo-diagrammi-collaborativi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installare Tinc su DNS-323</title>
		<link>http://www.lanziani.com/2010/09/12/tinc-vpn-on-dns-323-nas/</link>
		<comments>http://www.lanziani.com/2010/09/12/tinc-vpn-on-dns-323-nas/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 15:35:38 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[323]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[dns-323]]></category>
		<category><![CDATA[nas]]></category>
		<category><![CDATA[tinc]]></category>
		<category><![CDATA[tincd]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=785</guid>
		<description><![CDATA[Dopo la guida sull&#8217;utilizzo di Tinc ho pensato bene di includere nella mia vpn privata anche il mio NAS [1]. Per installare pacchetti nel NAS è però necessario sbloccare l&#8217;accesso telnet!! Al boot il NAS cerca ed esegue lo script (&#8230;)</p><p><a href="http://www.lanziani.com/2010/09/12/tinc-vpn-on-dns-323-nas/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Dopo la guida sull&#8217;utilizzo di Tinc ho pensato bene di includere nella mia vpn privata anche il mio NAS [1].</p>
<p><strong>Per installare pacchetti nel NAS è però necessario sbloccare l&#8217;accesso telnet!!</strong><br />
Al boot il NAS cerca ed esegue lo script fun_plug che si trova nella directory Volume1, nel nostro caso <strong>possiamo utilizzare</strong> un particolare <strong>fun_plug realizzato da &#8220;fonz&#8221;</strong> [2].</p>
<p>Le istruzione per installarlo/configurarlo sono nel wiki specificatamente dedicato al Nas (DNS-323) [3].</p>
<p>Personalmente ho creato il pacchetto tramite l&#8217;ambiente di compilazione [4] fornito dallo stesso &#8220;fonz&#8221;.</p>
<p><strong>Potete trovare in fondo alla pagina il links ai file contenenti i sorgenti [5] e il pacchetto [6].</strong><br />
This is the md5sum of the package 2d2219663d0c4248cf8100bda451ba6c.</p>
<p>Per installarlo basterà copiare il pacchetto nel NAS accedere tramite telnet o ssh e utilizzare il comando:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">funpkg <span style="color: #660033;">-i</span> tinc-1.0.13-<span style="color: #000000;">1</span>.tgz</pre></div></div>

<p>e seguire le istruzioni mostrate al termine dell&#8217;installazione.</p>
<p>Per eseguire tinc all&#8217;avvio è invece necessario aggiungere i permessi di esecuzione allo script tinc.sh in /ffp/start con il comando:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>ffp<span style="color: #000000; font-weight: bold;">/</span>start<span style="color: #000000; font-weight: bold;">/</span>tinc.sh</pre></div></div>

<p>Have fun&#8230; :D</p>
<p>[1] <a href="http://www.dlink.it/cs/Satellite?c=Product_C&#038;childpagename=DLinkEurope-IT%2FDLProductCarousel&#038;cid=1197319419129&#038;p=1197318958684&#038;packedargs=ParentPageID%3D1197318958651%26TopLevelPageProduct%3DConsumer%26locale%3D1195806717957%26packedargs%3DProductParentID%253D1197318482181&#038;pagename=DLinkEurope-IT%2FDLWrapper">DNS-323</a><br />
[2] <a href="http://www.inreto.de/dns323/fun-plug/">http://www.inreto.de/dns323/fun-plug/</a><br />
[3] <a href="http://wiki.dns323.info/howto:ffp?s=ffp">http://wiki.dns323.info/howto:ffp?s=ffp</a><br />
[4] <a href="http://nas-tweaks.net/CH3SNAS:Tutorials/Compiling_software">http://nas-tweaks.net/CH3SNAS:Tutorials/Compiling_software</a><br />
[5] <a class="downloadlink" href="http://www.lanziani.com/wp-content/plugins/download-monitor/download.php?id=2" title="Versione1.0.13-1 scaricato 402 volte" >Source of tinc for DNS-323  (402)</a><br />
[6] <a class="downloadlink" href="http://www.lanziani.com/wp-content/plugins/download-monitor/download.php?id=1" title="Versione1.0.13-1 scaricato 448 volte" >Package of tinc for DNS-323 (448)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2010/09/12/tinc-vpn-on-dns-323-nas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Una semplice VPN con tinc</title>
		<link>http://www.lanziani.com/2010/08/14/simple-vpn-with-tinc/</link>
		<comments>http://www.lanziani.com/2010/08/14/simple-vpn-with-tinc/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 14:51:43 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[configurare]]></category>
		<category><![CDATA[creare vpn]]></category>
		<category><![CDATA[mesh]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[privata]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[rete]]></category>
		<category><![CDATA[tinc]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[virtuale]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=742</guid>
		<description><![CDATA[Collegare due (o più) computer tramite internet come se fossero in una rete locale?? Che ne dite di una VPN[1]?? Ci sono differenti soluzioni per la creazione di VPN quella che noi vedremo è tinc[2] essendo particolarmente leggero e avendo (&#8230;)</p><p><a href="http://www.lanziani.com/2010/08/14/simple-vpn-with-tinc/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Collegare due (o più) computer tramite internet come se fossero in una rete locale??<br />
<strong>Che ne dite di una VPN[1]??</strong><br />
Ci sono differenti soluzioni per la creazione di VPN quella che noi vedremo è <strong>tinc</strong>[2] essendo particolarmente leggero e avendo le seguenti peculiarità:</p>
<ul>
<li>Automatic full mesh routing</li>
<p>Regardless of how you set up the tinc daemons to connect to each other, VPN traffic is always (if possible) sent directly to the destination, without going through intermediate hops.</p>
<li>Easily expand your VPN</li>
<p>When you want to add nodes to your VPN, all you have to do is add an extra configuration file, there is no need to start new daemons or create and configure new devices or network interfaces.</p>
<li>Ability to bridge ethernet segments</li>
<p>You can link multiple ethernet segments together to work like a single segment, allowing you to run applications and games that normally only work on a LAN over the Internet.
</ul>
<p><span id="more-742"></span><br />
<strong>Verranno mostrati i passi essenziali da seguire&#8230;</strong></p>
<ul>
<li>
Abbiamo 2 computer PCA e PCB</li>
<ol>
<li><strong>PCA</strong> con direttamente raggiungibile e con ip pubblico x.y.z.t</li>
<li><strong>PCB</strong> dietro nat quindi non direttamente raggiungibile
</li>
</ol>
<p>entrambi i pc hanno installata la distribuzione ArchLinux.</p>
<li>
<strong>Su entrambi i PC</strong>:</li>
<ol>
<li>Installiamo i pacchetti necessari</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pacman <span style="color: #660033;">-S</span> openssh zlib lzo
yaourt <span style="color: #660033;">-S</span> tinc</pre></div></div>

<li>Definiamo la variabile <code>$VPNNAME</code> assegnandole il nome che vogliamo dare alla vostra VPN</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">VPNNAME</span>=mia_vpn</pre></div></div>

<li>Creiamo i file e le directory necessarie</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>hosts
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>tinc.conf
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>tinc-down
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>tinc-up
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>tinc-up
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>tinc-down</pre></div></div>

</ol>
<li>Ora spostiamoci su PCA (quello con ip pubblico x.y.z.t)</li>
<p><strong>ATTENZIONE:</strong><em> sostituire a $PCxHOSTNAME l&#8217;hostname della macchina, a $INTERNETIF l&#8217;interfaccia con la quale la macchina esce su internet e a $VPNNAME il nome della vpn usato precedentemente (VPNNAME=mia_vpn)</em></p>
<ol>
<li>
Inseriamo le seguenti righe nel file <code>/etc/tinc/$VPNNAME/tinc.conf</code> </li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Name = <span style="color: #007800;">$PCAHOSTNAME</span>
AddressFamily = ipv4
BindToInterface = <span style="color: #007800;">$INTERNETIF</span>
Device = <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun
<span style="color: #007800;">PrivateKeyFile</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>rsa_key.priv</pre></div></div>

<li>Creiamo il file <code>/etc/tinc/$VPNNAME/hosts/$PCAHOSTNAME</code> e all&#8217;interno mettiamo:<br />
<em>l&#8217;ip 10.0.10.1 è stato preso a caso dalla classe 10.x.x.x, potrete cambiarlo a vostro piacimento</em></li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Address = x.y.z.t
Subnet = 10.0.10.1<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">32</span></pre></div></div>

<li>Aggiungiamo al file <code>/etc/tinc/$VPNNAME/tinc-up</code></li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$VPNNAME</span> 10.0.10.1 netmask 255.255.0.0 up</pre></div></div>

<li>Mentre nel file <code>/etc/tinc/$VPNNAME/tinc-down</code> mettiamo</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$VPNNAME</span> down</pre></div></div>

<li>Lanciamo il comando per generare la chiave per criptare la comunicazione e diamo invio alle successive richieste</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tincd <span style="color: #660033;">-K</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$VPNNAME</span></pre></div></div>

</ol>
<li>
Possiamo finalmente passare a PCB, i passi saranno uguali se non per alcuni dettagli
</li>
<ol>
<li>Configuriamo il portforwarding del router in modo da mandare tutte le richieste delle porte 655 TCP/UDP su PCB</li>
<li>Inseriamo le seguenti righe nel file <code>/etc/tinc/$VPNNAME/tinc.conf</code></li>
<p><strong>Rispetto alla configurazione di PCA abbiamo aggiunto le righe 5 e 6.</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">Name = <span style="color: #007800;">$PCBHOSTNAME</span>
AddressFamily = ipv4
BindToInterface = <span style="color: #007800;">$INTERNETIF</span>
Device = <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>tun
ConnectTo = <span style="color: #007800;">$PCAHOSTNAME</span>
TCPOnly = <span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">PrivateKeyFile</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$VPNNAME</span><span style="color: #000000; font-weight: bold;">/</span>rsa_key.priv</pre></td></tr></table></div>

<li>Creiamo il file <code>/etc/tinc/$VPNNAME/hosts/$PCBHOSTNAME</code> e inseriamoci:</li>
<p><em>l&#8217;ip 10.0.10.2 è stato preso a caso dalla classe 10.x.x.x, potrete cambiarlo a vostro piacimento</em></p>

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

<li>Aggiungiamo al file <code>/etc/tinc/$VPNNAME/tinc-up</code></li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$VPNNAME</span> 10.0.10.2 netmask 255.255.0.0 up</pre></div></div>

<li>Mentre nel file <code>/etc/tinc/$VPNNAME/tinc-down</code> mettiamo</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$VPNNAME</span> down</pre></div></div>

<li>Lanciamo il comando per generare la chiave per criptare la comunicazione e diamo invio alle successive richieste</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tincd <span style="color: #660033;">-K</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$VPNNAME</span></pre></div></div>

</ol>
</ul>
<p>La procedura è quasi terminata, dovremmo solo copiare i file</p>
<ul>
<li><code>/etc/tinc/$VPNNAME/hosts/$PCAHOSTNAME</code> sulla stessa directory in PCB</li>
<li><code>/etc/tinc/$VPNNAME/hosts/$PCBHOSTNAME</code> sulla stessa directory in PCA</li>
</ul>
<p>In questo momento dovremmo avere nella directory <code> etc/tinc/$VPNNAME/</code> di entrambe le macchine i seguenti file</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>tinc.conf
.<span style="color: #000000; font-weight: bold;">/</span>tinc-up
.<span style="color: #000000; font-weight: bold;">/</span>rsa_key.priv
.<span style="color: #000000; font-weight: bold;">/</span>tinc-down
.<span style="color: #000000; font-weight: bold;">/</span>hosts
.<span style="color: #000000; font-weight: bold;">/</span>hosts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$PCAHOSTNAME</span>
.<span style="color: #000000; font-weight: bold;">/</span>hosts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$PCBHOSTNAME</span></pre></div></div>

<p>Se tutto è stato configurato in maniera corretta, basterà dare il seguente comando su entrambi i pc</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tincd <span style="color: #660033;">-n</span> <span style="color: #007800;">$VPNNAME</span></pre></div></div>

<p>e per verificare l&#8217;effettivo funzionamento</p>
<ul>
<li>Da PCA proviamo:</li>

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

<li>Da PCB proviamo:</li>

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

</ul>
<p>In caso di problemi è possibile <strong>lanciare tinc in modalità debug</strong> per analizzare al meglio eventuali errori</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tincd <span style="color: #660033;">-D</span> <span style="color: #660033;">-d5</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$VPNNAME</span></pre></div></div>

<p>[1] <a class="html" href="http://it.wikipedia.org/wiki/Virtual_Private_Network">http://it.wikipedia.org/wiki/Virtual_Private_Network</a><br />
[2] <a class="html" href="http://www.tinc-vpn.org/">http://www.tinc-vpn.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2010/08/14/simple-vpn-with-tinc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C debbugging printf macro</title>
		<link>http://www.lanziani.com/2010/08/03/c-debbugging-printf-macro/</link>
		<comments>http://www.lanziani.com/2010/08/03/c-debbugging-printf-macro/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 14:37:27 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[c]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[printf]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=725</guid>
		<description><![CDATA[Ci farebbero comodo dei messaggi di debug durante la stesura del nostro software, ma vorremmo fare in modo che alla fine della codifica non sia necessario cancellare tutte le singole righe manualmente&#8230; Niente di più semplice, basterà inserire nel file (&#8230;)</p><p><a href="http://www.lanziani.com/2010/08/03/c-debbugging-printf-macro/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>Ci farebbero comodo dei messaggi di debug durante la stesura del nostro software</strong>, ma vorremmo fare in modo che alla fine della codifica non sia necessario cancellare tutte le singole righe manualmente&#8230;</p>
<p><span id="more-725"></span></p>
<p>Niente di più semplice, basterà inserire nel file .h la seguente macro</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">&nbsp;
<span style="color: #339933;">#ifdef DEBUG</span>
<span style="color: #339933;">#define YELLOW ”\033[1;33m”</span>
<span style="color: #339933;">#define RED &quot;\033[31m&quot;</span>
<span style="color: #339933;">#define GREEN &quot;\033[32m&quot;</span>
<span style="color: #339933;">#endif</span>
&nbsp;
<span style="color: #339933;">#ifdef DEBUG</span>
  <span style="color: #808080; font-style: italic;">/**PRINTE... PRINTError*/</span>
  <span style="color: #339933;">#define PRINTE(format, args...)  printf(RED format NORMAL &quot;\n&quot;, ##args);</span>
  <span style="color: #808080; font-style: italic;">/**PRINTW... PRINTWarning*/</span>
  <span style="color: #339933;">#define PRINTW(format, args...)  printf(YELLOW format NORMAL &quot;\n&quot;, ##args);</span>
  <span style="color: #808080; font-style: italic;">/**PRINTA... PRINTAlarm*/</span>
  <span style="color: #339933;">#define PRINTA(format, args...)  printf(GREEN format NORMAL &quot;\n&quot;, ##args); </span>
<span style="color: #339933;">#else</span>
  <span style="color: #339933;">#define PRINTE(format, args...)</span>
  <span style="color: #339933;">#define PRINTW(format, args...)</span>
  <span style="color: #339933;">#define PRINTA(format, args...)</span>
<span style="color: #339933;">#endif</span></pre></div></div>

<p>e nel codice, volendo lasciare un messaggio di debug, al posto della solita <code>printf</code>, basterà usare una tra le seguenti macro <code>PRINTE/PRINTW/PRINTA</code>.</p>
<p>Per abilitare il debug basterà compilare con l&#8217;opzione <code> -DDEBUG</code> e le macro faranno il resto.<br />
Se il codice viene compilato senza tale opzione, le chiamate a <code>PRINTE/PRINTW/PRINTA</code> verranno completamente eliminate dal software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2010/08/03/c-debbugging-printf-macro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tunnel IPv6 Step by Step</title>
		<link>http://www.lanziani.com/2010/07/08/tunnel-ipv6-step-by-step/</link>
		<comments>http://www.lanziani.com/2010/07/08/tunnel-ipv6-step-by-step/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 13:04:15 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[Internet Service]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=649</guid>
		<description><![CDATA[IPv6 è la versione di Internet Protocol che sostituirà IPv4 a &#8220;breve&#8221;, chi volesse saperne di più legga il riferimento [1]. Per navigare attualmente con un indirizzo IPv6 (alcuni siti/servizi sono già disponibili con questo protocollo) vi è la necessità (&#8230;)</p><p><a href="http://www.lanziani.com/2010/07/08/tunnel-ipv6-step-by-step/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p><strong>IPv6 è la versione di Internet Protocol che sostituirà IPv4</strong> a &#8220;breve&#8221;, chi volesse saperne di più legga il riferimento [1].</p>
<p>Per navigare attualmente con un indirizzo IPv6 (alcuni siti/servizi sono già disponibili con questo protocollo) vi è la necessità che qualcuno ce ne fornisca uno.</p>
<p><span id="more-649"></span></p>
<p><strong>Perché crearsi un tunnel IPv6?</strong><br />
<em>La mia è stata semplice curiosità&#8230;</em></p>
<p><strong>Per creare il tunnel abbiamo bisogno di un Tunnel broker [2]</strong>, personalmente ho usato HURRICANE ELECTRIC [3] e di seguito vi illustrerò la serie di passi necessari per crearsi un proprio tunnel IPv6.</p>
<h2>Iniziamo la procedura&#8230;</h2>
<p>Per usufruire del servizio è necessario registrarsi alla pagina <a href="http://tunnelbroker.net/register.php">http://tunnelbroker.net/register.php</a>.<br />
Una volta effettuato il login alla pagina, sulla destra si avrà a disposizione un pannello con le funzioni utente da cui andrà selezionata la voce  <strong>Create Regular Tunnel</strong>.<br />
<a href="http://www.lanziani.com/wp-content/uploads/2010/07/User_function.png"><img src="http://www.lanziani.com/wp-content/uploads/2010/07/User_function.png" alt="User Functions" title="User_functions" width="178" height="104" class="aligncenter size-full wp-image-652" /></a></p>
<p>Verrà chiesto, a questo punto, di inserire un <em>&#8220;IPv4 endpoint&#8221;</em>, l&#8217;indirizzo IPv4 della vostra parte del tunnel&#8230;</p>
<ul>
<li>Se avete un indirizzo IPv4 fisso potete inserirlo tranquillamente nella casella</li>
<li>Se invece il vostro indirizzo non è fisso ma varia di volta in volta dovrete usare uno script per aggiornare l&#8217;indirizzo di volta in volta come indicato qui [4](nel prossimo post mostrerò lo script)</li>
</ul>
<p><strong>Se la macchina da collegare via IPv6 è quella su cui stiamo lavorando, basterà inserire come <em>&#8220;IPv4 endpoint&#8221;</em> il valore che si trova in <em>&#8220;You are viewing from IP&#8221;</em></strong> e premendo il tasto <code>Submit</code> verremo rimandati alla pagina con i dettagli del tunnel appena creato&#8230;</p>
<p>Qui, in fondo alla pagina sarà presente un menù con la scritta <em>Example IPv6 Tunnel Configurations by OS (Windows, Linux, etc.)</em>, dal quale è possibile ricavare i comandi per una corretta configurazione del tunnel.</p>
<div id="attachment_655" class="wp-caption aligncenter" style="width: 478px"><a href="http://www.lanziani.com/wp-content/uploads/2010/07/Example_config.png"><img src="http://www.lanziani.com/wp-content/uploads/2010/07/Example_config.png" alt="Menu for see the examples of config" title="Example_config" width="468" height="83" class="size-full wp-image-655" /></a><p class="wp-caption-text">Config Examples</p></div>
<p>Nel caso di linux ci verranno mostrate le righe da copiare e incollare nella nostra shell per abilitare il tunnel&#8230;<br />
Fatto questo basterà verificarne il funzionamento attraverso il comando</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ping6 ipv6.google.com</pre></div></div>

<p>[1] <a class="html" href="http://it.wikipedia.org/wiki/IPv6">http://it.wikipedia.org/wiki/IPv6</a><br />
[2] <a class="html" href="http://en.wikipedia.org/wiki/Tunnel_broker">http://en.wikipedia.org/wiki/Tunnel_broker</a><br />
[3] <a class="html" href="http://he.net/">http://he.net/</a><br />
[4] <a class="html" href="https://tunnelbroker.net/ipv4_end.php">https://tunnelbroker.net/ipv4_end.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2010/07/08/tunnel-ipv6-step-by-step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect con xinetd</title>
		<link>http://www.lanziani.com/2010/07/02/redirect-con-xinetd/</link>
		<comments>http://www.lanziani.com/2010/07/02/redirect-con-xinetd/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 10:36:15 +0000</pubDate>
		<dc:creator>Nss</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[dmz]]></category>
		<category><![CDATA[port]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[xinetd]]></category>

		<guid isPermaLink="false">http://lanziani.com/blog/?p=641</guid>
		<description><![CDATA[Ho sempre sostenuto che sia cosa buona e giusta avere amici che ne sanno più di te :D. Problema: Router con pagina di amministrazione sulla porta 8081 Ip del router settato a 192.168.10.1 Router con dmz abilitata su ip 192.168.10.90 (&#8230;)</p><p><a href="http://www.lanziani.com/2010/07/02/redirect-con-xinetd/">Continua a leggere &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Ho sempre sostenuto che sia cosa buona e giusta avere amici che ne sanno più di te :D.</p>
<p>Problema:</p>
<ul>
<li>Router con pagina di amministrazione sulla porta <code>8081</code></li>
<li>Ip del router settato a <code>192.168.10.1</code></li>
<li>Router con dmz abilitata su ip <code>192.168.10.90</code></li>
<li>Come accedo dall&#8217;esterno alla porta <code>8081</code> del router se quest&#8217;ultimo redirige tutte le richieste su <code>192.168.10.90</code></li>
</ul>
<p>Soluzione&#8230;</p>
<p><span id="more-641"></span></p>
<ul>
<li>Lorenzo :D</li>
</ul>
<p>Basterà aggiungere sulla macchina <code>192.168.10.90</code> il file <code>/etc/xinetd.d/routerwebmin</code> e all&#8217;interno di questo le seguenti righe:<br />
Il servizio sarà di tipo <del datetime="2010-11-26T13:27:06+00:00">tproxy</del> <code>sunproxyadmin</code> in quanto è il servizio abbinato alla porta <code>8081</code> nel file <code>/etc/services</code></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">service sunproxyadmin
{
        socket_type = stream
        protocol = tcp
        wait = no
        user = root
        bind = 192.168.10.90
        redirect = 192.168.10.1 8081
        disable = no
}</pre></div></div>

<p>a questo punto avviamo xinetd con il comando <code>/etc/rc.d/xinetd start</code>.<br />
PS. ricordiamoci di aggiungere tale demone tra quelli che partono all&#8217;avvio&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lanziani.com/2010/07/02/redirect-con-xinetd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.lanziani.com @ 2012-05-19 19:38:09 by W3 Total Cache -->
