V
V
virus1x2021-05-03 20:15:24
iptables
virus1x, 2021-05-03 20:15:24

How to properly configure iptables port forwarding?

We have a linux machine with two interfaces wlan0 ip 10.8.0.1 and eth0 ip 192.168.0.10 need to forward the port from wlan0 to eth0 to ip 192.168.0.2
Tried:
iptables -t nat -A PREROUTING --dst 10.8.0.1 -p tcp -m tcp --dport 2080 -j DNAT --to-destination 192.168.0.2:80
iptables -I FORWARD -i wlan0 -o eth0 -d 192.168.0.2 -p tcp -m tcp --dport 80 -j ACCEPT
doesn't work.
net.ipv4.ip_forward is enabled.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Sechin, 2021-05-03
@tamogavk

And this Linux machine is a gateway for one of the subnets or what? If not, then it is necessary to reverse forward to do otherwise, asymmetry and tsp will not be established in this case

A
alegzz, 2021-05-03
@alegzz

enable masquerading. if the host 192.168.0.2 does not know the route to the wlan network, then on both interfaces

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question