Problema con TFTP e IPTables y (s)-NAT

Problema con TFTP e IPTables y (s)-NAT

Tengo algunos problemas con la descarga TFTP detrás de NAT usando IPtables y realmente me vendría bien tu ayuda. Estoy familiarizado con los principios de redes, pero soy bastante nuevo en IPtables, así que lo siento si estoy haciendo algo completamente mal.

Tengo un servidor que ejecuta Ubuntu 20.04 con dos NIC y que intenta conectarse a un servidor TFTP. Si bien todo lo demás funciona perfectamente bien, se me agota el tiempo de espera cuando intento realizar TFTP. Tengo una sospecha basada en un tcpdump, donde veo algo de tráfico icmp que (tal vez) no está traducido correctamente, pero no estoy seguro.

Información de topología

TFTP server: 130.221.69.14:udp\69
MyServer (TFTP-CLIENT) :
eth0 = uplink / 172.25.17.6
eth1 = downlink / 10.14.254.0/24 (Which NAT's to eth0 with config below)


IFACE_WAN=eth0
IFACE_LAN=eth1
NETWORK_LAN=10.14.254.0/24

... configuración de iptables

echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o $IFACE_WAN -s $NETWORK_LAN ! -d $NETWORK_LAN -j MASQUERADE
iptables -A FORWARD -d $NETWORK_LAN -i $IFACE_WAN -o $IFACE_LAN -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s $NETWORK_LAN -i $IFACE_LAN -j ACCEPT

Al hacer un tcpdump en eth1/$NETWORK_LAN (ANTES de NAT), veo:

No veo tráfico ICMP aquí.

root@swmgmt:~# tcpdump -i eth1 -n  dst 130.221.69.14
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
20:38:34.901901 IP 10.14.254.164.59384 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:38:38.897841 IP 10.14.254.164.59384 > 130.221.69.14.69:  38 RRQ "switch-config/by-    name/switch1" octet
20:38:43.899754 IP 10.14.254.164.59384 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:38:49.903083 IP 10.14.254.164.59384 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:38:56.907874 IP 10.14.254.164.59384 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:39:04.908915 IP 10.14.254.164.59384 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:39:12.909728 IP 10.14.254.164.59384 > 130.221.69.14.69:  23 ERROR EUNDEF "Session terminated"

Al hacer un tcpdump en eth0/$NETWORK_WAN (DESPUÉS de NAT), veo:

¿Veo tráfico icmp aquí?

20:21:31.898048 IP 172.25.17.6.59650 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:21:31.899090 IP 172.25.17.6 > 130.221.69.14: ICMP 172.25.17.6 udp port 59650 unreachable, length 55
20:21:39.024682 IP 172.25.17.6.59650 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:21:39.025524 IP 172.25.17.6 > 130.221.69.14: ICMP 172.25.17.6 udp port 59650 unreachable, length 55
20:21:47.029243 IP 172.25.17.6.59650 > 130.221.69.14.69:  38 RRQ "switch-config/by-name/switch1" octet
20:21:47.030220 IP 172.25.17.6 > 130.221.69.14: ICMP 172.25.17.6 udp port 59650 unreachable, length 55
20:21:55.030448 IP 172.25.17.6.59650 > 130.221.69.14.69:  23 ERROR EUNDEF "Session terminated"

¡Cualquier ayuda sería muy apreciada!

Sinceramente Tor.

Respuesta1

Probablemente necesite cargar el asistente NAT tftp ya que tftp es uno de estos protocolos que no funciona bien con NAT.

Intentar modprobe nf_nat_tftp.

Nota: La información anterior proviene de un sistema que usa nftables, no iptables. Su experiencia puede ser diferente. En cualquier caso, intente encontrarlo en /lib/modules/<kernel-version>/kernel/net/el directorio, probablemente en un subdirectorio netfilteren el nivel superior o en los directorios ipv4 o ipv6.

información relacionada