Answer the question
In order to leave comments, you need to log in
How to forward packets from a specific port to another interface?
The situation is this: there is a Raspberry behind a NAT (GSM modem), a data logger is connected to it via LAN. Through the remot3.it service, I remotely access port "1234" on raspberry. How can I reach the datalogger?
Those. I need to redirect all packets coming to port 1234 to 192.168.0.255:61234.
What I tried:
The address of the distribution in the LAN is the gateway for the data logger.
Tried to set up port forwarding
iptables -t nat -A PREROUTING -p tcp --dport 1234-j DNAT --to-destination 192.168.0.255:61234
Answer the question
In order to leave comments, you need to log in
At first glance, you did everything right. It is worth checking what you can do with the forwarding table:
and make sure that traffic from external resources to the internal address is allowed.
Add if necessary.
And it’s also worth checking that forwarding is enabled in the kernel, check like this:,
if necessary, cat /proc/sys/net/ipv4/ip_forward
enableecho 1 > /proc/sys/net/ipv4/ip_forward
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question