Ticket #3864 (closed defect: worksforme)
Port forwarding not working
| Reported by: | sktrds@… | Owned by: | jamor@… |
|---|---|---|---|
| Milestone: | 2.2.X | Component: | firewall |
| Severity: | normal | Keywords: | port forwarding - Replace source address checked |
| Cc: |
Description
It seems that port forwarding on zentyal 2.2 with or without " Replace source address checked " returns the same result it always gives zentyal servers ip address as the external address.
Attachments
Change History
comment:2 Changed 16 months ago by jamor@…
- Status changed from new to closed
- Resolution set to worksforme
Hello Sktrds,
this is probably a configuration problem which is somewhat hidden by Zentyal's interface. Look in your /var/log/zentyal/zentyal.log for a line like this:
Unable to find a SNAT address for redirection to X.X.X.X No SNAT rule will be added for this redirection."
You can find lines like this with this commands:
sudo /etc/init.d/zentyal firewall restart sudo grep 'No SNAT rule will be added for this' /var/log/zentyal/zentyal.log
If you find this line it means that the source address replacement could not be done because there is not nay interface attached to the same network than the destination so Zentyal could no determine the source address substitution.
I think this is the problem so I close the ticket.
If I am wrong, reopen it and give me the following information
- /var/log/zentyal/zentyal.log AFTEr running 'sudo /etc/init.d/zentyal firewall restart
- output of 'sudo iptables -t nat -vL'
- output of 'sudo iptables -t filter -vL'
- complete configuration of your ports redirects
Regards,
Javier
comment:3 Changed 16 months ago by sktrds@…
- Status changed from closed to reopened
- Resolution worksforme deleted
Hello Javier,
I did not find the line you asked me to look for.
I could not attached the files since the log is to big: im posting them on the following link:
http://www.oseocreativo.com/viasc
I have there the following files: zentyal.log (22MB) zentyal.log.zip (900KB) (same as log but compressed for faster transfer) viasc-srv-ticket-3864 (text file with the commands you asked for output) services-voip-foraneas.png (screen shot of the service configuration) port-forwarding.png (screen shot of port forwarding configuration) packet-filter-ext-to-int.png (screen shot of packet filter external no internal networksconfiguration) asterisk-registration.png (screen shof of the ip that reflects on the asterisk server)
if it helps here is the description of the problem: we just changed the router we had for a zentyal box (ip 192.168.1.254) we have an internal asterisk server ( 192.168.1.5 ) before we changed the box all external extensions worked perfectly when we changed the router for the zentyal all external extensions do register but we hear no voice and found out that it was because zenetyal was giving its own IP address instead of the external IP address and thats why the voice packets were being lost.
comment:4 Changed 16 months ago by jamor@…
- Status changed from reopened to closed
- Resolution set to worksforme
- Severity changed from critical to normal
Hello Sktrds,
i think we have a misundestanding there, the 'replace source address' put the 'Zentyal server address' in the redirect. In your iptables output it seems that is set correctly (SNAT to :192.168.1.254 ).
Also Zentyal does automatically SNAT for the external interfaces, in this case eth1, you can see this automatic SNAt in the last line of the CHAIN POSTROUTING.
If for any reason do you not want this automatic SNAT, you could edit the file /etc/zentyal/firewall.conf and set the parameter 'nat_enabled' to 'no'. If you do this change you must restart the firewall and the web interface to enforce it. This is done with this two commands: "sudo /etc/init.d/zentyal firewall restart" and "/etc/init.d/zentyal apache restart".
Regards,
Javier
Chain POSTROUTING (policy ACCEPT 54002 packets, 3692K bytes)
pkts bytes target prot opt in out source destination
22 1537 postmodules all -- any any anywhere anywhere
0 0 SNAT all -- any any anywhere 192.168.1.131 to:192.168.1.254
0 0 SNAT all -- any any anywhere 192.168.1.1 to:192.168.1.254
0 0 SNAT all -- any any anywhere 192.168.1.5 to:192.168.1.254
0 0 SNAT all -- any any anywhere 192.168.1.131 to:192.168.1.254
0 0 SNAT all -- any any anywhere 192.168.1.131 to:192.168.1.254
0 0 MASQUERADE all -- any eth0 anywhere anywhere
15 1088 SNAT all -- any eth1 !customer-GDL-200-56.megared.net.mx anywhere to:200.52.200.56
comment:5 Changed 16 months ago by sktrds@…
- Status changed from closed to reopened
- Resolution worksforme deleted
Javier que tal,
Te escribo en español ya que creo que me voy a hacer entender mas facilmente.
Actualmente tengo instalada una version de zentyal de: 2.0.23 la ip de ese servidor es la 192.168.0.2 Configure el port forward hacia un servidor FTP dentro de la misma LAN con ip 192.168.0.1
A la hora de conectarme desde fuera se conecta y el servidor FTP me muestra la IP externa de mi cliente foraneo correctamente.
El problema que tengo es que en otra instalacion (para hacer un upgrade de mi servidor actual) estoy haciendo pruebas (ya le cale con 2 diferentes fresh install's) tanto con la version 2.2-1 como una 2.0-24
Al hacer lo mismo de port forward 20 y 21 de TCP para el servidor de FTP localizado en la 192.168.0.1 El log del servidor me marca como ip foranea la del zentyal (la 192.168.0.2) en vez de la publica de mi equipo remoto.
En la version de 2.2 se tiene la opcion de "Replace source address checked" pero al parecer no funciona ya que si la deshabilito ni si quiera me da chance de conectarme.
Esta igual configurado mi servidor actual de port forwards y packet filter rules como el nuevo que estoy haciendo las pruebas para la migracion y no se porque no me esta pasando la direccion foranea y le esta pasando la direccion del zentyal como foranea.
comment:6 Changed 16 months ago by jamor@…
Hola,
eth0 la tienes marcada como externa o interna?. El cliente supongo que entra por eth1. Estoy en lo cierto?.
comment:7 Changed 15 months ago by jamor@…
Tambien me gustaria saber la configuracion de eth1. Imagino que es externa
comment:8 Changed 15 months ago by sktrds@…
eth1 es externa y esta como ip fija ya que es un enlace de fibraoptica con IP fija. eth2 es externa y marcada como DHCP (en las pruebas no la utilizamos) eth0 esta marcada como interna fija
(segun recuerdo ya que tuvimos que formatear el servidor para dejarlo con la version 2.0 de zentyal) ya que esa version funciona correctamente y si le pasa la ip externa a la hora de crear las reglas del firewall.
comment:9 Changed 15 months ago by jamor@…
Hola,
entonces la salida iptables no es la esperada, la regla de MASQUERADE debería estar en las externas(eth1 y eth2) y esta en las externas.
Puede que cambiases el tipo de interfaz y de alguna manera se desincronizase?.
Podemos probar lo siguiente: comprueba que la configuracion de las interfaces esta como dices y que lso cambios están guardados, a continuación reinicia el firewall con:
sudo /etc/init.d/zentyal firewall restart
y comprueba si las reglas han cambiado con sudo iptables -t nat -vL'
comment:10 Changed 15 months ago by jamor@…
- Status changed from reopened to closed
- Resolution set to worksforme
Cierro esto ya que parece un error de configuracion.
Sktrds, no dudes en reabrir el ticket si estoy equivocado.
Saludos,
Javier