
		jg.braga
		
		(usa Debian)
		
		Enviado em 14/06/2011 - 11:03h 
		NET VIRTUA NÃO COMPARTILHA?
	Bom dia amigos., sou iniciante estou tentando realizar essa proeza há muito tempo., já vasculhei toda a net., testei vários artigos, porém nada funciona., 
	 Gostaria de saber como compartilhar  a conexão netvirtua, tenho o seguinte cenário:
Modem net: Motorola
Roteador : D-LINK DL-524
03 maquinas em rede sendo:
  01 PC debian Squeeze 6.0 - sevidor
	Hardware: P3 – 800Mhz / 512 MB / Hd 80GB   
  01 PC debian Squeeze – meu PC
	Hardware: P4 – 2.8 Ghz / 1Gb / Hd 160GB
 01 PC Windows xp – PC minha irmã
 	Hardware: Celeron 2.2 Ghz / 2Gb / HD 160Gb.
PLANO. 
	Compartilhar internet utilizando o Servidor acima., futuramente instalar e testar Squid e Samba.
Arquivos alterados e testados;
INTERFACES
/etc/net	work/interface
-------------						--------------------
# This file describes the network interfaces available on your system 
# and how to activate them. For more information, see interfaces(5). 
# The loopback network interface 
#auto lo 
#iface lo inet loopback 
# The primary network interface 
#allow-hotplug eth0 
#iface eth0 inet dhcp 
iface lo inet loopback 
# Interface reflexiva 
iface eth0 inet dhcp 
# Dizer à placa conectada à Internet para obter um IP do modem 
iface lo inet loopback 
# Interface reflexiva 
iface eth0 inet dhcp 
# Dizer à placa conectada à Internet para obter um IP do modem 
iface eth1 inet static 
# Fixar o IP da placa ligada ao hub 
 address 192.168.0.2 
# Os endereços 192.168.0.* são os mais comumente utilizados 
 netmask 255.255.255.0 
auto lo eth0 eth1 
# Todas essas interfaces devem ser conectadas automaticamente ao iniciar o sis$ 
----------------								-------------------
ARUIVO  FIREWALL  (este arquivo foi criado e configurado com permissão de execução) 
/etc/network/if-uo.d/firewall
---------						---------------------------------------------
#!/bin/sh
# Definindo variáveis
Internet=eth0           # Interface conectada à Internet.
LocalNetwork=eth1       # Interface conectada à rede local.
Loopback=lo             # Interface reflexiva (127.0.0.1)
 
# Onde procurar o comando iptables.
PATH=/usr/sbin:/sbin:/bin:/usr/bin
 
# Apaga todas as regras existentes.
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
 
iptables -A INPUT -i $Loopback -j ACCEPT                                      $
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT              $
iptables -A INPUT -m state --state NEW -i ! $Internet -j ACCEPT               $
iptables -A FORWARD -i $Internet -o $LocalNetwork -m state --state ESTABLISHED$
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
 
iptables -A INPUT -i $Loopback -j ACCEPT                                      $
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT              $
iptables -A INPUT -m state --state NEW -i ! $Internet -j ACCEPT               $
iptables -A FORWARD -i $Internet -o $LocalNetwork -m state --state ESTABLISHED$
iptables -A FORWARD -i $LocalNetwork -o $Internet -j ACCEPT                   $
iptables -A FORWARD -i $Internet -o $Internet -j REJECT                       $
iptables -t nat -A POSTROUTING -o $Internet -j MASQUERADE                     $
 
echo 1 > /proc/sys/net/ipv4/ip_forward                                     $
------------------						------------------------------
DHCPD.CONF 
/etc/dhcp/dhcp.conf
-------------------						-------------------------------------
#
# Sample configuration file for ISC dhcpd for Debian
#
#
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "virtua.com.br";
option domain-name-servers 200.212.223.43, 200.212.223.044;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# option definitions common to all supported networks...
option domain-name "virtua.com.br";
option domain-name-servers 200.212.223.43, 200.212.223.044;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
#log-facility local7;
##SubNet home.lan
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.4 192.168.0.10;
option routers 192.168.0.2;
option broadcast-address 192.168.0.255;
}
###########################################################################
#option domain-name-servers 200.212.223.43;
# Substitua $DNSDaRede pelo DNS de sua rede
#ddns-update-style ad-hoc;
# Estilo de atualização de DNS automático
#default-lease-time 600;
# Tempo de expiração mínima do IP fornecido
#max-lease-time 7200;
# Tempo de expiração máxima do IP fornecido
#log-facility local7;
# Modo como o servidor registra suas atividades
#-- Ajustando a rede à qual se aplica o servidor
#--subnet 192.168.0.0 netmask 255.255.255.0 {
# --range 192.168.0.2 192.168.0.10;
 --Faixa de IPs que devem ser distribuídos
# --option routers 192.168.0.1;
# --Endereço do router
# --option broadcast-address 192.168.0.255;
# Endereço de broadcast
# option domain-name-servers 200.212.223.044;
# Substitua $DNSDaRede pelo DNS de sua rede
--------------------								--------------------------
O que deu certo?
	DHCP funciona, porém o servidor não consegue compartilhar a internet.
	Consigo pingar sem nenhum problema.
	A internet funciona no servidor normalmente.
Endereço do artigo :
http://vinicius.soylocoporti.org.br/compartilhar-net-virtua-usando-um-computador-linux/
 	Agora vamos lá:
		 Já procurei e testei diversos artigos que não funcionaram, gostaria de saber se realmente é possível compartilhar a net com o netvirtua.	
		A internet só é compartilhada pelo roteador D-LINK., funciona legal, mas a ideia é compartilhar a net utilizando DEBIAN SQUEEZE.,
  Se alguém puder ajuda eu agradeço.,  deixem artigos ou dicas para que eu possa testar. 
Valeu..,  agradeço desde já., e assim que funcionar irei postar todas as alterações realizadas e o que realmente funciona.
Obrigado e até a próxima.