Up Script

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

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

Post Reply
stuconners
OpenVpn Newbie
Posts: 2
Joined: Mon Jul 18, 2016 6:06 pm

Up Script

Post by stuconners » Wed Jul 25, 2018 6:47 pm

Im running openVPN on Libreelec, which uses up and down scripts. My setup allows connections from LAN but not any external connections. How would I allow traffic from the internet into port 8080. There is a webserver on kodi which uses port 8080 with I need to be able to access even if the VPN is up or not. If the VPN is switched off, traffic to port 8080 as expected.

Here is the default up.sh:

#!/bin/bash
iptables -F
iptables -A INPUT -i tun0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i tun0 -j DROP

Ive changed mine to:

#!/bin/bash
iptables -F
iptables -A INPUT -i tun0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -I PREROUTING -p tcp -i eth0 --dport 8080 -j DNAT --to 192.168.1.133:8080
iptables -I FORWARD -p tcp -d 192.168.1.133 --dport 8080 -j ACCEPT
iptables -A INPUT -i tun0 -j DROP

Can anyone point out where im going wrong with this? My IP address of my libreelec box is 192.168.1.133 and i have port forwarding on my router. The end result should allow me to use my external IP address and port to get me to the kodi webserver. PUBLICIP:8080, this works great when the VPN is off. Any help would be great

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: Up Script

Post by TinCanTech » Fri Jul 27, 2018 12:14 pm

stuconners wrote:
Wed Jul 25, 2018 6:47 pm
The end result should allow me to use my external IP address and port to get me to the kodi webserver. PUBLICIP:8080, this works great when the VPN is off.
This would indicate that your customised iptables rules are incorrect.

However, please post your Openvpn server configuration.

Post Reply