<?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>Vive-libre.com &#187; UBUNTU</title>
	<atom:link href="http://vive-libre.com/blog/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://vive-libre.com/blog</link>
	<description>Un espacio, para la libertad.</description>
	<lastBuildDate>Thu, 24 Dec 2009 18:25:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Configuracion de Ubuntu Server 8.10: DHCP + Squid + Iptables</title>
		<link>http://vive-libre.com/blog/2009/03/03/configuracion-de-ubuntu-server-810-dhcp-squid-iptables/</link>
		<comments>http://vive-libre.com/blog/2009/03/03/configuracion-de-ubuntu-server-810-dhcp-squid-iptables/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 06:00:11 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[COMO]]></category>
		<category><![CDATA[COMPARTIR]]></category>
		<category><![CDATA[INTERNET]]></category>
		<category><![CDATA[IPTABLES]]></category>
		<category><![CDATA[PROXY]]></category>
		<category><![CDATA[SEGURIDAD]]></category>
		<category><![CDATA[SERVER]]></category>
		<category><![CDATA[SQUID]]></category>
		<category><![CDATA[UBUNTU]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2009/03/03/configuracion-de-ubuntu-server-810-dhcp-squid-iptables/</guid>
		<description><![CDATA[Despues de instalar un servidor con Ubuntu Server en este caso 8.10, lo que normalmente necesitamos es proveer de servicio de internet y con ello establecer ciertas reglas para controlar el acceso a siertas paginas, para mantener fluido el trafico de nuestra red, el primer paso seria configurar el servidorDHCP, para asignar las ip automaticamente.
Para [...]]]></description>
			<content:encoded><![CDATA[<p>Despues de instalar un servidor con Ubuntu Server en este caso 8.10, lo que normalmente necesitamos es proveer de servicio de internet y con ello establecer ciertas reglas para controlar el acceso a siertas paginas, para mantener fluido el trafico de nuestra red, el primer paso seria configurar el servidorDHCP, para asignar las ip automaticamente.</p>
<p>Para este caso en particular tomaremos de referencia la siguinete informacion</p>
<p><img src="http://vive-libre.com/blog/etc/red.JPG" alt="" width="488" height="324" align="absmiddle" /></p>
<p>Direccion de red interna: <strong>192.168.2.0/24</strong></p>
<p>Interface con salida a internet: <strong>eth0</strong></p>
<p>Interface conectada a la red interna: <strong>eth1</strong></p>
<p>Ip de eth1: <strong>192.168.2.1</strong></p>
<p>Ip de eth0: <strong>192.168.1.100 </strong></p>
<p>En este caso salimos a internet por medio de un modem 2wire de Telmex, aun que esto no importa demaciado, solo es para referencia.</p>
<p>Lo primero que debemos da hacer es configurar las ip estaticas, como estamos usando una version de servidor asumimos que no tenemos interface grafica asi que nuestro editor de archivos sera VI , pero pueden usar el que mas les acomode.</p>
<p>En vi hay dos modos de trabajo edicion y comandos, para edita un archivo hay que precionar la tecla [insert] para salir del modo de edicion y pasar a comandos precionamos la tecla [esc]  si queremos guardar el archivo entramos a modo de comandos y tecleamos :w si queremos salir es :q si queremos guardar y salir :wq para forzar cualquier accion agregamos el ! forzar el guardar :w! o forzar la salida :q!</p>
<div class="igBar"><span id="lcode-54"><a href="#" onclick="javascript:showPlainTxt('code-54'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-54">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo apt-get install vim </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lcode-55"><a href="#" onclick="javascript:showPlainTxt('code-55'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-55">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo vi /etc/network/interfaces </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahi pondremos esto</p>
<div class="igBar"><span id="lcode-56"><a href="#" onclick="javascript:showPlainTxt('code-56'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-56">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># This file describes the network interfaces available on your system</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># and how to activate them. <span style="">For</span> more information, see interfaces<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span>.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># The loopback network interface</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">auto lo</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iface lo inet loopback</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># The primary network interface</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">auto eth0</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iface eth0 inet static</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">address <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">100</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">netmask <span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">network <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">broadcast <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">255</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gateway <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">254</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dns-nameservers <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">254</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">auto eth1</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iface eth1 inet static</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">address <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">netmask <span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Que significa esto?</p>
<p>Esto nos inidica cual es la interface de loopback nada interesante</p>
<div class="igBar"><span id="lcode-57"><a href="#" onclick="javascript:showPlainTxt('code-57'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-57">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># This file describes the network interfaces available on your system</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># and how to activate them. <span style="">For</span> more information, see interfaces<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span>.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># The loopback network interface</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">auto lo</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iface lo inet loopback </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Se define la configuracion para eth0 que es la tarjeta que nos conectara a internet</p>
<div class="igBar"><span id="lcode-58"><a href="#" onclick="javascript:showPlainTxt('code-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-58">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># The primary network interface</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">auto eth0 </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Aqui indicamos que la direccion es de tipo estatico</p>
<div class="igBar"><span id="lcode-59"><a href="#" onclick="javascript:showPlainTxt('code-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-59">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iface eth0 inet static </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La variable addres  es una ip del rango que nos asigna el modem para salir a internet</p>
<div class="igBar"><span id="lcode-60"><a href="#" onclick="javascript:showPlainTxt('code-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-60">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">address <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">100</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">netmask <span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La red por defecto</p>
<div class="igBar"><span id="lcode-61"><a href="#" onclick="javascript:showPlainTxt('code-61'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-61">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">network <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">broadcast <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">255</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Es la puerta de enlace que nos da salida a internet</p>
<div class="igBar"><span id="lcode-62"><a href="#" onclick="javascript:showPlainTxt('code-62'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-62">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gateway <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">254</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y los DNS en este caso usamos el mismo modem para que nos resuelva hacia internet, esto datos cambian segun la configuracion de la red que les da salida a internet</p>
<div class="igBar"><span id="lcode-63"><a href="#" onclick="javascript:showPlainTxt('code-63'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-63">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">dns-nameservers <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">254</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Esta es la configuracion de la tarjeta de red a la que se conectara la red interna, solo hay que indicar la direccion IP y mascara, ya que nos conectaremos a internet por la otra tarjeta de red.</p>
<div class="igBar"><span id="lcode-64"><a href="#" onclick="javascript:showPlainTxt('code-64'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-64">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">auto eth1</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iface eth1 inet static</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">address <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">netmask <span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para que cargue la nueva configuracion reiniciaremos los servicio de red</p>
<div class="igBar"><span id="lcode-65"><a href="#" onclick="javascript:showPlainTxt('code-65'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-65">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo /etc/init.<span style="">d</span>/networking restart </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si todo esta bien configurado veremos algo como esto</p>
<div class="igBar"><span id="lcode-66"><a href="#" onclick="javascript:showPlainTxt('code-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-66">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">* Reconfiguring network interfaces...</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">* if-up.<span style="">d</span>/mountnfs<span style="color:#006600; font-weight:bold;">&#91;</span>eth0<span style="color:#006600; font-weight:bold;">&#93;</span>: waiting for interface eth1 before doing NFS mounts</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span> OK <span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>El siguiente paso es configurar el DHCP, para asignar las direcciones ip de forma automatica, para esto usaremos dhcp3-server</p>
<div class="igBar"><span id="lcode-67"><a href="#" onclick="javascript:showPlainTxt('code-67'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-67">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo apt-get install dhcp3-server </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Primero hay que indicar en que interface de red es donde va a escuchar para eso editamos el siguiente archivo</p>
<div class="igBar"><span id="lcode-68"><a href="#" onclick="javascript:showPlainTxt('code-68'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-68">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo vi /etc/default/dhcp3-server </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>En nuestro caso la tarjeta que va a proveer el servicio es la eth1 que va a la red interna</p>
<div class="igBar"><span id="lcode-69"><a href="#" onclick="javascript:showPlainTxt('code-69'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-69">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Defaults for dhcp initscript</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># sourced by /etc/init.<span style="">d</span>/dhcp</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># installed at /etc/default/dhcp3-server by the maintainer scripts</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># This is a POSIX shell fragment</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># On what interfaces should the DHCP server <span style="color:#006600; font-weight:bold;">&#40;</span>dhcpd<span style="color:#006600; font-weight:bold;">&#41;</span> serve DHCP requests?</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#       Separate multiple interfaces with spaces, e.<span style="">g</span>. <span style="color:#CC0000;">"eth0 eth1"</span>.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">INTERFACES</span>=<span style="color:#CC0000;">"eth1"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora hay que configurar el dhcp, en el siguiente archivo.</p>
<div class="igBar"><span id="lcode-70"><a href="#" onclick="javascript:showPlainTxt('code-70'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-70">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo vi /etc/dhcp3/dhcpd.<span style="">conf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Tendremos un muy extenso archivo de configuracion de lo cual solo nos servira lo siguiente, lo demas lo podemos eliminar</p>
<div class="igBar"><span id="lcode-71"><a href="#" onclick="javascript:showPlainTxt('code-71'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-71">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ddns-update-style interim;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">authoritative;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">subnet <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span> netmask <span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">range <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">100</span> <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">200</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">option domain-name-servers <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">254</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">option routers <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">option broadcast-address <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">255</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">default-lease-time <span style="color:#800000;color:#800000;">36000</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">max-lease-time <span style="color:#800000;color:#800000;">180000</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Empezamos por definir sobre que red se va atrabajar y la mascara</p>
<div class="igBar"><span id="lcode-72"><a href="#" onclick="javascript:showPlainTxt('code-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-72">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ddns-update-style interim;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">authoritative;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">subnet <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span> netmask <span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Indicamos el rando de direcciones que deseamos que asigne en este caso asiganras desdela ip 192.168.2.100 hasta la ip 192.168.2.200</p>
<div class="igBar"><span id="lcode-73"><a href="#" onclick="javascript:showPlainTxt('code-73'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-73">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">range <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">100</span> <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">200</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Indicamos los DNS</p>
<div class="igBar"><span id="lcode-74"><a href="#" onclick="javascript:showPlainTxt('code-74'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-74">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">option domain-name-servers <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">254</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La puerta de enlace, en este caso el servidor ubuntu, ya que todas las maquinas de la red se conectaran a nosotros para proveerlos de internet.</p>
<div class="igBar"><span id="lcode-75"><a href="#" onclick="javascript:showPlainTxt('code-75'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-75">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">option routers <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">1</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Estos son los valores que en dado caso se tendrian que modificar segun su configuracion de red. Solo quedaria reiniciar el servicio de DHCP</p>
<div class="igBar"><span id="lcode-76"><a href="#" onclick="javascript:showPlainTxt('code-76'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-76">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo /etc/init.<span style="">d</span>/dhcp3-server restart </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Si todo esta bien obtendremos esto</p>
<div class="igBar"><span id="lcode-77"><a href="#" onclick="javascript:showPlainTxt('code-77'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-77">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">* Stopping DHCP server dhcpd3                                           <span style="color:#006600; font-weight:bold;">&#91;</span> OK <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">* Starting DHCP server dhcpd3                                            <span style="color:#006600; font-weight:bold;">&#91;</span> OK <span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora instalaremos el proxy, en este caso Squid</p>
<div class="igBar"><span id="lcode-78"><a href="#" onclick="javascript:showPlainTxt('code-78'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-78">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo apt-get install squid </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Es muy importante para poder compartir el internet tener activado al <strong>Froward</strong>, para esto crearemos un archivo que se ejecutara al inicio del arranque donde tambien se cargaran las iptables, ya que estas configuraciones, se pierden cada vez que se apaga el equipo, este archivo se llamara iptables.cf, o como gusten llamarle</p>
<div class="igBar"><span id="lcode-79"><a href="#" onclick="javascript:showPlainTxt('code-79'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-79">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo vi /etc/init.<span style="">d</span>/iptables.<span style="">cf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y pondremos lo siguiente</p>
<div class="igBar"><span id="lcode-80"><a href="#" onclick="javascript:showPlainTxt('code-80'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-80">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -F</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -X</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -Z</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -F</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -P INPUT ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -P OUTPUT ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -P FORWARD ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -P PREROUTING ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -P POSTROUTING ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -A POSTROUTING -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -o eth0 -j MASQUERADE</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -A PREROUTING -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -d ! <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -p tcp --dport <span style="color:#800000;color:#800000;">80</span> -j REDIRECT --to-port <span style="color:#800000;color:#800000;">3128</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A INPUT -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">993</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">110</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">465</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">25</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">80</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">443</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">53</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p udp --dport <span style="color:#800000;color:#800000;">53</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#800000;color:#800000;">1</span>&amp;gt; /proc/sys/net/ipv4/ip_forward </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Que es esto?</p>
<p>Las iptables nos ayudaran a decidir que dejar pasar por la red y por donde dejarlo pasar, en este caso, solo configuraremos las iptables para que nos redireccionen todo el del puerto 80 hacia el puerto 3128 que es el puerto del squid, para que no tengamos que configurar el proxy en todas las maquinas <img src='http://vive-libre.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> , y ya que compartimos el internet enmascaramos todo lo que venga de la red interna y que saldra por la interface eth0, permitiremos tambien el forward para el dhcp y tambien para el correo, para no tener problemas con los clientes de correo.</p>
<p>Borramos las reglas que se esten ejecuntando</p>
<div class="igBar"><span id="lcode-81"><a href="#" onclick="javascript:showPlainTxt('code-81'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-81">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -X</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -Z</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -F </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Aceptamos coneciones saliente, entrantes, el forward, prerouting y postrouting</p>
<div class="igBar"><span id="lcode-82"><a href="#" onclick="javascript:showPlainTxt('code-82'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-82">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -P INPUT ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -P OUTPUT ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -P FORWARD ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -P PREROUTING ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -P POSTROUTING ACCEPT </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Esta es una configuracion muy basica asi que por el momento no nos preocuparemos por el tema de la seguridad (eso es otro HowTo)</p>
<p>Habilitamos el enmascaramiento, para que la red interna pueda salir a internet por la conexion del server</p>
<div class="igBar"><span id="lcode-83"><a href="#" onclick="javascript:showPlainTxt('code-83'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-83">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -A POSTROUTING -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -o eth0 -j MASQUERADE </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Activamos el redireccionamiento para el proxy tranparente, tambien indicamos que lo redireccionaremos siempre y cuando el destino no sea una direccion dentro de la misma red, digase servidores web locales todo lo demas al proxy</p>
<div class="igBar"><span id="lcode-84"><a href="#" onclick="javascript:showPlainTxt('code-84'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-84">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -t nat -A PREROUTING -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -d ! <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -p tcp --dport <span style="color:#800000;color:#800000;">80</span> -j REDIRECT --to-port <span style="color:#800000;color:#800000;">3128</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Habilitamos el forward para los puertos especificos de correo y dhcp,  pop,  imap, simap, smtp, ssmtp y dhcp</p>
<div class="igBar"><span id="lcode-85"><a href="#" onclick="javascript:showPlainTxt('code-85'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-85">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">993</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">110</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">465</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">25</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">80</span> -j ACCEPT</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">443</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p tcp --dport <span style="color:#800000;color:#800000;">53</span> -j ACCEPT</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">iptables -A FORWARD -s <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> -i eth1 -p udp --dport <span style="color:#800000;color:#800000;">53</span> -j ACCEPT </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y por ultimo habilitamos el forward</p>
<div class="igBar"><span id="lcode-86"><a href="#" onclick="javascript:showPlainTxt('code-86'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-86">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#800000;color:#800000;">1</span>&amp;gt; /proc/sys/net/ipv4/ip_forward </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Con esto es mas que suficiente, ahora hay que darle permisos de ejecucion</p>
<div class="igBar"><span id="lcode-87"><a href="#" onclick="javascript:showPlainTxt('code-87'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-87">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo chmod a+x /etc/init.<span style="">d</span>/iptables.<span style="">cf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora para que se ejecute al arranque instalaremos un pequeño programa que nos ayuda a configurar los archivos que se ejecutan al iniciar el sistema</p>
<div class="igBar"><span id="lcode-88"><a href="#" onclick="javascript:showPlainTxt('code-88'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-88">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo apt-get install rcconf </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>y lo ejecutaremos con</p>
<div class="igBar"><span id="lcode-89"><a href="#" onclick="javascript:showPlainTxt('code-89'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-89">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo rcconf </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><img src="http://vive-libre.com/blog/etc/rcconf.JPG" alt="" /></p>
<p>Veran esta pantalla solo hay que marcar el iptables.cf y todo listo si nececitan correr un archivo al arranque solo concedanle permisos y de la misma forma  : D.</p>
<p>Ahora hay que configurar el Squid, para eso editaremos el siguiente archivo.</p>
<div class="igBar"><span id="lcode-90"><a href="#" onclick="javascript:showPlainTxt('code-90'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-90">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo vi /etc/squid/squid.<span style="">conf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>De igualmanera, podemos borrar todo y dejar solo lo siguiente</p>
<div class="igBar"><span id="lcode-91"><a href="#" onclick="javascript:showPlainTxt('code-91'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-91">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_port <span style="color:#800000;color:#800000;">3128</span> transparent</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cache_mem <span style="color:#800000;color:#800000;">16</span> MB</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cache_dir ufs /var/spool/squid <span style="color:#800000;color:#800000;">700</span> <span style="color:#800000;color:#800000;">16</span> <span style="color:#800000;color:#800000;">256</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ie_refresh on</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">offline_mode on</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl all src <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl red_local src <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl plus src <span style="color:#CC0000;">"/etc/squid/plus.lst"</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl sites url_regex <span style="color:#CC0000;">"/etc/squid/sites.lst"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl files url_regex -i .<span style="">exe</span> .<span style="">flv</span> .<span style="">mp4</span> .<span style="">mp3</span> .<span style="">avi</span> .<span style="">wma</span> .<span style="">mov</span> .<span style="">acc</span> .<span style="">wav</span> .<span style="">bat</span> .<span style="">asf</span> .<span style="">mpeg</span> .3gp .<span style="">swf</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl localhost src <span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span>/<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access deny red_local !plus sites</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access deny red_local !plus files</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access allow red_local</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access allow localhost</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access deny all </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Para que esto funciones habremos de crear dos archivos, uno donde se guardaran las paginas que deseamos bloquear, y otro donde tendremos una lista de las ip que  tendran derechos privilegiados <img src='http://vive-libre.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<div class="igBar"><span id="lcode-92"><a href="#" onclick="javascript:showPlainTxt('code-92'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-92">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">vi /etc/squid/sites.<span style="">lst</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Aqui pondremos las paginas bloqueadas, esta es mi lista, algunas paginas de video redes sociales, mensageros web etc.</p>
<div class="igBar"><span id="lcode-93"><a href="#" onclick="javascript:showPlainTxt('code-93'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-93">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">hi5.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">metroflog</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mx.<span style="">youtube</span>.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">es.<span style="">youtube</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">youtube</span>.<span style="">com</span>.<span style="">us</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">youtube</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">youtube</span>.<span style="">com</span>.<span style="">mx</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">dailymotion</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">tu</span>.<span style="">tv</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">ebuddy</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">meebo</span>.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">webmessenger.<span style="">msn</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">webmessenger</span>.<span style="">msn</span>.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">iloveim</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">spacelive</span>.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">home.<span style="">spaces</span>.<span style="">live</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">myspace</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">spaces.<span style="">live</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">radiusim</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">messengerfx</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">messengerfx.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">facebook</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fulltono.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">fulltono</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rapidshare.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">megaupload.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">veoh</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">megavideo</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">proxybutton</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">videoblogs</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">video.<span style="">google</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">imo.<span style="">im</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">koolim</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">koolim.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">voltv.<span style="">es</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">imhaha</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">imhaha.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">proxify.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">proxify</span>.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">megaclick</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">my</span>-proxy.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">blogger</span>.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cbox.<span style="">ws</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">megaclilck.<span style="">com</span>/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">facebook.<span style="">com</span>/</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">youporn.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">lajaula</span>.<span style="">net</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">alianzo</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">goear</span>.<span style="">com</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">www.<span style="">zshare</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">zshare.<span style="">net</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">skydrive.<span style="">live</span>.<span style="">com</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y sigue la lista de direcciones privilegiadas</p>
<div class="igBar"><span id="lcode-94"><a href="#" onclick="javascript:showPlainTxt('code-94'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-94">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo vi /etc/squid/plus.<span style="">lst</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y agregamos las ip que deseemos</p>
<div class="igBar"><span id="lcode-95"><a href="#" onclick="javascript:showPlainTxt('code-95'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-95">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">150</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">135</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora regresando al archivo de configuracion del squid</p>
<p>Indicamos que por el puerto 3128 escucharemos y que sera proy tranparente</p>
<div class="igBar"><span id="lcode-96"><a href="#" onclick="javascript:showPlainTxt('code-96'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-96">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_port <span style="color:#800000;color:#800000;">3128</span> transparent </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Estos valores dejarlos tal cual</p>
<div class="igBar"><span id="lcode-97"><a href="#" onclick="javascript:showPlainTxt('code-97'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-97">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cache_mem <span style="color:#800000;color:#800000;">16</span> MB</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cache_dir ufs /var/spool/squid <span style="color:#800000;color:#800000;">700</span> <span style="color:#800000;color:#800000;">16</span> <span style="color:#800000;color:#800000;">256</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ie_refresh on</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">offline_mode on </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Las acl o definiciones de control de acceso, son las que nos permitiran hacer referencias hacia ciertos elementos ya sea ip, direciones etc</p>
<p>La definicion all indica un origen definido por todo el rango de direciones ip</p>
<div class="igBar"><span id="lcode-98"><a href="#" onclick="javascript:showPlainTxt('code-98'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-98">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl all src <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La siguiente definicion hace referencia al conjunto de ip comprendidas dentro de nuestra red</p>
<div class="igBar"><span id="lcode-99"><a href="#" onclick="javascript:showPlainTxt('code-99'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-99">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl red_local src <span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">0</span>/<span style="color:#800000;color:#800000;">24</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La definicion plus hace referencia alas ip que se encuentran listadas dentro del archivo que creamos</p>
<div class="igBar"><span id="lcode-100"><a href="#" onclick="javascript:showPlainTxt('code-100'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-100">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl plus src <span style="color:#CC0000;">"/etc/squid/plus.lst"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La definicion sites hace referencia ala lista de sitios restringidos</p>
<div class="igBar"><span id="lcode-101"><a href="#" onclick="javascript:showPlainTxt('code-101'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-101">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl sites url_regex <span style="color:#CC0000;">"/etc/squid/sites.lst"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>La definicion files es un conjunto de extenciones las cuales se van a restringir para su descarga, hay que tener un poco de cuidado, por ejemplo los archivos .bin pueden ser desde binarios de linux, como imagenes de cd o archivos comprimidos, si añaden esa extencion se daran cuenta que las busquedas de google desencadenaran el bloqueo del proxy y no les dejara buscar nada, ya que dentro de la url de la busqueda se generan este tipo de extenciones, la cadena .mp bloquea el yahoo mail, asi que sehan cuidadosos es este sentido, y evitense dolores de cabeza.</p>
<div class="igBar"><span id="lcode-102"><a href="#" onclick="javascript:showPlainTxt('code-102'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-102">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl files url_regex -i .<span style="">exe</span> .<span style="">flv</span> .<span style="">mp4</span> .<span style="">mp3</span> .<span style="">avi</span> .<span style="">wma</span> .<span style="">mov</span> .<span style="">acc</span> .<span style="">wav</span> .<span style="">bat</span> .<span style="">asf</span> .<span style="">mpeg</span> .3gp .<span style="">swf</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y por ultimo la definicion del loopback</p>
<div class="igBar"><span id="lcode-103"><a href="#" onclick="javascript:showPlainTxt('code-103'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-103">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">acl localhost src <span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span>/<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahora ay que generar las reglas, para permitir o denegar el acceso usamos http_acces despues la accion deny o allow aquien se lo vamos a aplicar y que le vamos a restringir</p>
<p>Aqui denegamos a todas las direciones de la red que sean diferente a las definidas en la lista plus los sitios definidos por la lista sites</p>
<div class="igBar"><span id="lcode-104"><a href="#" onclick="javascript:showPlainTxt('code-104'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-104">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access deny red_local !plus sites </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>De igual forma denegamos a todas las ip de la red local que sean diferentes a las definidas por la lista plus el acceso a los archivo definidos en la lista files</p>
<div class="igBar"><span id="lcode-105"><a href="#" onclick="javascript:showPlainTxt('code-105'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-105">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access deny red_local !plus files </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Muy importante todas las reglas siempre deben de ir antes de estas ultimas de lo contrario el proxy aparentara que no esta funcionando, ya que las reglas llevan un orden de ejecucion</p>
<div class="igBar"><span id="lcode-106"><a href="#" onclick="javascript:showPlainTxt('code-106'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-106">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access allow red_local</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access allow localhost</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">http_access deny all </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Cada vez que se haga un cambio en las reglas habra que reiniciara el servicio, esto interrunpuria todo el trafico que este pasando por el proxy, hasta que recargue el servcio  segun la velocidad del servidor y la carga de trafico unos 20 o 30 segundo.</p>
<p>Espero sea de utilidad, y como siempre espero sus comentarios, criticas y chiste.</p>
<p>Pd. este post fue motivado por algunas dudas de los amigos del foro de Byte.</p>
<p>Asi que esto es todo</p>
<p>Byte.</p>
<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--></p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2009/03/03/configuracion-de-ubuntu-server-810-dhcp-squid-iptables/feed/</wfw:commentRss>
		<slash:comments>199</slash:comments>
		</item>
		<item>
		<title>Como cambiar la contraseña de MySQL</title>
		<link>http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/</link>
		<comments>http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 22:27:23 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[USUARIOS]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/</guid>
		<description><![CDATA[Hay veces que al instalar el mysql, tenemos el problema de
Error
MySQL ha dicho:
#1045 - Access denied for user: 'user@localhost' (Using password: YES)
Si olvidamos la contrasena o de plano nunca la tuvimos y necesitamos logearnos en mysql. La solucion es la siguiente.
Primero hay que deterner el servidor de mysql
PLAIN TEXT
CODE:




/etc/init.d/mysql stop 






Despues iniciaremos el servidor en [...]]]></description>
			<content:encoded><![CDATA[<p>Hay veces que al instalar el mysql, tenemos el problema de</p>
<p>Error<br />
MySQL ha dicho:</p>
<p>#1045 - Access denied for user: 'user@localhost' (Using password: YES)</p>
<p>Si olvidamos la contrasena o de plano nunca la tuvimos y necesitamos logearnos en mysql. La solucion es la siguiente.</p>
<p>Primero hay que deterner el servidor de mysql</p>
<div class="igBar"><span id="lcode-110"><a href="#" onclick="javascript:showPlainTxt('code-110'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-110">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql stop </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Despues iniciaremos el servidor en modo seguro, ignorando las tablas de permisos</p>
<p>/usr/bin/mysqld_safe --skip-grant-tables &amp;</p>
<p>Con esto podemos entrar a mysq, le indicamos que la tabla a usar es mysql y ejecutamos una consulta que nos permitira cambiar la contrasena actual del usuario que necesitemos , despues de ejecutar la consulta, reiniciamos los privilegios, por ultimo salimos.</p>
<div class="igBar"><span id="lcode-111"><a href="#" onclick="javascript:showPlainTxt('code-111'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-111">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mysql</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">use mysql;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">UPDATE user SET Password=PASSWORD<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'nueva_contraseña'</span><span style="color:#006600; font-weight:bold;">&#41;</span> WHERE User=\<span style="color:#CC0000;">"root<span style="color:#000099; font-weight:bold;">\"</span>;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">flush privileges;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">exit </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y solo nos queda detener el de nuevo el servidoe de mysql y volverlo a iniciar</p>
<div class="igBar"><span id="lcode-112"><a href="#" onclick="javascript:showPlainTxt('code-112'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-112">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql stop</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql start </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Esto lo he provado en ubuntu 7.4 y 7.10</p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/04/06/como-cambiar-la-contrasena-de-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mini How-to Ubuntu, Java y MySQL Parte 4</title>
		<link>http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/</link>
		<comments>http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 05:58:12 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[CODIGO]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/</guid>
		<description><![CDATA[Que tal pues seguimos con la saga, en esta parte veremos como hacer consultas desde la interfas grafica, empecemos.
Consultas a MySQL desde interfas grafica con NETBEANS.
Para empesar hay que crear un archivo nuevo,  Formulario GUI JAVA &#62; Formulario JFrame &#62;

Despues le asignamos un nombre que en este caso sera CONSULTAS y le damos terminar.

Ya [...]]]></description>
			<content:encoded><![CDATA[<p>Que tal pues seguimos con la saga, en esta parte veremos como hacer consultas desde la interfas grafica, empecemos.</p>
<p>Consultas a MySQL desde interfas grafica con NETBEANS.</p>
<p>Para empesar hay que crear un archivo nuevo,  Formulario GUI JAVA &gt; Formulario JFrame &gt;</p>
<p><img src="http://lh5.google.com/blue.star.boy/R-xRqwrZ52I/AAAAAAAAA1g/m1rq2JOLwn8/s800/Pantallazo-17.png" /></p>
<p>Despues le asignamos un nombre que en este caso sera CONSULTAS y le damos terminar.</p>
<p><img src="http://lh4.google.com/blue.star.boy/R-xRqgrZ51I/AAAAAAAAA1Y/VbHQtSD6os4/s800/Pantallazo-18.png" /></p>
<p>Ya que tenemos nuestro JFrame vamos a garegar una caja de texto un boton y una tabla que es donde vamos a visualizar los resultados de la consulta, al final obtendremos algo asi.</p>
<p><img src="http://lh6.google.com/blue.star.boy/R-xUBArZ53I/AAAAAAAAA1o/4P1KJKM2fek/s800/Pantallazo-20.png" /></p>
<p>Ahora, recordando la estructura de la base de datos que hemos estado usando, los campos que tenemos disponibles son los siguientes:</p>
<p>CREATE TABLE DATOS<br />
<span style="color: #006600; font-weight: bold">(</span><br />
NOMBRE VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">25</span><span style="color: #006600; font-weight: bold">)</span>,<br />
TELEFONO VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">15</span><span style="color: #006600; font-weight: bold">)</span>,<br />
CORREO VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">25</span><span style="color: #006600; font-weight: bold">)</span>,<br />
TWITTER VARCHAR<span style="color: #006600; font-weight: bold">(</span><span style="color: #800000">30</span><span style="color: #006600; font-weight: bold">)</span><br />
<span style="color: #006600; font-weight: bold">)</span>;</p>
<p>Los resultados que vamos a obtener de la consulta, los vamos a recibir en la tabla, por lo mismo la tabla debe de tener las mismas columnas, estas tablas no son tan dinamicas, como los arreglos en C o demas lenguajes, (o al menos no le he encontrado la forma : ) si saben se aceptan sugerencias ). Para modificar las propiedades de la tabla como columnas, filas, y tipos de datos que albergaran las columnas hay que seleccionar el objeto tabla, y dirigirse a la columna derecha, donde se encuantra la seccion de propiedades, ahi buscaremos el atributo de "MODEL", este atributo no tiene ningun valor, pero tiene un boton al final de campo con tres puntos [...], al dar click en el boton nos mostrara el menu, de la propiedades de la tabla.</p>
<p><img src="http://lh6.google.com/blue.star.boy/R-xazArZ56I/AAAAAAAAA10/FzUbeLa5hTs/s800/Pantallazo-21.png" /></p>
<p>En esta ventana modificaremos el nombre de las columnas que tiene la tabla segun sea el caso, y el tipo de datos que contendra la columna, lo podemos dejar como Object, pero lo cambiaremos a String. En la pestana de Valores predeterminados podremos ver una vista previa de la tabla, ademas de poder agregar columnas y filas con los botones que se encuentran en la parte inferior izquierda. Al termniar obtendremos esto:</p>
<p><img src="http://lh4.google.com/blue.star.boy/R-xccgrZ57I/AAAAAAAAA18/h9z0v_Mx9hQ/s800/Pantallazo-22.png" /></p>
<p>Teniedo el formulario listo, empezaremos con la programacion de la consulta a mysql. Cambiaremos el nombre de la caja de texto para manejarlo mas facil, para nuestro caso se llamara txtNombre.</p>
<p>Agregaremos un evento al boton de tipo mouseReleased para hacer la consulta y ahi debe ir el siguiente codigo:</p>
<div class="igBar"><span id="lcode-114"><a href="#" onclick="javascript:showPlainTxt('code-114'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-114">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">int j=<span style="color:#800000;color:#800000;">0</span>,i=<span style="color:#800000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Esta es la cadena a ejecutar en el servido de mysql se le pasa como parametro txtNombre, que es la caja de texto //donde se introduce el nombre a buscar, con el metodo getTex(), para obtener el texto introducido, y toStrin() para //convertir a String la cadena de la caja del texto.</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">String cadena=<span style="color:#CC0000;">"SELECT * FROM DATOS WHERE NOMBRE LIKE '%"</span>+txtNobre.<span style="">getText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">toString</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">"%';"</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//No olvidar que las conexiones siempre se manejan dentro de try, para el manejo de excepciones de lo contrario siempre //les manejara un error aun que el codigo este bien</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Le indicamos el&nbsp; driver a usar</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Class.<span style="">forName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"com.mysql.jdbc.Driver"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">newInstance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Le indicamos los datos correspondientes en la cadena de conexion, ip del servido, Base de datos usuario y pass</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">conexion=DriverManager.<span style="">getConnection</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"jdbc:mysql://127.0.0.1:3306/AGENDA"</span>,<span style="color:#CC0000;">"user"</span>,<span style="color:#CC0000;">"passwd"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sentencia=conexion.<span style="">createStatement</span><span style="color:#006600; font-weight:bold;">&#40;</span>ResultSet.<span style="">TYPE_SCROLL_INSENSITIVE</span>,ResultSet.<span style="">CONCUR_READ_ONLY</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Aqui ejecutamos la sentencia de la consulta</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">resultado=sentencia.<span style="">executeQuery</span><span style="color:#006600; font-weight:bold;">&#40;</span>cadena<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Mientras la consulta arroje resultados va entrar al while</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">while<span style="color:#006600; font-weight:bold;">&#40;</span>resultado.<span style="">next</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//El for nos servira para ir recorriendo los datos que recojimos de la consulta, el contador comienza en uno (no en cero //como los areglos en C) el indice i nos servira para ir pasando de columna en columna, tanto en la tabla como en los //resultados de la consulta,el indice j sera para ir saltando de fila en fila despues de cada recorrido de columnas</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">for<span style="color:#006600; font-weight:bold;">&#40;</span>i=<span style="color:#800000;color:#800000;">1</span>;i&amp;lt;=<span style="color:#800000;color:#800000;">4</span>;i++<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Tabla.<span style="">setValueAt</span><span style="color:#006600; font-weight:bold;">&#40;</span>resultado.<span style="">getString</span><span style="color:#006600; font-weight:bold;">&#40;</span>i<span style="color:#006600; font-weight:bold;">&#41;</span>,j,i-<span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">j=j+<span style="color:#800000;color:#800000;">1</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//Por ultimo el catch para manejar las excepciones si entra al catch mandaremos a imprimir la variable e que es donde se //guardara el mensaje de la excepcion</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">catch<span style="color:#006600; font-weight:bold;">&#40;</span>Exception e<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">JOptionPane.<span style="">showMessageDialog</span><span style="color:#006600; font-weight:bold;">&#40;</span>null,<span style="color:#CC0000;">"error: "</span>+e<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y aqui esta la prueba (Las etiquetas estan al reves pero nada de importancia <img src='http://vive-libre.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ).</p>
<p><img src="http://lh4.google.com/blue.star.boy/R_lJkQrZ58I/AAAAAAAAA2g/IGdGUGIzpzM/s800/Pantallazo-23.png" /><br />
Y listo espero les sirva de ayuda, comentarios, quejas o sujerencias ya saben a donde <img src='http://vive-libre.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Saludos</p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/04/06/mini-how-to-ubuntu-java-y-mysql-parte-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Reproducir DVD originales en UBUNTU 7.10</title>
		<link>http://vive-libre.com/blog/2008/03/11/reproducir-dvd-originales-en-ubuntu-710/</link>
		<comments>http://vive-libre.com/blog/2008/03/11/reproducir-dvd-originales-en-ubuntu-710/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 04:44:20 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[MULTIMEDIA]]></category>
		<category><![CDATA[UBUNTU]]></category>
		<category><![CDATA[DVD]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/03/11/reproducir-dvd-originales-en-ubuntu-710/</guid>
		<description><![CDATA[El motivo de que no se puedan reproducir DVD's originales es por que estos traen un codificado con CSS, para poder reproducir estos  DVD's solo debes de  ejecutar el siguiente comando para instalar, la libdvdcss2
PLAIN TEXT
CODE:




sudo apt-get install build-essential debhelper fakeroot 






PLAIN TEXT
CODE:




sudo /usr/share/doc/libdvdread3/install-css.sh 






Lo vi aqui
]]></description>
			<content:encoded><![CDATA[<p>El motivo de que no se puedan reproducir DVD's originales es por que estos traen un codificado con CSS, para poder reproducir estos  DVD's solo debes de  ejecutar el siguiente comando para instalar, la libdvdcss2</p>
<div class="igBar"><span id="lcode-117"><a href="#" onclick="javascript:showPlainTxt('code-117'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-117">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo apt-get install build-essential debhelper fakeroot </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lcode-118"><a href="#" onclick="javascript:showPlainTxt('code-118'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-118">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sudo /usr/share/doc/libdvdread3/install-css.<span style="">sh</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Lo vi <a href="http://doc.ubuntu-es.org/Reproducir_DVD">aqui</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/03/11/reproducir-dvd-originales-en-ubuntu-710/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mini How-to Ubuntu, Java y MySQL Parte 3</title>
		<link>http://vive-libre.com/blog/2008/03/11/mini-how-to-ubuntu-java-y-mysql-parte-3/</link>
		<comments>http://vive-libre.com/blog/2008/03/11/mini-how-to-ubuntu-java-y-mysql-parte-3/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 02:24:32 +0000</pubDate>
		<dc:creator>yovany</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[UBUNTU]]></category>

		<guid isPermaLink="false">http://vive-libre.com/blog/2008/03/11/mini-how-to-ubuntu-java-y-mysql-parte-3/</guid>
		<description><![CDATA[Insercion con interfas grafica.
En esta parte haremos una interfas grafica con netbeans que haga una conexion a MySQL, para realizar una insercion sencilla.
Abrimos el netbeans y lo primero que hay que hacer es un proyecto, nos abrira un formulario donde selecionaremos, de la categoria "GENERAL", proyectos "Aplicacion JAVA".

Daremos siguiente, y nos solicitara el nombre y [...]]]></description>
			<content:encoded><![CDATA[<p>Insercion con interfas grafica.</p>
<p>En esta parte haremos una interfas grafica con netbeans que haga una conexion a MySQL, para realizar una insercion sencilla.</p>
<p>Abrimos el netbeans y lo primero que hay que hacer es un proyecto, nos abrira un formulario donde selecionaremos, de la categoria "GENERAL", proyectos "Aplicacion JAVA".</p>
<p><img src="http://lh3.google.com/blue.star.boy/R9XRngDvUfI/AAAAAAAAAxw/X0fSrOMvQwc/s400/Pantallazo-5.png" /></p>
<p>Daremos siguiente, y nos solicitara el nombre y ubicacion, a guardar del proyecto, el directorio por defecto es la carpeta raiz del usuario /home/user/ y el nombre que usaremos para este proyecto ser AGENDA.</p>
<p><img src="http://lh4.google.com/blue.star.boy/R9XRnwDvUgI/AAAAAAAAAx4/4bqIBSW5GVo/s400/Pantallazo-6.png" /></p>
<p>Al dar siguiente nos mostrara el Main.java que es de donde mandaremos llamar a nuestros formularios mas adelante.</p>
<p><img src="http://lh5.google.com/blue.star.boy/R9XRoADvUhI/AAAAAAAAAyA/-0H9d_q2IAk/s400/Pantallazo-7.png" /></p>
<p>Para hacer la interfas grafica hay que agregar un Formulario Jframe, damos click en el boton de nuevo archivo y selecionaremos de la categoria, "Formularios GUI Java", el tipo de archivo "Formulari JFrame".</p>
<p><img src="http://lh5.google.com/blue.star.boy/R9XRoADvUiI/AAAAAAAAAyI/exhIg1o4z14/s400/Pantallazo-8.png" /></p>
<p>Con esto obtendremos un formulario, con barras y elementos muy similares a otros lenguages visuales, orientados a eventos.</p>
<p><img src="http://lh6.google.com/blue.star.boy/R9XRoQDvUjI/AAAAAAAAAyQ/WfBFRR5y6mk/s400/Pantallazo-9.png" /></p>
<p>Lo que haremos ahora es, es poner en el formulario los elementos que necesitaremos para nuestra interfas, en este caso seran etiquetas "JLabel", cajas simples de texto "JTextField" y un boton normal "JButton", que encontraremos en la Paleta, en el area SWING.</p>
<p><img src="http://lh4.google.com/blue.star.boy/R9XTJwDvUkI/AAAAAAAAAyY/0IKWcZteZCA/s400/Pantallazo-10.png" /></p>
<p>Para usarlos solo hay que arrastrarlos o selecionarlos y dar click donde queremos ponerlo.</p>
<p><img src="http://lh6.google.com/blue.star.boy/R9XTKQDvUlI/AAAAAAAAAyg/4o2docuMKEs/s400/Pantallazo-11.png" /></p>
<p>Para editar el texto solo hay que selecionar y dar click, haremos lo mismo con los demas hasta obtener algo parecido.</p>
<p><img src="http://lh3.google.com/blue.star.boy/R9XTKgDvUnI/AAAAAAAAAyw/LFPTOgQuXnI/s400/Pantallazo-13.png" /></p>
<p>Para hacer la conexion a MySQL desde netbeans hay que agregar el driver de conexion a la carpeta, jre\lib\ext, estas carpetas se encuentran en el path que nos indico netbeans al instalar, puede haber otras jdk con las mismas carpetas pero solo funcionara si lo pegamos en las que indico netbeans por ser las que el utiliza, de ahi la importancia de saber la ruta de la JDK, que usa netbeans.</p>
<p>Hay otras formas de cargar el driver pero esta, es la unica que me ha funcionado.</p>
<p><img src="http://lh3.google.com/blue.star.boy/R9M3SADvUWI/AAAAAAAAAv0/K_IJrJaeQRU/s400/Pantallazo.png" /></p>
<p>Si no modificaron las rutas de instalacion la ruta completa donde deven guardar el driver seria la siguiente</p>
<div class="igBar"><span id="lcode-123"><a href="#" onclick="javascript:showPlainTxt('code-123'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-123">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/usr/lib/jvm/java-<span style="color:#800000;color:#800000;">6</span>-sun-<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">6</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">03</span>/jre/lib/ext/ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Y el driver a utilizar es <a href="http://www.sdsc.edu/srb/matrix/cvs.cgi/*checkout*/matrix/lib/vdl_lib/Attic/mysql-connector-java-3.0.11-stable-bin.jar?rev=HEAD&amp;content-type=text/plain">mysql-connector-java-3.0.11-stable-bin. jar.</a></p>
<p>Para que sea mas facil, identificar los elementos del formulario le podemos cambiar el nombre, ya que no es muy agradable trabajar con los nombres les asigna por default, en la parte inferior izquierda, se encuentra el inspector, donde se encuentra en forma de arbol los elementos, para cambiar el nombre, selecionamos el elemento que deseamos y presionamos F2 para guardar el cambio hay que presionar ENTER, al selecionar el elemento en el inspector, se seleciona en el forrmulario, y viceversa.</p>
<p><img src="http://lh3.google.com/blue.star.boy/R9Xs7gDvUpI/AAAAAAAAAzA/VcC1Inr1rR4/s400/Pantallazo-15.png" /></p>
<p>La operacion a realizar es un simple insert, la cual se ejecutara al con el boton para esto le agregaremos un evento al boton de tipo "mouseReleased" para hacer esto selecionamos el boton y damos click con el boton derecho, del menu emergente segiremos la siguiente ruta, Eventos&gt;Mouse&gt;mouseReleased.</p>
<p>Nos mostrara el codigo del evento y nos indicara donde debe ir el codigo que queremos que se ejecute al activarse dicho evento.</p>
<p><img src="http://lh3.google.com/blue.star.boy/R9XqZgDvUoI/AAAAAAAAAy4/tO1f723DCts/s400/Pantallazo-14.png" /></p>
<p>Que sera el de la conexion e insercion, y es el siguiente.</p>
<div class="igBar"><span id="lcode-124"><a href="#" onclick="javascript:showPlainTxt('code-124'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-124">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Connection conexion;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Statement sentencia;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">String sql=<span style="color:#CC0000;">"INSERT INTO DATOS VALUES('"</span>+Nombre.<span style="">getText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">"','"</span>+Telefono.<span style="">getText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">"','"</span>+Correo.<span style="">getText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">"','"</span>+Twitter.<span style="">getText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC0000;">"');"</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Class.<span style="">forName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"com.mysql.jdbc.Driver"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">newInstance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">conexion=DriverManager.<span style="">getConnection</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"jdbc:mysql://127.0.0.1:3306/BASEdeDATOS"</span>,<span style="color:#CC0000;">"USUARIO"</span>,<span style="color:#CC0000;">"PASS"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sentencia=conexion.<span style="">createStatement</span><span style="color:#006600; font-weight:bold;">&#40;</span>ResultSet.<span style="">TYPE_SCROLL_INSENSITIVE</span>,ResultSet.<span style="">CONCUR_READ_ONLY</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sentencia.<span style="">execute</span><span style="color:#006600; font-weight:bold;">&#40;</span>sql<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">JOptionPane.<span style="">showMessageDialog</span><span style="color:#006600; font-weight:bold;">&#40;</span>null,<span style="color:#CC0000;">"La informacion se guardo con exito."</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">catch<span style="color:#006600; font-weight:bold;">&#40;</span>Exception e<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">JOptionPane.<span style="">showMessageDialog</span><span style="color:#006600; font-weight:bold;">&#40;</span>null,<span style="color:#CC0000;">"Error en la operacion: "</span>+e<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hay que incluir la siguientes librerias despues de la linea de</p>
<div class="igBar"><span id="lcode-125"><a href="#" onclick="javascript:showPlainTxt('code-125'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-125">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//package agenda;</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">awt</span>.*;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">awt</span>.<span style="">event</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import javax.<span style="">swing</span>.*;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import javax.<span style="">swing</span>.<span style="">event</span>.*;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">import java.<span style="">sql</span>.*; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Tambien hay que declarar las siguientes variables despues del public class</p>
<div class="igBar"><span id="lcode-126"><a href="#" onclick="javascript:showPlainTxt('code-126'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-126">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//public class ALTAS extends javax.swing.JFrame {</span></div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Connection conexion;</div>
</li>
<li style="font-weight: bold;color:#498BFE;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Statement sentencia; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Obviamente hay que sustituir, los valores de la base de datos, el usuario y contrasena, segun corresponda.</p>
<p>En el siguiente post, haremos la consulta, desde la interfas grafica.</p>
<p>Saludos y  espero o haya tenido muchas faltas de orrografia ;D</p>
]]></content:encoded>
			<wfw:commentRss>http://vive-libre.com/blog/2008/03/11/mini-how-to-ubuntu-java-y-mysql-parte-3/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
