Access webserver from outside LAN

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

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

Post Reply
glik22
OpenVpn Newbie
Posts: 2
Joined: Wed Jan 13, 2016 12:34 am

Access webserver from outside LAN

Post by glik22 » Wed Jan 13, 2016 12:38 am

I'm running both a webserver and the openvpn client with private internet access on my raspberry pi. On my router I forwarded the port nginx is running on to my pi. When inside my LAN, I can access my server at <external_ip>:<port>. This doesn't work outside my LAN though.

I think I have to setup some ip table rules to get this working. A quick check with "iptables-save" shows that I have no rules setup. Anyone know how I can get this working?

Thanks.

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Access webserver from outside LAN

Post by Traffic » Wed Jan 13, 2016 10:25 am

glik22 wrote:'m running both a webserver and the openvpn client with private internet access on my raspberry pi
While using PIA, your Pi will have it's default gateway redirected.
glik22 wrote:When inside my LAN, I can access my server at <external_ip>:<port>. This doesn't work outside my LAN though
Because of PIA (above).
glik22 wrote:Anyone know how I can get this working
It depends what you need PIA for ..

glik22
OpenVpn Newbie
Posts: 2
Joined: Wed Jan 13, 2016 12:34 am

Re: Access webserver from outside LAN

Post by glik22 » Wed Jan 13, 2016 4:09 pm

I'd like to route all traffic through the VPN except for:
  • 1) Connections made to my pi from inside my lan. What I mean is going to <pi's internal ip>:<port>
    2) Connections made to <public ip>:<port of server>

Post Reply