I want to forward all tcp packets incoming to my PC`s 7778 port to the connected device. It's ip - Nmap shows that it listens for 7778 port and I can ping it from my PC. According to this answer, I've added the following rules:
iptables -t nat -A PREROUTING -p tcp --dport 7778 -j DNAT --to-destination
iptables -t nat -A POSTROUTING -p tcp -d --dport 7778 -j SNAT --to-source

Where is my PC`s ip.
Also, I've added iptables -I INPUT -p tcp -m tcp --dport 7778 -j ACCEPT

Then, when I'm trying to connect to from another computer, tcpdump -i enp3s0 'port 7778' shows one packet: 19:56:08.035819 IP > alexandr-All-Series.7778: Flags [S], seq 568409282, win 8192, options [mss 1460,nop,nop,sackOK], length 0
But when I'm trying to tcpdump enx006037a1f5ef that "stands" for the connected device, it shows nothhing. And I don't get any response on the computer that has sent the packet.
I'm using Mint 19


Your firewall FORWARD chain policy is set to DROP, and there is no other rule for accepting packets for your port. This means that the firewall will drop the packet when it is becoming to the router.

You need to add the following rule:

iptables -A FORWARD -d -p tcp --dport 7778 -j ACCEPT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.