Problemas cliente DHCP [RESOLVIDO]

1. Problemas cliente DHCP [RESOLVIDO]

Helder da Silva Falcão
helderfalcao

(usa Ubuntu)

Enviado em 19/01/2012 - 11:45h

Bom dia, gostaria da ajuda de vcs com relação à este problema:
Meu servidor dhcp está distribuindo ip normalmente, mas os clientes não estão conseguindo pingar nada da rede externa(WAN), mas, curiosamente, pelo browser eles estão conseguindo acesar agora.
Acredito que seja problema com o iptables...
Se alguém tiver alguma idéia do que seja desde ja agradeço a ajuda.
!

Obs. Arquivos de configuração.

###Firewall
#!/bin/sh
#
# rc.firewall-2.4-stronger
#
FWVER=0.80s



echo -e "\nLoading STRONGER rc.firewall - version $FWVER..\n"


# The location of various iptables and other shell programs
#
# If your Linux distribution came with a copy of iptables, most
# likely it is located in /sbin. If you manually compiled
# iptables, the default location is in /usr/local/sbin
#
# ** Please use the "whereis iptables" command to figure out
# ** where your copy is and change the path below to reflect
# ** your setup
#
#IPTABLES=/sbin/iptables
IPTABLES=/sbin/iptables
#
LSMOD=/sbin/lsmod
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
GREP=/bin/grep
AWK=/usr/bin/awk
SED=/bin/sed
IFCONFIG=/sbin/ifconfig


#Setting the EXTERNAL and INTERNAL interfaces for the network
#
# Each IP Masquerade network needs to have at least one
# external and one internal network. The external network
# is where the natting will occur and the internal network
# should preferably be addressed with a RFC1918 private address
# scheme.
#
# For this example, "eth0" is external and "eth1" is internal"
#
# NOTE: If this doesnt EXACTLY fit your configuration, you must
# change the EXTIF or INTIF variables above. For example:
#
# If you are a PPPoE or analog modem user:
#
# EXTIF="ppp0"
#
EXTIF="eth1"
INTIF="eth0"
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
echo " ---"

# Specify your Static IP address here or let the script take care of it
# for you.
#
# If you prefer to use STATIC addresses in your firewalls, un-# out the
# static example below and # out the dynamic line. If you don't care,
# just leave this section alone.
#
# If you have a DYNAMIC IP address, the ruleset already takes care of
# this for you. Please note that the different single and double quote
# characters and the script MATTER.
#
#
# DHCP users:
# -----------
# If you get your TCP/IP address via DHCP, **you will need ** to enable the
# #ed out command below underneath the PPP section AND replace the word
# "eth0" with the name of your EXTERNAL Internet connection (ppp0, ippp0,
# etc) on the lines for "ppp-ip" and "extip". You should also note that the
# DHCP server can and will change IP addresses on you. To deal with this,
# users should configure their DHCP client to re-run the rc.firewall ruleset
# everytime the DHCP lease is renewed.
#
# NOTE #1: Some DHCP clients like the original "pump" (the newer
# versions have been fixed) did NOT have the ability to run
# scripts after a lease-renew. Because of this, you need to
# replace it with something like "dhcpcd" or "dhclient".
#
# NOTE #2: The syntax for "dhcpcd" has changed in recent versions.
#
# Older versions used syntax like:
# dhcpcd -c /etc/rc.d/rc.firewall eth0
#
# Newer versions execute a file called /etc/dhcpc/dhcpcd-eth0.exe
#
# NOTE #3: For Pump users, put the following line in /etc/pump.conf:
#
# script /etc/rc.d/rc.firewall
#
# PPP users:
# ----------
# If you aren't already aware, the /etc/ppp/ip-up script is always run when
# a PPP connection comes up. Because of this, we can make the ruleset go and
# get the new PPP IP address and update the strong firewall ruleset.
#
# If the /etc/ppp/ip-up file already exists, you should edit it and add a line
# containing "/etc/rc.d/rc.firewall" near the end of the file.
#
# If you don't already have a /etc/ppp/ip-up sccript, you need to create the
# following link to run the /etc/rc.d/rc.firewall script.
#
# ln -s /etc/rc.d/rc.firewall /etc/ppp/ip-up
#
# * You then want to enable the #ed out shell command below *
#
#
# Determine the external IP automatically:
# ----------------------------------------
#
# The following line will determine your external IP address. This
# line is somewhat complex and confusing but it will also work for
# all NON-English Linux distributions:
#
EXTIP="`$IFCONFIG $EXTIF | $AWK \
/$EXTIF/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`"


# For users who wish to use STATIC IP addresses:
#
# # out the EXTIP line above and un-# out the EXTIP line below
#
#EXTIP="your.static.PPP.address"
echo " External IP: $EXTIP"
echo " ---"


# Assign the internal TCP/IP network and IP address
INTNET="192.168.2.0/24"
INTIP="192.168.2.100/32"
echo " Internal Network: $INTNET"
echo " Internal IP: $INTIP"
echo " ---"




# Setting a few other local variables
#
UNIVERSE="0.0.0.0/0"

#======================================================================
#== No editing beyond this line is required for initial MASQ testing ==

# Need to verify that all modules have all required dependencies
#
echo " - Verifying that all kernel modules are ok"
$DEPMOD -a

echo -en " Loading kernel modules: "

# With the new IPTABLES code, the core MASQ functionality is now either
# modular or compiled into the kernel. This HOWTO shows ALL IPTABLES
# options as MODULES. If your kernel is compiled correctly, there is
# NO need to load the kernel modules manually.
#
# NOTE: The following items are listed ONLY for informational reasons.
# There is no reason to manual load these modules unless your
# kernel is either mis-configured or you intentionally disabled
# the kernel module autoloader.
#

# Upon the commands of starting up IP Masq on the server, the
# following kernel modules will be automatically loaded:
#
# NOTE: Only load the IP MASQ modules you need. All current IP MASQ
# modules are shown below but are commented out from loading.
# ===============================================================

#Load the main body of the IPTABLES module - "ip_tables"
# - Loaded automatically when the "iptables" command is invoked
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_tables, "
#
#Verify the module isn't loaded. If it is, skip it
#
if [ -z "` $LSMOD | $GREP ip_tables | $AWK {'print $1'} `" ]; then
$MODPROBE ip_tables
fi


#Load the IPTABLES filtering module - "iptable_filter"
#
# - Loaded automatically when filter policies are activated


#Load the stateful connection tracking framework - "ip_conntrack"
#
# The conntrack module in itself does nothing without other specific
# conntrack modules being loaded afterwards such as the "ip_conntrack_ftp"
# module
#
# - This module is loaded automatically when MASQ functionality is
# enabled
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_conntrack, "
#
#Verify the module isn't loaded. If it is, skip it
#
if [ -z "` $LSMOD | $GREP ip_conntrack | $AWK {'print $1'} `" ]; then
$MODPROBE ip_conntrack
fi


#Load the FTP tracking mechanism for full FTP tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -e "ip_conntrack_ftp, "
#
#Verify the module isn't loaded. If it is, skip it
#
if [ -z "` $LSMOD | $GREP ip_conntrack_ftp | $AWK {'print $1'} `" ]; then
$MODPROBE ip_conntrack_ftp
fi


#Load the IRC tracking mechanism for full IRC tracking
#
# Disabled by default -- insert a "#" on the next few lines to activate
#
# echo -en " ip_conntrack_irc, "
#
#Verify the module isn't loaded. If it is, skip it
#
# if [ -z "` $LSMOD | $GREP ip_conntrack_irc | $AWK {'print $1'} `" ]; then
# $MODPROBE ip_conntrack_irc
# fi


#Load the general IPTABLES NAT code - "iptable_nat"
# - Loaded automatically when MASQ functionality is turned on
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "iptable_nat, "
#
#Verify the module isn't loaded. If it is, skip it
#
if [ -z "` $LSMOD | $GREP iptable_nat | $AWK {'print $1'} `" ]; then
$MODPROBE iptable_nat
fi


#Loads the FTP NAT functionality into the core IPTABLES code
# Required to support non-PASV FTP.
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -e "ip_nat_ftp"
#
#Verify the module isn't loaded. If it is, skip it
#
if [ -z "` $LSMOD | $GREP ip_nat_ftp | $AWK {'print $1'} `" ]; then
$MODPROBE ip_nat_ftp
fi


#Loads the IRC NAT functionality (for DCC) into the core IPTABLES code
#
# DISABLED by default -- delete the "#" on the next few lines to activate
#
# echo -e "ip_nat_irc"
#
#Verify the module isn't loaded. If it is, skip it
#
# if [ -z "` $LSMOD | $GREP ip_nat_irc | $AWK {'print $1'} `" ]; then
# $MODPROBE ip_nat_irc
# fi


echo " ---"

# Just to be complete, here is a partial list of some of the other
# IPTABLES kernel modules and their function. Please note that most
# of these modules (the ipt ones) are automatically loaded by the
# master kernel module for proper operation and don't need to be
# manually loaded.
# --------------------------------------------------------------------
#
# ip_nat_snmp_basic - this module allows for proper NATing of some
# SNMP traffic
#
# iptable_mangle - this target allows for packets to be
# manipulated for things like the TCPMSS
# option, etc.
#
# --
#
# ipt_mark - this target marks a given packet for future action.
# This automatically loads the ipt_MARK module
#
# ipt_tcpmss - this target allows to manipulate the TCP MSS
# option for braindead remote firewalls.
# This automatically loads the ipt_TCPMSS module
#
# ipt_limit - this target allows for packets to be limited to
# to many hits per sec/min/hr
#
# ipt_multiport - this match allows for targets within a range
# of port numbers vs. listing each port individually
#
# ipt_state - this match allows to catch packets with various
# IP and TCP flags set/unset
#
# ipt_unclean - this match allows to catch packets that have invalid
# IP/TCP flags set
#
# iptable_filter - this module allows for packets to be DROPped,
# REJECTed, or LOGged. This module automatically
# loads the following modules:
#
# ipt_LOG - this target allows for packets to be
# logged
#
# ipt_REJECT - this target DROPs the packet and returns
# a configurable ICMP packet back to the
# sender.


#CRITICAL: Enable IP forwarding since it is disabled by default since
#
# Redhat Users: you may try changing the options in
# /etc/sysconfig/network from:
#
# FORWARD_IPV4=false
# to
# FORWARD_IPV4=true
#
echo " Enabling forwarding.."
echo "1" > /proc/sys/net/ipv4/ip_forward


# Dynamic IP users:
#
# If you get your IP address dynamically from SLIP, PPP, or DHCP,
# enable the following option. This enables dynamic-address hacking
# which makes the life with Diald and similar programs much easier.
#
echo " Enabling DynamicAddr.."
echo "1" > /proc/sys/net/ipv4/ip_dynaddr

echo " ---"

#############################################################################
#
# Enable Stronger IP forwarding and Masquerading
#
# NOTE: In IPTABLES speak, IP Masquerading is a form of SourceNAT or SNAT.
#
# NOTE #2: The following is an example for an internal LAN address in the
# 192.168.1.x network with a 255.255.255.0 or a "24" bit subnet
# mask connecting to the Internet on external interface "eth0".
# This example will MASQ internal traffic out to the Internet
# but not allow non-initiated traffic into your internal network.
#
#
# ** Please change the above network numbers, subnet mask, and your
# *** Internet connection interface name to match your setup
#

#Clearing any previous configuration
#
# Unless specified, the defaults for INPUT, OUTPUT, and FORWARD to DROP
#
# You CANNOT change this to REJECT as it isn't a vaild policy setting.
# If you want REJECT, you must explictly REJECT at the end of a giving
# INPUT, OUTPUT, or FORWARD chain
#
echo " Clearing any existing rules and setting default policy to DROP.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -F -t nat

#Not needed and it will only load the unneeded kernel module
#$IPTABLES -F -t mangle
#
# Flush the user chain.. if it exists
if [ -n "`$IPTABLES -L | $GREP drop-and-log-it`" ]; then
$IPTABLES -F drop-and-log-it
fi
#
# Delete all User-specified chains
$IPTABLES -X
#
# Reset all IPTABLES counters
$IPTABLES -Z


#Configuring specific CHAINS for later use in the ruleset
#
# NOTE: Some users prefer to have their firewall silently
# "DROP" packets while others prefer to use "REJECT"
# to send ICMP error messages back to the remote
# machine. The default is "REJECT" but feel free to
# change this below.
#
# NOTE: Without the --log-level set to "info", every single
# firewall hit will goto ALL vtys. This is a very big
# pain.
#
echo " Creating a DROP chain.."
$IPTABLES -N drop-and-log-it
#$IPTABLES -A drop-and-log-it -j LOG --log-level info
$IPTABLES -A drop-and-log-it -j REJECT

echo -e "\n - Loading INPUT rulesets"


#######################################################################
# INPUT: Incoming traffic from various interfaces. All rulesets are
# already flushed and set to a default policy of DROP.
#

# loopback interfaces are valid.
#
$IPTABLES -A INPUT -i lo -s $UNIVERSE -d $UNIVERSE -j ACCEPT


# local interface, local machines, going anywhere is valid
#
$IPTABLES -A INPUT -i $INTIF -s $INTNET -d $UNIVERSE -j ACCEPT

#enalter
#$IPTABLES -A INPUT -i $INTIF -s 200.149.123.248 -j ACCEPT


# remote interface, claiming to be local machines, IP spoofing, get lost
#
$IPTABLES -A INPUT -i $EXTIF -s $INTNET -d $UNIVERSE -j drop-and-log-it

# external interface, from any source, for ICMP traffic is valid
#
# If you would like your machine to "ping" from the Internet,
# enable this next line
#
#$IPTABLES -A INPUT -i $EXTIF -p ICMP -s $UNIVERSE -d $EXTIP -j ACCEPT


# remote interface, any source, going to permanent PPP address is valid
#
#$IPTABLES -A INPUT -i $EXTIF -s $UNIVERSE -d $EXTIP -j ACCEPT


# Allow any related traffic coming back to the MASQ server in
#
$IPTABLES -A INPUT -i $EXTIF -s $UNIVERSE -d $EXTIP -m state --state \
ESTABLISHED,RELATED -j ACCEPT

# ----- Begin OPTIONAL INPUT Section -----
#



# DHCPd - Enable the following lines if you run an INTERNAL DHCPd server
#
$IPTABLES -A INPUT -i $INTIF -p tcp --sport 68 --dport 67 -j ACCEPT
$IPTABLES -A INPUT -i $INTIF -p udp --sport 68 --dport 67 -j ACCEPT

$IPTABLES -A INPUT -i $INTIF -p tcp --dport 137:139 -j ACCEPT
$IPTABLES -A INPUT -i $INTIF -p udp --dport 137:139 -j ACCEPT

$IPTABLES -A INPUT -i $INTIF -p tcp --dport 10000 -j ACCEPT
$IPTABLES -A INPUT -i $INTIF -p udp --dport 10000 -j ACCEPT

$IPTABLES -A INPUT -i $INTIF -p tcp --dport 8080 -j ACCEPT
$IPTABLES -A INPUT -i $INTIF -p udp --dport 8080 -j ACCEPT

$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 22 -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 22 -j ACCEPT

#$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 5500 -j ACCEPT
#$IPTABLES -A INPUT -i $EXTIF -p udp --dport 5500 -j ACCEPT

$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 631 -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 631 -j ACCEPT



$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 110 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 25 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 23 -j DROP

$IPTABLES -A INPUT -i $EXTIF -p udp --dport 110 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 25 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 23 -j DROP


$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 80 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 8080 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 4132 -j DROP

$IPTABLES -A INPUT -i $EXTIF -p udp --dport 80 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 8080 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 4132 -j DROP


# HTTPd - Enable the following lines if you run an EXTERNAL WWW server
#
# NOTE: This is NOT needed for simply enabling PORTFW. This is ONLY
# for users that plan on running Apache on the MASQ server itself
#
#echo -e " - Allowing EXTERNAL access to the WWW server"
#$IPTABLES -A INPUT -i $EXTIF -m state --state NEW,ESTABLISHED,RELATED \
# -p tcp -s $UNIVERSE -d $EXTIP --dport 80 -j ACCEPT

#
# ----- End OPTIONAL INPUT Section -----



# Catch all rule, all other incoming is denied and logged.
#
$IPTABLES -A INPUT -s $UNIVERSE -d $UNIVERSE -j drop-and-log-it


echo -e " - Loading OUTPUT rulesets"

#######################################################################
# OUTPUT: Outgoing traffic from various interfaces. All rulesets are
# already flushed and set to a default policy of DROP.
#

# loopback interface is valid.
#
$IPTABLES -A OUTPUT -o lo -s $UNIVERSE -d $UNIVERSE -j ACCEPT


# local interfaces, any source going to local net is valid
#
$IPTABLES -A OUTPUT -o $INTIF -s $EXTIP -d $INTNET -j ACCEPT

# local interface, any source going to local net is valid
#
$IPTABLES -A OUTPUT -o $INTIF -s $INTIP -d $INTNET -j ACCEPT

# outgoing to local net on remote interface, stuffed routing, deny
#
$IPTABLES -A OUTPUT -o $EXTIF -s $UNIVERSE -d $INTNET -j drop-and-log-it

# anything else outgoing on remote interface is valid
#
$IPTABLES -A OUTPUT -o $EXTIF -s $EXTIP -d $UNIVERSE -j ACCEPT


# ----- Begin OPTIONAL OUTPUT Section -----
#
$IPTABLES -A OUTPUT -o $INTIF -p tcp --sport 137:139 -j ACCEPT
$IPTABLES -A OUTPUT -o $INTIF -p udp --sport 137:139 -j ACCEPT

$IPTABLES -A OUTPUT -o $EXTIF -p tcp --sport 137:139 -j DROP
$IPTABLES -A OUTPUT -o $EXTIF -p udp --sport 137:139 -j DROP
$IPTABLES -A OUTPUT -o $EXTIF -p tcp --dport 137:139 -j DROP
$IPTABLES -A OUTPUT -o $EXTIF -p udp --dport 137:139 -j DROP

$IPTABLES -A INPUT -i $EXTIF -p tcp --sport 137:139 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p udp --sport 137:139 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p tcp --dport 137:139 -j DROP
$IPTABLES -A INPUT -i $EXTIF -p udp --dport 137:139 -j DROP


# DHCPd - Enable the following lines if you run an INTERNAL DHCPd server
# - Remove BOTH #s all the #s if you need this functionality.
#
$IPTABLES -A OUTPUT -o $INTIF -p tcp -s $INTIP --sport 67 \
-d 255.255.255.255 --dport 68 -j ACCEPT
$IPTABLES -A OUTPUT -o $INTIF -p udp -s $INTIP --sport 67 \
-d 255.255.255.255 --dport 68 -j ACCEPT

#
# ----- End OPTIONAL OUTPUT Section -----


# Catch all rule, all other outgoing is denied and logged.
#
$IPTABLES -A OUTPUT -s $UNIVERSE -d $UNIVERSE -j drop-and-log-it


echo -e " - Loading FORWARD rulesets"

#######################################################################
# FORWARD: Enable Forwarding and thus IPMASQ
#

# ----- Begin OPTIONAL FORWARD Section -----
#
# ----- End OPTIONAL FORWARD Section -----


echo " - FWD: Allow all connections OUT and only existing/related IN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED \
-j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT

# Catch all rule, all other forwarding is denied and logged.
#
$IPTABLES -A FORWARD -j drop-and-log-it


echo " - NAT: Enabling SNAT (MASQUERADE) functionality on $EXTIF"
#
#More liberal form
#$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
#

#Stricter form TODOS
#$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $EXTIP

#Stricter form INDIVIDUAL
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s 192.168.2.0/24 -p tcp --dport 80 -j SNAT --to $EXTIP
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s 192.168.2.0/24 -p tcp --dport 110 -j SNAT --to $EXTIP
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -s 192.168.2.0/24 -p tcp --dport 25 -j SNAT --to $EXTIP


##
# Ronei aqui é bloqueado todo o trafego na PORTA 80
##
#$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF --dport 80 -j REDIRECT --to-port 8080

/etc/firewall/rc.bloqueio
/etc/firewall/rc.bloqueio2


#$IPTABLES -A FORWARD -i $EXTIF -p tcp --dport 5500 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
#$IPTABLES -A FORWARD -i $EXTIF -p udp --dport 5500 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
#$IPTABLES -t nat -A PREROUTING -i $EXTIF -p tcp -m tcp --dport 5500 -j DNAT --to-destination 192.168.0.92:5500
#$IPTABLES -t nat -A PREROUTING -p udp -i $EXTIF --dport 5500 -j DNAT --to 192.168.0.92:5500

#######################################################################
#$IPTABLES -P INPUT DROP
#$IPTABLES -P OUTPUT DROP

echo -e "\nDone.\n"






##rc.bloqueio e rc.bloqueio2


#!/bin/sh

IPTABLES=/sbin/iptables
LSMOD=/sbin/lsmod
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
GREP=/bin/grep
AWK=/usr/bin/awk
SED=/bin/sed
IFCONFIG=/sbin/ifconfig


#Setting the EXTERNAL and INTERNAL interfaces for the network
EXTIF="eth0"
INTIF="eth1"

EXTIP="`$IFCONFIG $EXTIF | $AWK \
/$EXTIF/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`"

# Assign the internal TCP/IP network and IP address



$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.99 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.98 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.97 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.96 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.95 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.94 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.93 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.92 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.91 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.90 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.89 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.88 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.87 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.86 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.85 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.84 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.83 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.82 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.81 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.80 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.79 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.78 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.77 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.76 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.75 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.74 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.73 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.72 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.71 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.70 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.69 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.68 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.67 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.66 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.65 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.64 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.63 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.62 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.61 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.60 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.59 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.58 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.57 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.56 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.55 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.54 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.53 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.52 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.51 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.50 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.49 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.48 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.47 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.46 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.45 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.44 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.43 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.42 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.41 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.40 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.39 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.38 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.37 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.36 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.35 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.34 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.33 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.32 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.31 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.30 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.29 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.28 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.27 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.26 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.25 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.24 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.23 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.22 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.21 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.20 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.19 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.18 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.17 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.16 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.15 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.14 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.13 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.12 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.11 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.10 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.9 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.8 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.7 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.6 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.5 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.4 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.3 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.2 --dport 80 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.1 --dport 80 -j REDIRECT --to-port 3128



(rc.bloqueio2)
#!/bin/sh

IPTABLES=/sbin/iptables
LSMOD=/sbin/lsmod
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
GREP=/bin/grep
AWK=/usr/bin/awk
SED=/bin/sed
IFCONFIG=/sbin/ifconfig


#Setting the EXTERNAL and INTERNAL interfaces for the network
EXTIF="eth0"
INTIF="eth1"

EXTIP="`$IFCONFIG $EXTIF | $AWK \
/$EXTIF/'{next}//{split($0,a,":");split(a[2],a," ");print a[1];exit}'`"

# Assign the internal TCP/IP network and IP address



$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.99 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.98 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.97 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.96 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.95 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.94 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.93 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.92 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.91 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.90 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.89 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.88 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.87 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.86 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.85 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.84 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.83 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.82 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.81 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.80 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.79 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.78 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.77 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.76 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.75 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.74 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.73 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.72 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.71 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.70 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.69 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.68 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.67 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.66 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.65 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.64 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.63 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.62 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.61 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.60 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.59 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.58 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.57 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.56 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.55 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.54 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.53 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.52 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.51 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.50 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.49 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.48 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.47 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.46 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.45 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.44 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.43 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.42 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.41 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.40 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.39 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.38 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.37 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.36 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.35 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.34 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.33 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.32 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.31 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.30 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.29 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.28 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.27 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.26 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.25 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.24 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.23 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.22 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.21 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.20 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.19 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.18 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.17 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.16 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.15 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.14 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.13 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.12 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.11 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.10 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.9 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.8 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.7 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.6 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.5 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.4 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.3 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.2 --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.1 --dport 8080 -j REDIRECT --to-port 3128









  


2. MELHOR RESPOSTA

André Canhadas
andrecanhadas

(usa Debian)

Enviado em 20/01/2012 - 17:14h

helderfalcao escreveu:

Galera, a dica do andrecanhadas resolveu completamente o meu problema, muito obrigado a todos do vol e um bom final de semana.
Abraços e ate+.


Só marca o post como resolvido
Abraços...



3. Re: Problemas cliente DHCP [RESOLVIDO]

João Paulo Carneiro
jptudobem

(usa Debian)

Enviado em 19/01/2012 - 16:33h

Jesuis, que firewall é esse meu jovem? Pra que redirecionou um ip de cada para o squid?



4. ICMP

André Canhadas
andrecanhadas

(usa Debian)

Enviado em 19/01/2012 - 16:57h

Como era muito longo busquei por icmp:

# If you would like your machine to "ping" from the Internet,
# enable this next line
#


Descomenta esta linha:
#$IPTABLES -A INPUT -i $EXTIF -p ICMP -s $UNIVERSE -d $EXTIP -j ACCEPT

Troca sua regra de direcionamento para o proxy por isto todas elas:
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.0/24 --dport 8080 -j REDIRECT --to-port 3128


Se tiver algum que IP DA REDE que ficara fora da regra adiciona "!"
ex:

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 8080 -j REDIRECT --to-port 3128


5. Obrigado!!1

Helder da Silva Falcão
helderfalcao

(usa Ubuntu)

Enviado em 20/01/2012 - 16:55h

Galera, a dica do andrecanhadas resolveu completamente o meu problema, muito obrigado a todos do vol e um bom final de semana.
Abraços e ate+.


6. Otimização iptables

Perfil removido
removido

(usa Nenhuma)

Enviado em 20/01/2012 - 23:46h

Brother... suas regras estão bem estranhas!
Tente reduzir e otimizar suas regras para facilitar sua vida!


7. Re: Problemas cliente DHCP [RESOLVIDO]

Helder da Silva Falcão
helderfalcao

(usa Ubuntu)

Enviado em 30/01/2012 - 08:38h

André, so mais uma coisa, para eu liberar multiplos clientes, qual seria a melhor forma de colocar isto no servidor?





andrecanhadas escreveu:

Como era muito longo busquei por icmp:

# If you would like your machine to "ping" from the Internet,
# enable this next line
#


Descomenta esta linha:
#$IPTABLES -A INPUT -i $EXTIF -p ICMP -s $UNIVERSE -d $EXTIP -j ACCEPT

Troca sua regra de direcionamento para o proxy por isto todas elas:
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.0/24 --dport 8080 -j REDIRECT --to-port 3128


Se tiver algum que IP DA REDE que ficara fora da regra adiciona "!"
ex:

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 8080 -j REDIRECT --to-port 3128







8. Tipo de liberação

André Canhadas
andrecanhadas

(usa Debian)

Enviado em 30/01/2012 - 12:13h

helderfalcao escreveu:

André, so mais uma coisa, para eu liberar multiplos clientes, qual seria a melhor forma de colocar isto no servidor?





andrecanhadas escreveu:

Como era muito longo busquei por icmp:

# If you would like your machine to "ping" from the Internet,
# enable this next line
#


Descomenta esta linha:
#$IPTABLES -A INPUT -i $EXTIF -p ICMP -s $UNIVERSE -d $EXTIP -j ACCEPT

Troca sua regra de direcionamento para o proxy por isto todas elas:
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.0/24 --dport 8080 -j REDIRECT --to-port 3128


Se tiver algum que IP DA REDE que ficara fora da regra adiciona "!"
ex:

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 8080 -j REDIRECT --to-port 3128






O que gostaria de liberar?
acesso externo a uma porta ou aplicação?

Seria para qualquer um ou apenas para alguns IPs ?




9. Re: Problemas cliente DHCP [RESOLVIDO]

Helder da Silva Falcão
helderfalcao

(usa Ubuntu)

Enviado em 30/01/2012 - 12:30h

A idéia é que de acordo com o ip fornecido pelo dhcp eu o libero no firewall, não tendo um range certo.
Estes ips estariam livres do acesso obrigatorio ao squid.



10. Fora do squid

André Canhadas
andrecanhadas

(usa Debian)

Enviado em 30/01/2012 - 13:21h

helderfalcao escreveu:

A idéia é que de acordo com o ip fornecido pelo dhcp eu o libero no firewall, não tendo um range certo.
Estes ips estariam livres do acesso obrigatorio ao squid.

Seria o que te passei:
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 8080 -j REDIRECT --to-port 3128
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 80 -j REDIRECT --to-port 3128

Ai sim teria que criar um para cada IP

A parte: !-s 192.168.0.xx corresponde a ser ignorado pela regra


11. Cara

Helder da Silva Falcão
helderfalcao

(usa Ubuntu)

Enviado em 30/01/2012 - 15:11h

Velho, o problema é que apesar de implementar varias regras, o firewall le as politicas em cascata, então o que eu presciso é de uma politica que redirecione os IPs que eu escolha antes que eu chegue nesta regra de redirecionamento, pq assime so vai funcionar com o primeiro IP.


12. Troca

André Canhadas
andrecanhadas

(usa Debian)

Enviado em 30/01/2012 - 16:15h

helderfalcao escreveu:

Velho, o problema é que apesar de implementar varias regras, o firewall le as politicas em cascata, então o que eu presciso é de uma politica que redirecione os IPs que eu escolha antes que eu chegue nesta regra de redirecionamento, pq assime so vai funcionar com o primeiro IP.


Comenta as regras:
$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.0/24 --dport 8080 -j REDIRECT --to-port 3128

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF -s 192.168.2.0/24 --dport 80 -j REDIRECT --to-port 3128

E adiciona estas logo abaixo delas:

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 8080 -j REDIRECT --to-port 3128

$IPTABLES -t nat -A PREROUTING -p tcp -i $INTIF !-s 192.168.0.xx --dport 80 -j REDIRECT --to-port 3128

Obs uma para cada porta (80,8080) para cada IP que for deixar fora












Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts