<?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>Arquivos ip - Remontti</title>
	<atom:link href="https://blog.remontti.com.br/tag/ip/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.remontti.com.br/tag/ip</link>
	<description>rudimar@remontti</description>
	<lastBuildDate>Thu, 15 Jun 2023 17:45:59 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.remontti.com.br/wp-content/uploads/2024/09/icone-rr-80x80.png</url>
	<title>Arquivos ip - Remontti</title>
	<link>https://blog.remontti.com.br/tag/ip</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Guia passo a passo para instalação do phpIPAM, um Software de Gerenciamento de Endereços IP</title>
		<link>https://blog.remontti.com.br/2401</link>
					<comments>https://blog.remontti.com.br/2401#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Mon, 12 Jun 2023 15:40:55 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[administração]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[aplicação]]></category>
		<category><![CDATA[Código Aberto]]></category>
		<category><![CDATA[Configuração]]></category>
		<category><![CDATA[configuração de endereços IPs]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[debain]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[documentação]]></category>
		<category><![CDATA[endereços IPs]]></category>
		<category><![CDATA[ferramenta]]></category>
		<category><![CDATA[gerenciamento]]></category>
		<category><![CDATA[gerenciamento de IP]]></category>
		<category><![CDATA[gerenciamento de rede]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[instalaçao]]></category>
		<category><![CDATA[instalação do phpIPAM]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[IPAM]]></category>
		<category><![CDATA[ipv4]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MariaDB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[php7]]></category>
		<category><![CDATA[phpIPAM]]></category>
		<category><![CDATA[rede]]></category>
		<category><![CDATA[servidor de DHCP]]></category>
		<category><![CDATA[servidor dns]]></category>
		<category><![CDATA[Servidor WEB]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[tutorial banco de dados]]></category>
		<category><![CDATA[tutorial de configuração]]></category>
		<category><![CDATA[tutorial de gerenciamento]]></category>
		<category><![CDATA[tutorial de instalação]]></category>
		<category><![CDATA[tutorial Debian]]></category>
		<category><![CDATA[tutorial MariaDB.]]></category>
		<category><![CDATA[tutorial MySQL]]></category>
		<category><![CDATA[tutorial passo a passo]]></category>
		<category><![CDATA[tutorial phpIPAM]]></category>
		<category><![CDATA[tutorial servidor web]]></category>
		<category><![CDATA[tutorial software de gerenciamento]]></category>
		<guid isPermaLink="false">https://blog.remontti.com.br/?p=2401</guid>

					<description><![CDATA[<p>O phpIPAM é um aplicação de gerenciamento de endereço IPs de código aberto (IPAM). Seu objetivo é fornecer gerenciamento de endereços IP leve, moderno e útil. É uma aplicação baseada em php com backend&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/2401">Guia passo a passo para instalação do phpIPAM, um Software de Gerenciamento de Endereços IP</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><center><img fetchpriority="high" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian.jpg" alt="" width="720" height="340" class="alignnone size-full wp-image-7493" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian.jpg 720w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian-300x142.jpg 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian-520x245.jpg 520w" sizes="(max-width: 720px) 100vw, 720px" /></center></p>
<p>O phpIPAM é um aplicação de gerenciamento de endereço IPs de código aberto (IPAM). Seu objetivo é fornecer gerenciamento de endereços IP leve, moderno e útil. É uma aplicação baseada em php com backend de banco de dados MySQL/MariaDB, usando bibliotecas jQuery, ajax e recursos HTML5 / CSS3.</p>
<p><strong><font color="red">Recomendado Debian 12 Bookworm:</font></strong><br />
1 &#8211; <a href="https://blog.remontti.com.br/7236" rel="noopener noreferrer" target="_blank">Debian 12 Bookworm / Instalação Limpa</a><br />
2.a &#8211; <a href="https://blog.remontti.com.br/7460" rel="noopener" target="_blank">Servidor WEB NGINX + PHP 8.2 + MariaDB + phpMyAdmin</a><br />
2.b &#8211; <a href="https://blog.remontti.com.br/7496" rel="noopener" target="_blank">Servidor WEB Apache2 + PHP 8.2 + MariaDB + phpMyAdmin</a><br />
<font size="2"><b><em>phpMyAdmin é opcional</em></b></font></p>
<p><strong><font color="red">Recomendado Debian 11 Bullseye:</font></strong><br />
1- <a href="https://blog.remontti.com.br/5792" rel="noopener noreferrer" target="_blank">Debian 11 Bullseye / Instalação Limpa</a><br />
2- <a href="https://blog.remontti.com.br/5893" rel="noopener noreferrer" target="_blank">Servidor WEB Apache2 + PHP7.4 + MariaDB + phpMyAdmin</a><br />
<font size="2"><b><em>phpMyAdmin é opcional</em></b></font></p>
<p><strong><font color="red">Recomendado Debian 10 Stretch:</font></strong><br />
1- <a href="https://blog.remontti.com.br/2966" rel="noopener noreferrer" target="_blank">Debian 10 Stretch / Instalação Limpa</a><br />
2.a &#8211; <a href="https://blog.remontti.com.br/3006" rel="noopener noreferrer" target="_blank">Servidor WEB Apache2 + PHP7.3 + MariaDB + phpMyAdmin</a><br />
2.b &#8211; <a href="https://blog.remontti.com.br/5465" rel="noopener" target="_blank">Servidor WEB NGINX + PHP7.3 + MariaDB + phpMyAdmin</a><br />
<font size="2"><b><em>phpMyAdmin é opcional</em></b></font></p>
<p><strong><font color="red">Recomendado Debian 9 Buster:</font></strong><br />
<a href="https://blog.remontti.com.br/1152" rel="noopener noreferrer" target="_blank">Instalação Limpa Debian 9 Buster</a><br />
<a href="https://blog.remontti.com.br/2024" rel="noopener noreferrer" target="_blank">Servidor web Apache2, PHP 7.0, MariaDB, PHPMyAdmin</a><br />
<font size="2"><b><em>phpMyAdmin é opcional</em></b></font></p>
<p>Após instalação do servidor WEB+MariaDB, vamos criar nossa base de dados para o phpipam</p>
<pre class="remontti-code"># mariadb -p</pre>
<pre class="remontti-code">
CREATE DATABASE phpipam;
GRANT ALL PRIVILEGES ON phpipam.* TO &#039;phpipam&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;SUA_SENHA&#039;;
FLUSH PRIVILEGES;
quit;</pre>
<p>Download phpIPAM<br />
Instalação estável: (Nesta data é 1.5.2) <a href="https://github.com/phpipam/phpipam/releases" rel="noopener noreferrer" target="_blank">https://github.com/phpipam/phpipam/releases</a> </p>
<pre class="remontti-code"># cd /tmp
# wget https://github.com/phpipam/phpipam/releases/download/v1.5.2/phpipam-v1.5.2.tgz
# tar vxf phpipam-v1.5.2.tgz
# mv phpipam /var/www/html/phpipam
&lt;pre&gt;# cd /var/www/html/phpipam</pre>
<p>Agora precisamos inserir os dados para o phpipam conectar ao banco de dados. Primeiro copie config.dist.php para config.php e insira os detalhes necessários.</p>
<pre class="remontti-code"># cp config.dist.php config.php
# vim config.php</pre>
<p>Encontre a linha <em>$db['pass'] = 'phpipamadmin';</em> e altere para sua senha, caso tenha utilizado outro usuário e nome de base altere também.</p>
<pre class="remontti-code">
...
$db[&#039;host&#039;] = &quot;localhost&quot;;
$db[&#039;user&#039;] = &quot;phpipam&quot;;
$db[&#039;pass&#039;] = &quot;SUA_SENHA&quot;;
$db[&#039;name&#039;] = &quot;phpipam&quot;;
...</pre>
<p>Se estas utilizando debian 12, sua versão do php é a 8.2 que na versão atual 1.5.2 ainda parece não ter sido testado, para resolver entre no diretório do phpipam e adicione <strong>$allow_untested_php_versions=true;</strong> ao final do arquivo:</p>
<pre class="remontti-code"># cd /var/www/html/phpipam
# echo &#039;$allow_untested_php_versions=true;&#039; &gt;&gt; config.php</pre>
<p>Além disso, nós extraímos o diretório do phpipam fora pasta raiz (/var/www/html), será necessário definir isso (<em>define('BASE', "/");</em>) em config.php, se você colocou no diretório raiz ou configurou um <a href="https://blog.remontti.com.br/3464" rel="noopener noreferrer" target="_blank">domínio virtual (recomendo)</a> para o phpipam não é necessário :</p>
<pre class="remontti-code"># vim config.php</pre>
<p>Altere :</p>
<pre class="remontti-code-plain">define(&#039;BASE&#039;, &quot;/&quot;);</pre>
<p>para:</p>
<pre class="remontti-code-plain">define(&#039;BASE&#039;, &quot;/phpipam/&quot;);</pre>
<p>Instale a extensão gmp do php que é necessária para o funcionamento do phpipam e restarte o apache ou nginx de acordo com seu servidor.</p>
<pre class="remontti-code"># apt install php-gmp -y
# systemctl restart apache2
ou
# systemctl restart nginx</pre>
<p>Agora acesse seu servidor em seu navegado: http://ip-server.ou.dominio/phpipam/</p>
<p>Clique em <strong>[New phpipam installation]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_1.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_1.png" alt="" width="1280" height="709" class="alignnone size-full wp-image-7482" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_1.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_1-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_1-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_1-768x425.png 768w" sizes="(max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Clique em <strong>[Automatic database installation]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_2.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_2.png" alt="" width="1280" height="832" class="alignnone size-full wp-image-7483" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_2.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_2-300x195.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_2-1024x666.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_2-768x499.png 768w" sizes="(max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Entre com seu usuario: phpipam e senha senha de conexão do banco de dados (SUA_SENHA), clique em [Show advanced options], e <strong>DESMARQUE</strong> as opções: <strong>Create new database</strong> e <strong>Set permissions to tables</strong> e após em <strong>[Install phpipam database]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_3.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_3.png" alt="" width="1280" height="878" class="alignnone size-full wp-image-7484" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_3.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_3-300x206.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_3-1024x702.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_3-768x527.png 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Uma mensagem "<strong>Database installed successfully!</strong>" será exibida, informado que o banco de dados foi criado com sucesso. Clique em <strong>[Continue]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_4.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_4.png" alt="" width="1280" height="940" class="alignnone size-full wp-image-7485" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_4.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_4-300x220.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_4-1024x752.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_4-768x564.png 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></a>  </p>
<p>Defina a senha do usuário admin, e clique em <strong>[Save settings]</strong><br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_5.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_5.png" alt="" width="1280" height="709" class="alignnone size-full wp-image-7486" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_5.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_5-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_5-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_5-768x425.png 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Uma mensagem <strong>"Settings updated, installation complete!"</strong> informado que a instalação foi completada! Clique em [<strong>Procced to login</strong>]<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_6.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_6.png" alt="" width="1280" height="798" class="alignnone size-full wp-image-7487" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_6.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_6-300x187.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_6-1024x638.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_6-768x479.png 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Entre com o usuário admin e sua senha:<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_7.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_7.png" alt="" width="1280" height="709" class="alignnone size-full wp-image-7488" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_7.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_7-300x166.png 300w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_7-1024x567.png 1024w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_7-768x425.png 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Prontinho para seu uso!<br />
<a href="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_8.png" data-rel="lightbox-gallery-O5lkflLy" data-rl_title="" data-rl_caption="" title=""><img loading="lazy" decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_8.png" alt="" width="1280" height="1387" class="alignnone size-full wp-image-7489" srcset="https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_8.png 1280w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_8-277x300.png 277w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_8-945x1024.png 945w, https://blog.remontti.com.br/wp-content/uploads/2018/05/phpipam_debian_12_8-768x832.png 768w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></a></p>
<p>Gostou?</p>
<p><strong>Se quiser fazer uma doação para o café ficarei muito feliz pelo seu reconhecimento!</strong></p>
<p><a href="https://blog.remontti.com.br/doar"><img decoding="async" src="https://blog.remontti.com.br/wp-content/uploads/2019/07/quero-doar-remontti.png" /></a></p>
<p>Se não puder doar pode deixar seu agradecimento nos comentário também ficarei feliz em saber que ajudei. Se tiver qualquer pergunta deixe-a também. Se preferir entrar em Contato <a href="https://blog.remontti.com.br/meucontato" rel="noopener noreferrer" target="_blank">clique aqui.</a></p>
<p>Abraço!</p>
<p>O post <a href="https://blog.remontti.com.br/2401">Guia passo a passo para instalação do phpIPAM, um Software de Gerenciamento de Endereços IP</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/2401/feed</wfw:commentRss>
			<slash:comments>40</slash:comments>
		
		
			</item>
		<item>
		<title>Balanceamento de Carga</title>
		<link>https://blog.remontti.com.br/328</link>
					<comments>https://blog.remontti.com.br/328#comments</comments>
		
		<dc:creator><![CDATA[Rudimar Remontti]]></dc:creator>
		<pubDate>Tue, 09 Jun 2009 18:04:28 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Tutoriais]]></category>
		<category><![CDATA[balance]]></category>
		<category><![CDATA[balanceamento]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[flush]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[rotas]]></category>
		<category><![CDATA[route]]></category>
		<category><![CDATA[uplink]]></category>
		<guid isPermaLink="false">http://www.remontti.com.br/blog/?p=328</guid>

					<description><![CDATA[<p>Este tuto foi feito em cima da distribuição Debian 5, com dois links de mesma velocidade. Neste exemplo teremos 3 interface [eth0 192.168.1.100 e eth1 192.168.2.100 as duas internet] [eth2 192.168.3.1 rede local] Primeiramente&#46;&#46;&#46;</p>
<p>O post <a href="https://blog.remontti.com.br/328">Balanceamento de Carga</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Este tuto foi feito em cima da distribuição Debian 5, com dois links de mesma velocidade.<br />
Neste exemplo teremos 3 interface [eth0 192.168.1.100 e eth1 192.168.2.100 as duas internet] [eth2 192.168.3.1 rede local]</p>
<p>Primeiramente instalamos o pacote iproute 2<br />
<span style="color: #ff6600;"># aptitude update<br />
# aptitude install iproute</span></p>
<p>Após configure as tabelas:</p>
<p><span style="color: #ff6600;"># vim /etc/iproute2/rt_tables</span><br />
Adicione essas duas linhas no final do arquivo:</p>
<p><span style="color: #008080;">200 uplink1<br />
201 uplink2</span></p>
<p><span style="color: #008080;"><span id="more-328"></span></span>Vamos configurar nossa interface onde em eth0 192.168.1.1 / eth1 192.168.2.1 são os gateways<br />
<span style="color: #ff6600;"># vim /etc/network/interfaces</span></p>
<pre class="remontti-code"># LOCALHOST
auto lo
iface lo inet loopback

# LINK 1

auto eth0
iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0

        post-up ip route add 192.168.1.1/32 dev eth1 src 192.168.1.100 table uplink1
        post-up ip route add default via 192.168.1.1 table uplink1
        post-up ip rule add from 192.168.1.100 table uplink1
        post-down ip rule del from 192.168.1.100 table uplink1

# LINK 2

auto eth1
iface eth1 inet static
        address 192.168.2.100
        netmask 255.255.255.0

        post-up ip route add 192.168.2.1/32 dev eth1 src 192.168.2.210 table uplink2
        post-up ip route add default via 192.168.2.1 table uplink2
        post-up ip rule add from 192.168.2.210 table uplink2
        post-down ip rule del from 192.168.2.210 table uplink2

# REDE CLIENTE
auto eth2
iface eth2 inet static
        address 192.168.3.1
        netmask 255.255.255.0</pre>
<p>Reinicie o serviço:<br />
<span style="color: #ff6600;"># /etc/init.d/networking  restart</span></p>
<p>Agora vamos criar um firewall, criaremos as rotas.</p>
<pre class="remontti-code">#! /bin/sh

# Ativa forward
echo &quot;1&quot; &gt; /proc/sys/net/ipv4/ip_forward

# Limpa regras
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -t nat -F
/sbin/iptables -X -t nat
/sbin/iptables -F -t mangle
/sbin/iptables -X -t mangle

# Carrega modulos
/sbin/modprobe iptable_nat
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_REJECT
/sbin/modprobe ipt_MASQUERADE

#Libera navegacao nas interfaces
/sbin/iptables -t nat -A POSTROUTING -s 192.168.30/24 -o eth0 -j MASQUERADE
/sbin/iptables -t nat -A POSTROUTING -s 192.168.30/24 -o eth1 -j MASQUERADE

# Configurações Proxy
# /sbin/iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j REDIRECT --to-port 3128
# /sbin/iptables -A PREROUTING -t mangle -s 192.168.3.0/24 -d 0/0 -j MARK --set-mark 3
# /sbin/iptables -t mangle -A OUTPUT -p TCP -d ! 192.168.3.0/24 --dport 80 -m owner --uid-owner 23 -j MARK --set-mark 3

# Faz com que o servico dns faca consultas pelo outro link
/sbin/iptables -t mangle -A OUTPUT -p UDP --dport 53 -m owner --uid-owner 25 -j MARK --set-mark 2

# Deleta rotas
route del default

# Load balance
ip route add default scope global nexthop via 192.168.1.1 dev eth0 weight 1 nexthop via 192.168.2.1 dev eth1 weight 1

# Limpa cache
ip route flush cached</pre>
<p>Use o comando &#8220;ip route show table main&#8221; para ver como ficou&#8230;<br />
<span style="color: #ff6600;"> # ip route show table main</span></p>
<p><span style="color: #999999;">192.168.1.1/24 dev eth0  proto kernel  scope link  src 192.168.1.100<br />
<em>192.168.2.1/24 dev eth1  proto kernel  scope link  src 192.168.2.100<br />
192.168.3.1/24 dev eth2  proto kernel  scope link  src 192.168.3.1<br />
default<br />
nexthop via 192.168.1.100  dev eth0 weight 1<br />
nexthop via 192.168.2.100  dev eth1 weight 1</em></span></p>
<p>Adicione no cron o comando para limpar o cache dos dns a cada 10 min<br />
<span style="color: #ff6600;"> # vim /etc/crontab</span><br />
00-59/10   *   * * *   root   ip route flush cached</p>
<p>Aqui fiz o siguinte script para verificar se algum dos link cai, assim refazendo a rota e deixadondo para o que estiver online.</p>
<p><span style="color: #ff6600;"># vim /root/uplink.sh</span></p>
<pre class="remontti-code">#! /bin/sh
# - - - - - - - - - - - - - - - #
# Script por Rudimar Remontti   #
# www.remontti.com.br           #
# - - - - - - - - - - - - - - - #
echo -e &#039;\e[33;1mVerificando Links: \e[m&#039;

# - - - - - - - - - - - #
# Configuracoes         #
# - - - - - - - - - - - #
GTW_1=192.168.1.1
ITF_1=eth0
GTW_2=192.168.2.1
ITF_2=eth1
RT_BRT_1=200.176.3.142 # Ip do terra.com.br ele ira pingar p/ verificar se responde
RT_BRT_2=200.176.3.142 # Ip do terra.com.br...
# - - - - - - - - - - - #

echo
echo -e &quot;\e[30;1mLink 1: $GTW_1\e[m&quot;
echo -e &quot;\e[30;1mLink 2: $GTW_2\e[m&quot;
echo 

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
PING_1=`ping $RT_BRT_1 -I $ITF_1 -c 1 |grep packets |cut -c 24`
PING_2=`ping $RT_BRT_2 -I $ITF_2 -c 1 |grep packets |cut -c 24`
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

UP=`echo &quot;($PING_1 + $PING_2)&quot; | bc`
if [ $UP = 2 ]; then 

        route del default
        ip route add default scope global nexthop via $GTW_1 dev $ITF_1 weight 1 nexthop via $GTW_2 dev $ITF_2 weight 1
        ip route flush cached

        echo -n &#039;Link 1 e Link 2  Status:     &#039;
        echo -e &#039;\e[32;1m[ ON ] \e[m&#039;
        echo

elif [ $UP = 0 ]; then

        route del default
        ip route add default scope global nexthop via $GTW_1 dev $ITF_1 weight 1 nexthop via $GTW_2 dev $ITF_2 weight 1
        ip route flush cached

        echo
        echo -n Link 1:
        echo -e &#039;\e[32;1m  [  OKAY  ] \e[m&#039;
        echo -n Link 2:
        echo -e &#039;\e[32;1m  [  OKAY  ] \e[m&#039;
        echo

elif [ $UP = 1 ]; then
        echo
        if [ $PING_1 = 1 ]; then
                echo -n Link 1:
                echo -e &#039;\e[32;1m  [  OKAY  ] \e[m&#039;
        else
                route del default
                ip route add default scope global nexthop via $GTW_2 dev $ITF_2 weight 1
                ip route flush cached
                data=`date`
                echo &quot;$data -&gt; Link 1 OFF&quot; &gt;&gt; /root/links.log
                echo -n Link 1:
                echo -e &#039;\e[31;1m  [  OFF   ] \e[m&#039;
        fi
        if [ $PING_2 = 1 ]; then
                echo -n Link 2:
                echo -e &#039;\e[32;1m  [  OKAY  ] \e[m&#039;
        else
                route del default
                ip route add default scope global nexthop via $GTW_1 dev $ITF_1 weight 1
                ip route flush cached
                data=`date`
                echo &quot;$data -&gt; Link 2 OFF&quot; &gt;&gt; /root/links.log
                echo -n Link 2:
                echo -e &#039;\e[31;1m  [  OFF   ] \e[m&#039;

        fi
        echo
        if [ $PING_1 = 0 ]; then
                echo -e &#039;\e[30;1mRotas reconfigurada, gatway através do Link 2.\e[m&#039;
                ROTE=`ip route show |grep default |cut -c 9-100`
                echo -e &quot;\e[30;1m$ROTE\e[m&quot;

        elif [ $PING_2 = 0 ]; then
                echo -e &#039;\e[30;1mRotas reconfigurada, gatway através do Link 1.\e[m&#039;
                ROTE=`ip route show |grep default |cut -c 9-100`
                echo -e &quot;\e[30;1m$ROTE\e[m&quot;
        fi
else
        echo ERRO!
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
echo
ip route show |grep nexthop
echo</pre>
<p><span style="color: #ff6600;"># chmod 755 /root/uplink.sh</span></p>
<p>Adicionamos ao cron (5min)<br />
<span style="color: #ff6600;"> # vim /etc/crontab</span><br />
<span style="color: #008080;"> 00-59/5   *   * * *   root   /root/uplink.sh</span></p>
<p>Carregue seu firewall na inicialização do sistema, utilize o iptraf para ver o trafego saindo pelas duas interfaces.<br />
Se vc tem dois link com cargas diferente altere o weight.</p>
<p>Abraço</p>
<p>O post <a href="https://blog.remontti.com.br/328">Balanceamento de Carga</a> apareceu primeiro em <a href="https://blog.remontti.com.br">Remontti</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.remontti.com.br/328/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
