Problema com TFTP e IPTables e (s)-NAT

Problema com TFTP e IPTables e (s)-NAT

Tenho alguns problemas com o download de TFTP por trás de NAT usando IPtables e realmente preciso de sua ajuda. Estou familiarizado com os princípios de rede, mas sou muito novo no IPtables, então me desculpe se estou fazendo algo completamente errado.

Eu tenho um servidor rodando Ubuntu 20.04 com duas nics e que tenta se conectar a um servidor TFTP. Embora todo o resto funcione perfeitamente bem, estou recebendo um tempo limite ao tentar o TFTP. Tenho uma suspeita baseada em um tcpdump, onde vejo algum tráfego icmp que (talvez) não está traduzido corretamente, mas não tenho certeza.

Informações de topologia

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

... configuração do 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

Ao fazer um tcpdump em eth1/$NETWORK_LAN (BEFORE NAT), vejo:

Não vejo nenhum tráfego ICMP aqui.

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"

Ao fazer um tcpdump em eth0/$NETWORK_WAN (APÓS NAT), vejo:

Vejo tráfego ICMP aqui?

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"

Qualquer ajuda seria muito apreciada!

Atenciosamente Tor.

Responder1

Você provavelmente precisará carregar o tftp NAT helper, pois o tftp é um desses protocolos que não funciona bem com o NAT.

Tentar modprobe nf_nat_tftp.

Nota: As informações acima são de um sistema que usa nftables, não iptables. Sua milhagem pode variar. Em qualquer caso, tente encontrá-lo no /lib/modules/<kernel-version>/kernel/net/diretório, provavelmente em um subdiretório netfilterno nível superior ou nos diretórios ipv4 ou ipv6.

informação relacionada