I have an embedded Linux device tethered to my PC via Ethernet. The PC is able to access a tftp server via VPN, and I am trying to set up iptables rules to allow the embedded device to access the tftp server.
First of all, I used Network Manager to bring up a connection on the eno1 device, and configured the embedded device on the same (private) network. I can successfully access the web configuration page on the device.
Secondly, I added iptables rules on the PC to forward and NAT traffic to and from the VPN, where 192.168.11.0/24
is the private subnet on the local Ethernet, and the remote tftp server is on the 172.16.0.0/16
subnet via tun0
:
-A FORWARD -i eno1 -j ACCEPT
-A FORWARD -o eno1 -j ACCEPT
-A POSTROUTING -s 192.168.11.0/24 -d 172.16.0.0/16 -o tun0 -j MASQUERADE
The device can now access http on the remote server via the VPN, but I have failed to find rules to forward and NAT tftp traffic to the same server. I have manually loaded the following kernel modules (I don't know whether this is necessary):
nf_nat_tftp 16384 0
nf_conntrack_tftp 16384 1 nf_nat_tftp
I have tried every combination of -A FORWARD ... RELATED,ESTABLISHED -j ACCEPT
that I could think of (and that the internet suggested), but no joy. My limited understanding is that I need some sort of stateful forwarding rule, but what can I use, please?