2 Link's de Internet em 1 Servidor

1. 2 Link's de Internet em 1 Servidor

natha
ncampos

(usa Debian)

Enviado em 05/10/2015 - 10:07h

Bom dia, sendo curto e grosso...
Tenho 1 Servidor Firewall (iptables +squid) no qual preciso que quando "caia" a internet GVT eu possa "subir" a internet Oi. (isso remotamente, se possível automaticamente)
tenho 3 placas de redes (eth0 = WAN "gvt" , eth1 = LAN" rede local" , eth2= WAN "oi" )

segue meus scripts:

(firewall)
#!/bin/bash
iniciar()
{
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe ip_tables
#
#Interfaces de Rede
LAN=eth1
WAN=eth2
REDE="10.1.1.0/24"
############################################################################################################################################
########################################## ######################################################

iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -m tcpmss --mss 1400:1536 -j TCPMSS --clamp-mss-to-pmtu

#############################################################################################################################################
############################################ PORTAS LIBERADAS ###############################################################################

iptables -A INPUT -m multiport -p tcp --dport 22,21,53,80,81,443,3007,3256,3443,3456,5000,5001,5222,8484 -j ACCEPT

############################################## REDIRECIONAMENTO DE PORTAS ###################################################################
## eth0 = modem

iptables -t nat -A PREROUTING -i $WAN -p tcp --dport 6000 -j DNAT --to-destination 10.1.1.250:6000 # SSH
iptables -t nat -A PREROUTING -i $WAN -p udp --dport 6000 -j DNAT --to-destination 10.1.1.250:6000 # SSH


#############################################################################################################################################

############################################# MODO TRANSPARENTE ############################################################################
# Jogando trafego da porta 80 para o SQUID TRANSPARENT
iptables -t nat -A PREROUTING -s $REDE -p tcp --dport 80 -j REDIRECT --to-port 3128

#############################################################################################################################################
##############################################################################################################################################
##############################################################################################################################################
echo "iniciando servico"
}
parar(){
iptables -F -t nat
echo "parando servico"
}
case "$1" in
"start") iniciar;;
"stop") parar;;
"restart")parar;iniciar;;
*)echo "Use os parametros start,stop ou restart"
esac



( MINHAS INTERFACES )
#################### MODEM 1 #############################
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

##################### REDE LOCAL ##########################
auto eth1
iface eth1 inet static
address 10.1.1.250
netmask 255.255.255.0
network 10.1.1.0

################### MODEM 2 #################################
auto eth2
iface eth2 inet static
address 192.168.25.99
netmask 255.255.255.0
network 192.168.25.0
broadcast 192.168.25.255
gateway 192.168.25.1








  


2. Re: 2 Link's de Internet em 1 Servidor

Valdir Júnior
juniormasterroot

(usa Fedora)

Enviado em 06/10/2015 - 15:28h


Boa tarde Amigo

Isso e questão de rota OK!! Então o que acontece, quando você configura uma interface com ip estático e seta uma rota estática ela esta sempre ativa porque o cabo de rede esta conectado por isso que não sobe a rota com a prioridade maior, o que você pode fazer e coloca o modem GVT em brigder fazer seu firewall disca e por uma rota estática com a prioridade maior EX: prioridade 250, fazendo isso quando a GVT cair automaticamente o pppoe vai desconecta e a rota com a prioridade maior vai levanta.

Atenciosamente



3. Re: 2 Link's de Internet em 1 Servidor

Erik Pinheiro
erikpinheiro

(usa Debian)

Enviado em 09/10/2015 - 15:09h

Jovem, boa tarde!

Veja se isso resolve seu problema:
http://www.vivaolinux.com.br/artigo/Redundancia-de-links-Mon-+-Shell-Script

Aqui funfa que é uma maravilha.



4. Re: 2 Link's de Internet em 1 Servidor

natha
ncampos

(usa Debian)

Enviado em 13/10/2015 - 08:41h

erikpinheiro escreveu:

Jovem, boa tarde!

Veja se isso resolve seu problema:
http://www.vivaolinux.com.br/artigo/Redundancia-de-links-Mon-+-Shell-Script

Aqui funfa que é uma maravilha.




vou aplicar essa regra e testar,aviso se funcionar hehe...obrigado.






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts