1

I have a wlan - router (192.168.1.1) - rpi(192.168.1.2) + Windows PC (192.168.1.3)

The rpi is running as a router on a stick, connected to a VPN (following these instructions). (nothing else on rpi)

The PC is set to default gateway 192.168.1.2, and all traffic on the PC is correctly routed through the VPN tunnel. This all works as it should.

I'm having significant trouble figuring out how to "port forward" now. i.e. without the rpi, the traditional method of forwarding a port, e.g. 21 on the router to the subnet, i.e. 192.168.1.3.

How do I go about using iptables to forward a port to bypass my VPN since my vpn doesn't support port forwarding itself?

i.e. all traffic currently goes through the VPN, how do I set my rpi to filter traffic for port 21 (from the PC) so that it goes through the normal gateway (eth0) rather than the vpn (tun0) and is available from outside?

And on the router, do I still forward the port? and if so, to the rpi or the PC?

I've tried the instructions as outlined here.

but can't get it to work.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

0 Answers0