lfbarros
(usa Debian)
Enviado em 22/01/2010 - 18:57h
Fala Pessoal, tudo blza?
É o seguinte, não estou conseguindo configurar uma VPN de notebooks XP externo para o openvpn configurado no Linux debain 5.0 (matriz) na realidade a vpn conecta mais nao consigo acesar minha rede interna vou colocar aqui as conf do server linux, do Windows e do firewall detalhe mesmo quando eu desabilito o firewall, habilito o ip_forward 1 e forward na tap+ ACCEPT mesmo assim não funciona, eu tenho quase certeza que algum problema de rota agora o que é, se alguem pude ajudar agradeço.
desde já obrigado a todos!
Fernando
#matriz.conf
CONF DO SERVER LINUX
proto udp
dev tap
ifconfig 10.1.1.1 255.255.255.0
secret chave
port 5901
CONF DA ESTAÇÃO WIN
#xp.ovpn
proto udp
remote 20x.xxx.xxx.xx
port 5901
dev tap
ifconfig 10.1.1.2 255.255.255.0
secret chave.key
ROTA CRIADA NO WIN
route add 192.168.0.0 mask 255.255.255.0 10.1.1.1
MINHA CONF DE FIREWALL
##Firewall
##
#!/bin/bash
case $1 in
start)
echo "1" >/proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE
iptables -t nat -A POSTROUTING -o tap+ -j MASQUERADE
### Carregando modulos necessarios
/sbin/modprobe ip_nat_ftp
### Proteçs
for i in /proc/sys/net/ipv4/conf/*/rp_filter
do echo 1 > $i
done
for i in /proc/sys/net/ipv4/conf/*/log_martians
do echo 1 > $i
done
for i in /proc/sys/net/ipv4/conf/*/accept_source_route
do echo 0 > $i
done
for i in /proc/sys/net/ipv4/conf/*/accept_redirects
do echo 0 > $i
done
for i in /proc/sys/net/ipv4/conf/*/send_redirects
do echo 0 > $i
done
for i in /proc/sys/net/ipv4/conf/*/secure_redirects
do echo 1 > $i
done IPV4="/proc/sys/net/ipv4"
echo 1 > $IPV4/icmp_echo_ignore_broadcasts
echo 1 > $IPV4/icmp_ignore_bogus_error_responses
echo 60 > $IPV4/tcp_fin_timeout
echo 60 > $IPV4/tcp_keepalive_intvl
echo 5 > $IPV4/tcp_keepalive_probes
echo 1800 > $IPV4/tcp_keepalive_time
echo 5 > $IPV4/tcp_retries1
echo 5 > $IPV4/tcp_retries2
echo 5 > $IPV4/tcp_syn_retries
echo 5 > $IPV4/tcp_synack_retries
echo 1024 > $IPV4/tcp_max_syn_backlog
echo 1024 > /proc/sys/net/core/netdev_max_backlog
echo 1 > $IPV4/tcp_syncookies
echo " Cerregando modulos de seguranca "
iptables -P FORWARD DROP
iptables -P INPUT DROP
iptables -P OUTPUT DROP
echo " Mudando a politica padrao para DROP "
iptables -A FORWARD -s 192.168.0.0/24 -p tcp -m multiport --dport 21,25,80,110,443,3389,8080,10000 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -p tcp --dport 53 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -p udp --dport 53 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -p icmp -j ACCEPT
echo " liberando forward para rede internat "
iptables -A FORWARD -s 127.0.0.1 -j ACCEPT
iptables -A OUTPUT -s 127.0.0.1 -j ACCEPT
iptables -I INPUT -s 127.0.0.1 -j ACCEPT
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A OUTPUT -o tun+ -j ACCEPT
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A FORWARD -i tap+ -j ACCEPT
iptables -A OUTPUT -o tap+ -j ACCEPT
iptables -A INPUT -i tap+ -j ACCEPT
iptables -A FORWARD -s 10.0.0.0/24 -d 192.168.0.0/24 -j ACCEPT
iptables -A OUTPUT -s 10.0.0.0/24 -d 192.168.0.0/24 -j ACCEPT
iptables -A INPUT -s 10.0.0.0/24 -d 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -s 10.1.1.0/24 -d 192.168.0.0/24 -j ACCEPT
iptables -A OUTPUT -s 10.1.1.0/24 -d 192.168.0.0/24 -j ACCEPT
iptables -A INPUT -s 10.1.1.0/24 -d 192.168.0.0/24 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -i eth1 -j ACCEPT
iptables -A OUTPUT -s 192.168.0.0/24 -o eth1 -j ACCEPT
iptables -I INPUT -s 192.168.0.0/24 -i eth1 -j ACCEPT
iptables -A FORWARD -m state --state INVALID -j DROP
iptables -A FORWARD -p tcp -m state --state NEW ! --syn -j DROP
iptables -A FORWARD -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
iptables -A FORWARD -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A FORWARD -p tcp --tcp-option 64 -j DROP
iptables -A FORWARD -p tcp --tcp-option 128 -j DROP
iptables -A INPUT -p tcp -s 192.168.0.13 --dport 22 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 139 -j REJECT
iptables -A INPUT -i eth0 -p tcp --dport 445 -j REJECT
iptables -A INPUT -i eth0 -p tcp --dport 10000 -j REJECT
iptables -A INPUT -i eth0 -p tcp --dport 113 -j REJECT
iptables -A INPUT -i eth0 -p tcp --dport 111 -j REJECT
iptables -A INPUT -i eth0 -p tcp --dport 953 -j REJECT
iptables -A INPUT -p tcp --dport 22 -j REJECT
iptables -A INPUT -i eth0 -p tcp --dport 3306 -j REJECT
iptables -A INPUT -s 10.0.0.2 -i tun0 -j ACCEPT
iptables -A INPUT -p udp -m multiport --dport 1194,5901 -j ACCEPT
iptables -I INPUT -i tun0 -j ACCEPT
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -p tcp -m state --state NEW ! --syn -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A INPUT -p tcp --tcp-option 64 -j DROP
iptables -A INPUT -p tcp --tcp-option 128 -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -i eth0 -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL NONE -i eth0 -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -i eth0 -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL FIN,SYN -i eth0 -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -i eth0 -j DROP
iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -i eth0 -j DROP
iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -i eth0 -j DROP
iptables -A OUTPUT -m state --state INVALID -j DROP
iptables -A OUTPUT -p tcp -m state --state NEW ! --syn -j DROP
iptables -A OUTPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
iptables -A OUTPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
iptables -A OUTPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A OUTPUT -p tcp --tcp-option 64 -j DROP
iptables -A OUTPUT -p tcp --tcp-option 128 -j DROP
iptables -A INPUT -p tcp -s 192.168.0.0/24 -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.0.0/24 -j ACCEPT
iptables -I INPUT -p tcp -m multiport --dport 21,53,80 -j ACCEPT
iptables -I INPUT -p tcp -m multiport --sport 21,53,80 -j ACCEPT
iptables -I INPUT -p udp --dport 53 -j ACCEPT
#ptables -A OUTPUT -s 0/0 -p tcp -m multiport --dport 22,3128 -j ACCEPT
iptables -A OUTPUT -p tcp -m multiport --dport 53 -j ACCEPT
iptables -A OUTPUT -p tcp -m multiport --sport 53 -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
echo " liberando acesso input e output para rede interna "
iptables -A INPUT -i lo -j ACCEPT
iptables -A FORWARD -i lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
echo " Estabelecendo conexao "
#iptables -A PREROUTING -t nat -s 192.168.0.30 -p tcp --dport 1863 -j ACCEPT
#iptables -A PREROUTING -t nat -s 192.168.0.10 -p tcp --dport 1863 -j ACCEPT
#iptables -A PREROUTING -t nat -s 192.168.0.8 -p tcp --dport 1863 -j ACCEPT
#echo " Liberando msn por ip "
;;
stop)
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -F -t nat
echo "Parando Firewall"
;;
status)
iptables -L -n -v
;;
restart)
$0 stop >/dev/null
$0 start >/dev/null
echo "Reiniciando Firewall"
;;
esac