R
R
Romua1d2018-09-06 11:19:50
linux
Romua1d, 2018-09-06 11:19:50

How to forward to the same port in linux?

Guys! I'm talking about port forwarding.
The daemon is running on port 5984. This is a database.
I want to open it from another PC inside the network 192.168.0.102:5984

sudo iptables -t nat -A PREROUTING -p tcp --dport 5984 -j REDIRECT --to-ports 5984

Does not work.
BUT
sudo iptables -t nat -A PREROUTING -p tcp --dport 5983 -j REDIRECT --to-ports 5984

Works

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
O. J, 2018-09-06
@Romua1d

sudo iptables -A INPUT -p tcp --dport 5984 -s 192.168.0.0/24 -j ACCEPT

old rules should be deleted.

I
ISE73, 2018-09-06
@ISE73

It seems to me that you need to dnat (change the destination address) on the PC where the daemon is running.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question