Here's an easy setup with a twist:
There is a Samba server running in the LAN on 192.168.1.88. VPN clients connect directly to the server, cannot see each other and are not routed into the LAN.
I want to redirect or forward:
- All traffic incoming on the tun0 device (172.16.0.1) and Samba port (139) --> Samba server (192.168.1.88)
- All response traffic from Samba server to the VPN server's LAN address (192.168.1.99) --> tun0 device (172.16.0.1) --> VPN client (172.16.0.8)
This is the NAT rule set I tried to achieve the redirect/forward tasks with:
iptables -t nat -I PREROUTING -i tun0 -d 172.16.0.1 -p tcp --dport 139 -j DNAT --to-destination 192.168.1.88:139 iptables -I FORWARD -o tun0 -d 192.168.1.88 -p tcp --dport 139 -j ACCEPT
Addresses in the network:
- Internal VPN address: 172.16.0.1
- VPN server LAN address: 192.168.1.99
- Client address (example): 172.16.0.8
- Samba server LAN address: 192.168.1.88
What's missing in the rules to send the VPN traffic on the right route?
Thanks in advance!