Enviado em 19/07/2012 - 17:49h
Vamos lá:# ifconfig eth2:1 192.168.1.1 up
shared-network eth2 {
ddns-update-style none;
ddns-updates off;
log-facility local7;
authoritative;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
allow unknown-clients;
option domain-name-servers 192.168.1.1;
option domain-name "hotspot";
option routers 192.168.1.1;
range 192.168.1.100 192.168.1.200;
}
subnet 192.168.0.0 netmask 255.255.255.0 {
deny unknown-clients;
option domain-name-servers 192.168.0.254;
option domain-name "intranet";
option routers 192.168.0.254;
}
host pc1 {
hardware ethernet 00:00:00:00:00:01;
fixed-address 192.168.0.2;
}
host pc2 {
hardware ethernet 00:00:00:00:00:02;
fixed-address 192.168.0.3;
}
}
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -s 192.168.1.0/24 -d 192.168.0.0/24 -j DROP
iptables -A FORWARD -s 192.168.0.0/24 -d 192.168.1.0/24 -j DROP
iptables -A FORWARD -o eth2 -d 192.168.1.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -o eth2 -d 192.168.0.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth2 -s 192.168.1.0/24 ! -d 192.168.0.0/24 -j ACCEPT
iptables -t nat -A PREROUTING -i eth2 -s 192.168.1.0/24 ! -d 192.168.0.0/24 -j ACCEPT
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE