COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

1. COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

Cleber
cleberad

(usa Debian)

Enviado em 15/07/2010 - 18:16h

Olá,

estou começando no Linux, gostaria de montar um servidor de internet com dhcp, tenho um servidor com o Debian 5 e duas placas de rede, eth0 entra internet (net ip dinamico), eth1 seria pra rede, pra acessar a internet não precisei configurar nada no servidor, pois o sinal é direto, colocou o cabo já esta com internet, na rede gostaria de colocar ips 192.168.1.x, sem ip fixo, via dhcp, até li alguns artigos na internet, mas confesso fiquei perdido, já tentei um monte de configurações mas não deu em nada.

Obrigado


  


2. Re: COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

mazin
mazinsw

(usa Ubuntu)

Enviado em 15/07/2010 - 22:01h

amigo você deu sorte, montei um servidor a pouco de internet, só aqui em casa mesmo.
vou te mandar os passos, não mandarei as configurações porque você escolhe, e tem muito nos foruns e praticamente todos funcionais.

1. após estar conectado à internet, configure o ip da placa de rede em que vai conectar os outros pcs, de preferência 192.168.0.1 com o final "1" regra seguida indicando que é um servidor.

2. instale o dhcp-server, configure-o para escutar apenas a eth1 e reinicie o serviço.

3. conecte um computador e verifique se foi atribuido o ip para ele, se sim avançe, caso contrário existe um erro na sua configuração.

4. agora crie um script para configurar o iptables lembrando que você irá indicar a interface de rede que contem internet no seu caso eth0, abilite o ipv4 mudando para 1, e carregue os módulos do iptables antes de qualquer movimentação do iptables (uma vez por ligamento do computador).

5. se seguiu corretamente os passos, voçê conseguirá acessar qualquer site usando o ip e o mac da rede que tem acesso a internet, boa sorte!.


3. Re: COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

Cleber
cleberad

(usa Debian)

Enviado em 16/07/2010 - 18:37h

1. após estar conectado à internet, configure o ip da placa de rede em que vai conectar os outros pcs, de preferência 192.168.0.1 com o final "1" regra seguida indicando que é um servidor.

ok, configurei a placa

2. instale o dhcp-server, configure-o para escutar apenas a eth1 e reinicie o serviço.

ok, instalei o dhcp-server (dhcp), mas como configuro ????




4. Re: COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

Luis Eduardo Vilella
luivilella

(usa Debian)

Enviado em 17/07/2010 - 19:57h

# Subnet Lui
####### aqui em baixo coloque a sua rede e a mascara
subnet 192.168.1.0 netmask 255.255.255.0 {

##### aqui em baixo a range ou seja o ip que comeca a destribuir e o que termina
range 192.168.1.100 192.168.1.253;

# aqui o gateway da sua rede
option routers 192.168.1.254; #gateway

# o DNS aqui
option domain-name-servers 208.67.222.222; #OpenDNS
option domain-name-servers 208.67.220.220; #OpenDNS
#### dominio
option domain-name "vilella";
}



Amigo e em /etc/dhcp3/dhcpd.conf



5. Re: COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

Cleber
cleberad

(usa Debian)

Enviado em 19/07/2010 - 15:36h

não deu, fui lendo mais dicas e ficou assim meus arquivos ...

DHCPD.CONF
#
# Sample configuration file for ISC dhcpd for Debian
#
# $Id: dhcpd.conf,v 1.4.2.2 2002/07/10 03:50:33 peloy Exp $
#

# option definitions common to all supported networks...
option domain-name "fugue.com";
option domain-name-servers toccata.fugue.com;

option subnet-mask 255.255.255.0;
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.0.21 netmask 255.255.255.0 {
range 192.168.0.22 192.168.0.100;
option routers 192.168.0.21
option domain-name-servers 200.204.0.10,200.204.0.138
option broadcast-address 192.168.0.255;
# option routers prelude.fugue.com;
#}

# The other subnet that shares this physical network
#subnet 204.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 204.254.239.10 204.254.239.20;
# option broadcast-address 204.254.239.31;
# option routers snarg.fugue.com;
#}

#subnet 192.5.5.0 netmask 255.255.255.224 {
# range 192.5.5.26 192.5.5.30;
# option name-servers bb.home.vix.com, gw.home.vix.com;
# option domain-name "vix.com";
# option routers 192.5.5.1;
# option subnet-mask 255.255.255.224;
# option broadcast-address 192.5.5.31;
# default-lease-time 600;
# max-lease-time 7200;
#}

# Hosts which require special configuration options can be listed in
# host statements. If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host passacaglia {
# hardware ethernet 0:0:c0:5d:bd:95;
# filename "vmunix.passacaglia";
# server-name "toccata.fugue.com";
#}

# Fixed IP addresses can also be specified for hosts. These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP. Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
# hardware ethernet 08:00:07:26:c0:a5;
# fixed-address fantasia.fugue.com;
#}

# If a DHCP or BOOTP client is mobile and might be connected to a variety
# of networks, more than one fixed address for that host can be specified.
# Hosts can have fixed addresses on some networks, but receive dynamically
# allocated address on other subnets; in order to support this, a host
# declaration for that client must be given which does not have a fixed
# address. If a client should get different parameters depending on
# what subnet it boots on, host declarations for each such network should
# be given. Finally, if a domain name is given for a host's fixed address
# and that domain name evaluates to more than one address, the address
# corresponding to the network to which the client is attached, if any,
# will be assigned.
#host confusia {
# hardware ethernet 02:03:04:05:06:07;
# fixed-address confusia-1.fugue.com, confusia-2.fugue.com;
# filename "vmunix.confusia";
# server-name "toccata.fugue.com";
#}

#host confusia {
# hardware ethernet 02:03:04:05:06:07;
# fixed-address confusia-3.fugue.com;
# filename "vmunix.confusia";
# server-name "snarg.fugue.com";
#}

#host confusia {
# hardware ethernet 02:03:04:05:06:07;
# filename "vmunix.confusia";
# server-name "bb.home.vix.com";
#}

NO RC.LOCAL deixei assim ...
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d 0/0 -j MASQUERADE
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

exit 0

INTERFACES ESTA ASSIM ...
# 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
address 127.0.0.1
netmask 255.0.0.0

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
gateway 192.168.0.10

auto eth0

iface eth1 inet static
address 192.168.0.21
netmask 255.255.255.0

auto eth1

as máquinas clientes não pegam o ip ...



6. Re: COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

Cleber
cleberad

(usa Debian)

Enviado em 19/07/2010 - 17:20h

fiz mais essa configuração ...

# vim /etc/default/dhcp3-server

Onde tiver INTERFACES="", coloque sua placa de rede (no meu caso, utilizei a eth1):


INTERFACES="eth1"

as máquinas cliente pegam a rede por alguns minutos mais cai logo em seguida, mas só rede, sem internet ...

estou testando em uma máquina Windows, não seria esse o problema né ?????


7. Re: COMPARTILHAMENTO NET COM DHCP NO DEBIAN [RESOLVIDO]

Luis Eduardo Vilella
luivilella

(usa Debian)

Enviado em 20/07/2010 - 11:08h

Seguinte, copia de segurança.

cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.bkp
rm /etc/dhcp3/dhcpd.conf
vi /etc/dhcp3/dhcpd.conf

Cara eu também uso Debian e meu conf esta em /etc/dhcp3/dhcpd.conf


No novo arquivo coloque exatamente como eu passei acima.
E poste aqui ifconfig



8. use esta configuração

mazin
mazinsw

(usa Ubuntu)

Enviado em 25/07/2010 - 00:06h

falta algumas configurações no teu interfaces
e muda para outro prefixo ex: 192.168 para 176.16
em todas as configurações do dhcp
#########################################
ddns-update-style interim;
option domain-name-servers 192.168.0.1;
default-lease-time 6000;
max-lease-time 72000;
authoritative;
log-facility local7;

subnet 192.168.0.0 netmask 255.255.0.0 {
range 192.168.0.1 192.168.0.255;
option routers 192.168.0.1;
option domain-name "cleber.com.br";
option subnet-mask 255.255.0.0;
option broadcast-address 192.168.0.255;
one-lease-per-client on;
option netbios-name-servers 192.168.0.1;
}
############################################
para /etc/dhcp3/dhcpd.conf
dê um restart no serviço
esta configuração está funcionando no meu com certeza funcionará no seu.
obs: se você alterou outros arquivos do dhcp-server você terá que reinstalar
para acessar a internet basta fazer.
############################
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#########################
(QUALQUER SISTEMA OPERACIONAL reconhece o dhcp)


9. Speed + Net 10 megas para reduncância

Bruno Luiz Troni
brunoproweb

(usa Debian)

Enviado em 07/07/2011 - 10:23h

Galera, bom dia!

Seguinte, tenho uma rede configurada que roda perfeitamente. Porém agora estou colocando a internet da NET para ficar redundante, porém gostaria de saber como vou fazer isso no arquivo dhpcd.conf

Abraço!



  



Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts