Forward port range from WAN through OpenVPN

Scripts with setup, destroy, and modify routing tables and firewall rulesets for client connections.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
Coryy
OpenVpn Newbie
Posts: 1
Joined: Mon Jun 23, 2014 6:01 am

Forward port range from WAN through OpenVPN

Post by Coryy » Mon Jun 23, 2014 6:06 am

Hi,

I've been attempting to forward a port range (or even a single port) from my server's WAN -> a remote client.

I've tried a few combinations of command lines I've seen while looking up the issue, but none seem to work.

Code: Select all

#iptables -t nat -A PREROUTING -p udp --dport 27015 -j DNAT --to-dest 10.8.1.2:27015
#iptables -t nat -A POSTROUTING -d 10.8.1.2 -p udp --dport 27015 -j SNAT --to-source 10.8.1.1


iptables -t nat -A PREROUTING -p udp -i eth0 --dport 27015 -j DNAT --to-destination 10.8.1.2:27015
iptables -A FORWARD -p udp -d 10.8.1.2 --dport 27015 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
The first set of commands was used, and the client gave no notification of a connection when it was attempted (while using verb 7). When the second set of commands was used, it looked like the client was receiving the forwarded packets, but was unable to route them back to the host correctly.

Edit: To specify, I ran command 1a on the host, 1b on the client. I'm assuming that's how it's supposed to be. I also tried 2a&c on the host, and 1b on the client.. I've tried all sorts of combinations.
A little extra info: The host is running CSF (locked down iptables) and the client is simply running a default iptables install. The issue may be as easy as adding another rule, I'm not sure.


Host: 10.8.1.1
Client: 10.8.1.2
Port: 27015
Desired port range: 27000-27050



I will appreciate any help. I've been at this for hours trying to make it work.

Post Reply