Estimados amigos, una consulta, estoy construyendo las políticas para un
firewall y necesito probar el nat para reenviar el tráfico entrante a un
servidor ssh interno pero no logro conectarme.
Estoy tratando de conectarme desde un equipo que se encuentra delante del
firewall con el IP 192.168.1.35 a un IP de la LAN 172.16.0.15
A continuación pego las configuraciones:
#El firewall tiene dos tarjetas de red:
#eth0: 192.168.1.41, trafico hacia la WAN
#eth1: 172.16.0.1: trafico hacia la LAN
#!/bin/bash
## FLUSH de reglas
iptables -F
iptables -X
iptables -Z
iptables -t nat -F
## Politica por defecto: DROP
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
# Bit forward
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p icmp -s 172.16.0.0/16 -d 172.16.0.1 -j ACCEPT
iptables -A INPUT -p icmp -s 192.168.0.0/16 -d 192.168.1.41 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
#NAT puerto 22
iptables -A INPUT -i eth0 -s 192.168.0.0/16 -p tcp --dport 22 -j ACCEPT
iptables -A OUTPUT -o eth1 -p tcp --dport 22 -j ACCEPT
iptables -A FORWARD -i eth0 -p tcp --dport 22 -d 172.16.0.15 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 22 -j DNAT --to
172.16.0.15:22
iptables -t nat -A POSTROUTING -s 172.16.0.0/16 -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth0 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j
ACCEPT
iptables -t nat -A PREROUTING -s 172.16.0.0/16 -p tcp --dport 80 -j REDIRECT
--to-port 3128
iptables -t filter -A INPUT -p tcp --dport 3128 -i eth1 -s 172.16.0.0/16 -m
state --state NEW,ESTABLISHED -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --sport 3128 -o eth1 -d 172.16.0.0/16 -m
state --state RELATED,ESTABLISHED -j ACCEPT
Seguido algunas salidas que me muestra el LOG
Apr 6 02:12:49 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21673 PROTO=UDP SPT=520 DPT=520 LEN=52
Apr 6 02:13:19 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21676 PROTO=UDP SPT=520 DPT=520 LEN=52
Apr 6 02:13:49 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21680 PROTO=UDP SPT=520 DPT=520 LEN=52
Apr 6 02:14:19 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21696 PROTO=UDP SPT=520 DPT=520 LEN=52
Apr 6 02:14:49 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21697 PROTO=UDP SPT=520 DPT=520 LEN=52
Apr 6 02:15:18 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21698 PROTO=UDP SPT=520 DPT=520 LEN=52
Apr 6 02:15:48 centostry kernel: IPTables-Dropped: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:90:f6:52:86:1f:cb:08:00 SRC=192.168.1.1 DST=192.168.1.255
LEN=72 TOS=0x00 PREC=0x00 TTL=1 ID=21705 PROTO=UDP SPT=520 DPT=520 LEN=52
Quisiera tener alguna idea de porque a pesar de las configuraciones sigo sin
conectarme.
Gracias
Augusto
_______________________________________________
Lista de correo Linux-plug
Temática: Discusión general sobre Linux
Peruvian Linux User Group (http://www.linux.org.pe)
Participa suscribiéndote y escribiendo a: [email protected]
Para darte de alta, de baja o hacer ajustes a tu suscripción visita:
http://voip2.voip.net.pe/mailman/listinfo/linux-plug
IMPORTANTE: Reglas y recomendaciones
http://www.linux.org.pe/listas/reglas.php
http://www.linux.org.pe/listas/comportamiento.php
http://www.linux.org.pe/listas/recomendaciones.php
Alojamiento de listas cortesia de http://cipher.pe