saitam
(usa Slackware)
Enviado em 31/12/2012 - 16:05h
Vicktorzx escreveu:
Boa Tarde, refiz novamente todo o Servidor do zero com estas configurações, sendo que o Servidor foi o Ubuntu Server e o Cliente o Windows 7
No Servidor
1° NAT (eth0)
2° Rede Interna (eth1)
No Cliente
1° Rede Interna
REDE (nat/rede interna)
1° vim /etc/network/interfaces
# This file describes the network interfaces available on you system
# and how to active them. For more information, see interfaces (5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet dhcp
# The secondary network interface
auto eth1
iface eth1 inet static
address 192.168.100.1
netmask 255.255.255.0
2° vim /etc/resolv.conf
search servidor.com.br
domain servidor.com.br
nameserver 192.168.100.1 # DNS do Servidor da Rede
3° chattr +i /etc/resolv.conf
DHCP (isc-dhcp-server)
1° apt-get install isc-dhcp-server
2° vim /etc/dhcp/dhcpd.conf
# option definitions common to all supported networks...
option domain-name "servidor.com.br";
option domain-name-servers 192.168.100.1;
default-lease-time 3600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
autoritative;
# 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;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
#subnet 10.152.187.0 nestmask 255.255.255.0 {
#}
# This is a very basic subnet declaration.
Subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.10 192.168.100.20;
option routers 192.168.100.1;
}
# This declaration allows BOOTP clientes to get dynamic addresses,
# whiche we don't really recommend.
#subnet 10.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 10.254.239.40 10.254.239.60;
# option broadcast-address 10.254.239.31;
# option routers rtr-239-32-1.example.org;
#}
# A slightly diferent configuration for an internal subnet
# subnet 192.168.0.1 netmask 255.255.255.0 {
# range 192.168.0.30 192.168.0.50;
# option domain-name-servers ns1.internal.example.org;
# option domain-name "internal.example.org;
# option routers 192.168.0.10;
# option broadcast-address 192.168.0.255;
# default-lease-time 600;
# max-lease-time 7200;
#}
INTERNET
1° cd /etc/
2° vim internet.sh
3° #!/bin/bash
# Roteamento de pacotes
echo 1 > /proc/sys/net/ipv4/ip_forward
# Compartilhamento de conexão
iptables -t nat -A POSTROUTING -s 192.168.100.1/255.255.255.0 -o eth0 -j MASQUERADE
4° chmod +x internet.sh
5º ./internet.sh
Mas não saiu do triangulo amarelo do Windows abençoado :(
Calma, esta quase lá...
troque 192.168.100.1 por 192.168.100.0 que corresponde sua rede
Resumindo conforme abaixo
iptables -t nat -A POSTROUTING -s 192.168.100.0/255.255.255.0 -o eth0 -j MASQUERADE
192.168.100.0/255.255.255.0 é igual 192.168.100.0/24
/24 corresponde os 24bits de 1's
11111111.11111111.11111111.00000000
255.255.255.0
sobrou 8bits, então 2^8-2=254 hosts disponíveis que pode usar na rede com essa máscara.
Com o serviço dhcp startado e script que compartilha conexão executado com a correção descrita deve funcionar agora.